
How to Build a Claude Agent with Claude Routines: A 6-Step Guide
Summary
A practical six-step guide to building a Claude agent and running it on autopilot with Claude Routines — install, CLAUDE.md, memory, skills, subagents, and scheduled cloud triggers.
Anthropic shipped Claude Code Routines in April 2026, and the practical upshot is that a Claude agent no longer has to live inside an open laptop. You can author the agent locally in Claude Code, then attach a Routine that runs it in Anthropic's cloud on a cron schedule, an HTTP trigger, or a GitHub event. This guide walks through the six steps to get a working Claude agent on autopilot — install, context, memory, skills, agents, Routines — and where each one tends to break in production. Book a 30-minute walkthrough if you want the same setup applied to your team's workflows.
Why "agent on a laptop" stops working fast
The first Claude agent most teams build is a Claude Code session running on a developer's machine. It works beautifully for an afternoon — until the laptop sleeps, the terminal closes, or the developer goes on leave. The agent is dependent on a human keeping the lid open. Anything overnight, anything weekly, anything triggered by an external event simply doesn't run.
Routines close that gap by hosting the agent on Anthropic's cloud. The agent's prompt, repository access, and connectors are packaged once and re-fired on a schedule or webhook. For Singapore organisations evaluating agentic AI under IMDA's Model AI Governance Framework, this also matters operationally — a Routine has a stable audit trail, scoped credentials, and a fixed prompt you can review, instead of an ad-hoc shell session.
What "good" looks like for a production Claude agent
Before wiring anything up, decide what the agent is and isn't allowed to do. A useful agent is narrow in scope, deterministic in inputs, and has a single named owner. The six layers below — adapted from Charlie Hills' "Build an AI Agent in 10 Minutes" framework — are the minimum we ship with for any client engagement.
1. Install Claude Code
Pick one surface: the terminal CLI (npm i -g @anthropic-ai/claude-code), the desktop app, or the VS Code extension. The choice only matters for the human developer — the agent itself behaves identically. For teams new to agentic development, the VS Code extension is usually the gentler on-ramp because the file tree, diffs, and terminal stay in one window.
2. Build context with CLAUDE.md
A CLAUDE.md at the repository root is the onboarding doc Claude reads at the start of every session. Treat it as the agent's job description: role, voice, banned words, output defaults, escalation rules. The single biggest mistake teams make here is treating CLAUDE.md as a README — it isn't documentation for humans, it's a system prompt that ships in every conversation. Keep it tight (under 200 lines), and review it whenever the agent does something surprising.
3. Build memory
Persistent memory turns "the agent learned that lesson once" into "the agent remembers it forever". The pattern: every correction the developer makes is saved as its own .md file under ~/.claude/projects/<project>/memory/, indexed in a MEMORY.md file. The next session loads the index automatically. Without this, the same mistake keeps landing — with it, the agent compounds in usefulness over weeks.
4. Build skills
A skill is a packaged workflow — one slash command that runs a multi-step process across multiple tools. Skills live under ~/.claude/skills/<name>/SKILL.md and can wire in MCP connectors (Notion, Gmail, Drive, Linear, internal APIs). The 200-word prompt you keep retyping into ChatGPT is a skill in disguise — once captured, it becomes a one-command operation that any teammate can fire.
5. Build agents (subagents)
For non-trivial work, a single Claude session orchestrates specialised subagents. The pattern we use is one file per role under ~/.claude/agents/ — a Strategist (Opus) for analysis, a Builder (Sonnet) for execution, and a QA gate that fails any work below a defined bar. This stops the common failure mode of one giant prompt trying to do everything badly.
6. Run on autopilot with Claude Routines
A Routine packages the agent's prompt, repositories, and connectors into a saved configuration that runs in Anthropic's cloud. Three trigger types: a schedule (cron-style — daily at 08:00 SGT, weekly on Mondays), an API call (HTTP POST with a bearer token to a per-Routine endpoint), or a GitHub event (pull request opened, release published). Routines ship in research preview across Pro, Max, Team, and Enterprise plans.
The six layers, mapped to where they live
| Layer | Where it lives | What it controls |
|---|---|---|
| Install | Local machine | How the developer talks to Claude |
| CLAUDE.md | Repo root | The agent's standing brief |
| Memory | ~/.claude/projects/<p>/memory/ | What the agent remembers between sessions |
| Skills | ~/.claude/skills/<name>/ | Repeatable multi-tool workflows |
| Agents | ~/.claude/agents/<role>/ | Specialised subagent roles + QA gates |
| Routines | Anthropic cloud | Schedule, API, and GitHub triggers |
A worked example: a nightly compliance digest agent
Take a training organisation operating under SSG-WSQ. The compliance team needs to know, every weekday morning, which active courses have trainer or assessment paperwork expiring in the next 30 days. Wiring this up by the six-step framework:
- CLAUDE.md. The agent's role is "WSQ compliance scanner", with an explicit rule never to write to the LMS — read-only against the database, output to a daily report.
- Memory. Every false positive the compliance lead corrects ("this trainer's certification was renewed on the registrar's side") is saved as a memory entry so the agent stops surfacing it.
- Skill. A
/compliance-digestskill queries the LMS, pulls trainer records, formats a Markdown report, and posts to a Notion page via the MCP connector. - Agent. One subagent runs the query, a second QA-checks the output against the source database before publishing.
- Routine. A scheduled Routine fires the skill at 06:30 SGT every weekday and emails the digest to the compliance lead's inbox.
The total build time for a setup like this is two to three days, not two to three weeks — most of which is spent defining what the agent should refuse to do, not what it should do. Request a demo of this exact agent if you want to see the wiring end-to-end.
What we recommend
For teams in Singapore standing up a first Claude agent, we run a two-week scoped engagement: week one to define the CLAUDE.md and skills, week two to wire the Routine and connect the QA gate. We also run the WSQ Agentic AI Applications with Claude Code course at Tertiary Courses Singapore, which takes a developer or operations lead through the same six layers hands-on. For the broader AI curriculum, see the artificial intelligence courses at Tertiary Courses Singapore.
Our own AI consulting practice — see AI solutions at Tertiary Infotech Academy — focuses on the unglamorous parts: scoping what the agent isn't allowed to do, defining the QA gate, and making sure the Routine's bearer token is rotated and logged. If you already have a working Claude Code setup and just need help getting a Routine into production safely, that's the lighter deployment-only engagement.
FAQ
Do I need an Anthropic API key to run a Routine?
No. Routines run under your Claude subscription (Pro, Max, Team, or Enterprise) — there is no per-call API billing. The Routine consumes from your plan's usage pool the same way an interactive Claude Code session does. This makes cost forecasting much easier than per-token API metering.
How is a Routine different from a cron job calling the Anthropic API?
A cron job invoking the Messages API gives you one model call. A Routine runs a full Claude Code session — with your repository checked out, tools available, MCP connectors connected, and memory + skills loaded. The Routine is closer to "scheduled developer" than "scheduled completion".
Can the agent be reviewed before it does something destructive?
Yes, and you should design for this from the start. Standard pattern: the agent opens a pull request rather than committing to main, or writes to a draft Notion page rather than the live one. The QA-gate subagent acts as the deterministic check before any external-facing action.
Is this suitable for SSG-funded training organisations?
The technology is — the harder question is data residency. If the agent reads learner PII, run a scoped pilot first against synthetic data, and confirm with your compliance team that the Routine's bearer token + audit log meet your internal controls before pointing it at the production LMS.
What's the learning curve for a non-developer?
The CLAUDE.md and memory steps are accessible to anyone comfortable writing structured documentation. The skill, agent, and Routine steps assume comfort with a terminal and a YAML / Markdown configuration mindset. The WSQ course bridges that gap — most learners ship a working agent by day two.
What to do next
- Read. Anthropic's Routines documentation is the canonical reference — start there before any vendor blog.
- Learn. Enrol in WSQ Agentic AI Applications with Claude Code for a hands-on, SkillsFuture-claimable run through the six layers.
- Build. Talk to us about scoping a first Claude agent + Routine for your team — the two-week engagement model above is our default starting point.
