Build AI agents with Claude Code
Claude Code is Anthropic's terminal-native coding agent. You can extend it with custom skills, hooks, and MCP servers to build domain-specific agents that own real workflows.
Prerequisites
- +Claude Code installed (npm install -g @anthropic-ai/claude-code)
- +Anthropic API key or Max subscription
- +Familiarity with bash and JSON config
Step-by-Step
- 1
Initialize a project CLAUDE.md
Drop a CLAUDE.md at the root. This file is loaded into every session and is the single most important lever you have over agent behavior.
# Project: Invoice Auditor ## Mission Find anomalies in monthly vendor invoices and flag them. ## Tools - bq for BigQuery queries - Slack via mcp server ## Rules - Always cite the SQL behind a flag - Never modify production data - 2
Add a custom skill
Skills are reusable slash commands. Place a SKILL.md in ~/.claude/skills/commands/<name>/ with a description and a body.
--- name: audit-invoice description: Audit a vendor invoice against historical baselines --- Given an invoice ID, query the last 12 months of vendor data, compute mean and stddev, and flag any line item more than 2 sigma from baseline. - 3
Wire up an MCP server
MCP gives the agent access to external systems. Add servers via .mcp.json at the project root.
{ "mcpServers": { "bigquery": { "command": "uvx", "args": ["mcp-server-bigquery", "--project", "my-gcp"] } } } - 4
Add a stop hook for guardrails
Hooks run shell commands at lifecycle events. A Stop hook is great for posting summaries or running tests.
{ "hooks": { "Stop": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "bash -c \"echo done >> ~/.audit.log\"" }] }] } } - 5
Run the agent headless
Use claude -p for one-shot runs. Wire it into a cron job or GitHub Action for autonomous operation.
claude -p 'audit invoice INV-2026-0142 and post the result to #finance' - 6
Iterate with /resume
When something breaks, use /resume to pick up the previous session and debug. Treat the transcript as your audit log.
Common Pitfalls
- !Bloated CLAUDE.md (over 500 lines) eats context window. Move details into skills.
- !Skipping permission prompts via --dangerously-skip-permissions in production.
- !MCP servers without auth scoping leak everything. Always scope by project/dataset.
Agent Hub
Run, monitor, and orchestrate your agent fleet from one dashboard. Built for multi-agent teams.
What's Next
- ->Package your agent as a plugin so the team installs it with one command.
- ->Add evals using the Anthropic SDK to measure regressions.
