/wordsmith:writing-effective-agents-mdfrom wordsmith
Use before creating or changing `AGENTS.md` or `CLAUDE.md` files, and when reviewing them.
Ships in wordsmith. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
An AGENTS.md or CLAUDE.md file gives Claude a mental model of the project: what the system is, how its parts fit together, and what must stay true. Claude reads it to learn how to think about any change here, not to collect facts for specific tasks.
These files have no standard template. Choose the content this project needs, and let its size set the length.
Create or change AGENTS.md, CLAUDE.md, or a file they import only when the user explicitly asks for that change. Neither of these counts as a request:
If your work makes an instruction false, or you find knowledge that might belong in one of these files, leave the file unchanged. Tell the user, and propose the exact edit.
Keep a line only when it shapes how Claude approaches many different tasks in this project.
An overview of how the parts fit together belongs here even though Claude could rebuild it from the code, because rebuilding it costs every session. The details behind that overview do not. Leave out directory listings, command lists, dependency versions, and lists of current components, because Claude reads them from the code when a task needs them. A hidden fact that matters for one area or one task does not belong here either, however useful it is. Move it to the home that fits, as "Move detail out of the file" describes.
Then ask whether an ordinary change, such as adding a service or bumping a version, would make the line false. If yes, state the pattern that all members follow instead of naming the members: "Each service under services/ owns its own database", not "The billing, auth, and search services each own a database".
Lines such as "Write clean code" change nothing, so delete them.
Each kind of content below is optional, and a small project needs only a few. Use your own headings, and name them after the idea rather than a generic category: "Each layer has one job" tells Claude more than "Architecture".
| Content | What it gives Claude | Example |
|---|---|---|
| Purpose | What the system is and who it serves | "A Kubernetes-native control plane for defining and running AI agents." |
| Architecture | How the major parts fit together | "Harness compilers translate templates into backend inputs. Adapters apply them." |
| Component boundaries | The job of each layer, and what it leaves to others | "The store persists state. It does not launch actors." |
| Sources of truth | Which artifact wins when copies disagree | "Generated code is never the source of truth." |
| Design vocabulary | The terms the project reasons with | "Semantic functions are pure. Pragmatic functions wire them to I/O." |
| Homes for work products | Where temporary and lasting knowledge go | "Keep plans in the gitignored .plans/. Merge lasting decisions into docs/architecture/." |
Describe the major areas, not every directory.
Invariants are the things that must stay true whatever the task. How many a project has depends entirely on the project: many have none worth stating, and some have ten. Record only the invariants that the code already follows or that the user names, and never add one to fill the section. If you find none, leave the section out. For each one, write what must hold and why, in two to four sentences. A good invariant is:
For example, "Keep things separate" fails, but this passes:
Domain modules must not import infrastructure packages. This keeps the domain layer portable and testable without external services.
Follow these practices when you write invariants:
file:line references in the conversation only. They go stale after a refactor, and the code remains the source of truth.make generate, because clients are built from the committed output" qualifies. A list of common commands does not.## Tenets, keep that format, and change the section only when asked.A small project can stop at a few short sections:
# HomeLab
This repository defines the Kubernetes clusters and the hosts around them, from the VM image to public ingress. One person runs it for personal use.
## How the layers fit together
Each layer hands over to the next: Packer builds the VM image, Terraform provisions the VMs and bootstraps Talos, and Flux manages everything that runs on the clusters. Ansible manages only the hosts outside the clusters.
## What must stay true
- Git describes the desired state. A change made directly on a cluster is temporary until Git matches it.
- Nodes are disposable. Persistent data must live outside their boot disks, so that you can replace any worker.
Keep only what applies across the project. Move the rest to the home that loads it when needed:
| Material | Home | When it loads |
|---|---|---|
| Instructions for one directory | Nested AGENTS.md or CLAUDE.md | When Claude works in that directory |
| Instructions for matching files | Path-scoped rule | When Claude reads or edits a matching file |
| Procedure or occasional task | Skill | When relevant or invoked |
| Background and design detail | Linked document | When Claude follows the link |
| Constraint on one specific line | Code comment | When Claude reads that code |
Tell Claude when to follow a link: "Before you change the wire format, read docs/protocol.md." Use a plain link rather than an @ import for material that most sessions do not need, because an imported file loads with the file that imports it and costs the same context.
By default, Claude Code reads AGENTS.md only when no CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md exists in the working directory or above it. If a repository has both files, AGENTS.md does not load unless CLAUDE.md imports it with @AGENTS.md.
Write the instructions in one file, and use the import to share them. Choose AGENTS.md when other coding tools read the repository too. Claude Code does not read AGENTS.local.md, AGENTS.override.md, or anything under .agents/.
Match the length to the project. Treat 200 lines as a ceiling, not a target, and count imported files towards it. Longer files use more context and reduce how closely Claude follows them.
Integrate each new instruction into the section where it belongs, and replace what it supersedes. If an instruction has no natural place, question whether it belongs in this file.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
5 skills in this plugin
/comment-disciplineUse when writing, editing, or reviewing code or config in any language, including IaC and manifests, to decide whether a comment belongs and how to word it./document-disciplineUse before creating or changing documentation, including READMEs, `docs/` files, runbooks, and design documents, or when deciding whether knowledge from a task should be written down./writing-effective-readmeUse before creating or changing a repository's root `README.md`, and when reviewing it./writing-effective-rulesUse before creating or changing Claude Code rules, and when reviewing them, including files in `.claude/rules/` and `~/.claude/rules/`.npx claudepluginhub davidnlopes/claude-code-plugins --plugin wordsmith