Post

Create and Run Claude Agents Locally

An “agent” in Claude Code is just a folder with a CLAUDE.md in it. Run claude from that folder and Claude loads those instructions. No server, no framework.

1. Install Claude Code

Use the official installer, not npm or Homebrew.

1
2
curl -fsSL https://claude.ai/install.sh | bash
claude --version

Then run claude once and log in with your Claude account.

2. Create the agent folder

One folder per role. Keep them under a shared parent so common rules live in one place.

1
2
3
4
5
6
agents/
├── CLAUDE.md                  # shared rules for every agent
├── senior_wordpress_developer/
│   └── CLAUDE.md              # this agent's role and rules
└── form_tester/
    └── CLAUDE.md

Claude reads CLAUDE.md files from the current folder and every parent folder above it. Shared rules go in the parent. Role-specific rules go in the agent folder.

3. Write the CLAUDE.md

Keep it short and specific. Only include what Claude can’t figure out for itself.

1
2
3
4
5
6
7
8
9
10
11
# Senior WordPress Developer

Only work on WordPress sites. If it isn't WordPress, you're the wrong agent.

## Rules
- Plan first. Read the error logs before editing code.
- Test locally before anything is pushed.
- Ask before writing to GitHub or Asana.

## Local sites
- Example site: https://example.ddev.site, theme in ~/wp_playground/example/wp-content/themes/example

Point to other files for detail instead of pasting it all in (brand guides, SOPs, checklists).

4. Run it

1
2
cd ~/agents/senior_wordpress_developer
claude

Start in plan mode (shift+tab to cycle modes) so the agent explains its plan before touching anything.

5. Give it memory

Add this to the agent’s CLAUDE.md:

1
2
## Memory
Keep a log of what you learn about each site in ./memory/. Read it at the start of every session.

Each agent gets its own memory/ folder, so it gets smarter about its own sites over time.

6. Add skills for repeat jobs

A skill is a recipe for a task you do often (deploying, local setup, QA checklists).

1
2
3
~/.claude/skills/web-dev-deploy/
├── SKILL.md      # name, description, trigger phrases, steps
└── deploy.sh     # optional reusable script

SKILL.md starts with frontmatter:

1
2
3
4
---
name: web-dev-deploy
description: Use when deploying changes to staging or production. Triggers on "deploy this", "push to staging".
---

Claude picks the skill when your prompt matches the description, or you can call it with /web-dev-deploy. When a skill gets something wrong, fix the skill so the error doesn’t repeat.

7. Sub-agents inside a session

For one-off parallel jobs (searching a codebase, reviewing a diff) ask Claude to spin up sub-agents. To keep a reusable one, add a markdown file at .claude/agents/code-reviewer.md:

1
2
3
4
5
6
---
name: code-reviewer
description: Reviews diffs for security and best practice. Use before merging.
tools: Read, Grep, Bash
---
You review code changes. Flag unsanitised input, secrets, and repeated code.

8. Keep secrets out of git

  • Credentials go in a local .env and the .env goes in .gitignore.
  • Never put tokens in CLAUDE.md, skills or memory files.

Tips

  • More Claude basics (skills, plugins, connectors): Claude Code Cheatsheet.
  • Add the folder to git so the whole team gets the same agents.
  • Ask Claude to update the CLAUDE.md when it makes a mistake. Every correction makes the agent better.
  • Use /permissions to allow read-only commands so it stops asking.
This post is licensed under CC BY 4.0 by the author.