agentleFS
rkalievrkaliev/eng-kit/skills/writing-skills/references/agents.md

eng-kit / references

AGENTS.md1 starsChanged 13 days agoMITView on GitHub

A subagent is a role with its own context window, its own tools and a fixed report. Write one when isolation is the point; write a skill when the main agent should learn a technique. agents/<name>.md in a plugin, .claude/agents/ in a project, ~/.claude/agents/ for the user. Frontmatter, then the system prompt: Plugin agents can't set hooks, mcpServers or permissionMode; put hooks in the plugin's hooks/hooks.json. The user calls one explicitly with @agent-<plugin>:<name>. Check the current field list in the…

The file

We split this agents.md into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check the tool limits hold: ask the read-only agent to edit a file and confirm it can't.

    line 44
  2. Distinctive:

    Check delegation: describe the task in plain words and see whether the main agent picks this agent.

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
agents.md

Writing subagents

A subagent is a role with its own context window, its own tools and a fixed report. Write one when isolation is the point; write a skill when the main agent should learn a technique.

Agent or skill

NeedUse
Know-how the main agent applies in its own contexta skill
Work whose transcript would flood the main context (search, review, a long investigation)an agent
A fresh view that must not see the author's reasoning (review)an agent
Narrower permissions than the session (read-only review, no network)an agent
A self-contained task that returns one resulta skill with context: fork, or an agent

Format

agents/<name>.md in a plugin, .claude/agents/ in a project, ~/.claude/agents/ for the user. Frontmatter, then the system prompt:

---
name: api-auditor             # lowercase, hyphens
description: Read-only API auditor. Use after … to …   # decides delegation
tools: Read, Grep, Glob, Bash      # allowlist; omitted = every tool the session has
disallowedTools: Edit, Write       # removed from what is inherited
model: opus                        # sonnet | opus | haiku | inherit | a full id
effort: xhigh
---

Plugin agents can't set hooks, mcpServers or permissionMode; put hooks in the plugin's hooks/hooks.json. The user calls one explicitly with @agent-<plugin>:<name>. Check the current field list in the Claude Code sub-agents docs before using a field not shown here.

The prompt

  • One responsibility. "Review a git range against its requirements", not "review and fix".
  • Least privilege. Grant only the tools the role needs. A reviewer gets no edit tools; a researcher gets no shell. A shell can write files, so a read-only role that needs one also needs a hook or guard rule that limits its commands. Nesting (an agent dispatching agents) stays off unless the role is an orchestrator: leave Agent out of tools or add it to disallowedTools.
  • Model by stakes: the most capable model for writing code, review, security and design judgment; a fast one for search and mechanical work.
  • Self-contained input. The agent never sees the conversation. Its prompt says what it receives (task text, paths, ranges, commands) and what to do when something is missing: report NEEDS_CONTEXT, don't guess.
  • A fixed report. End with machine-readable lines the caller or a hook can parse (a status word, a verdict, the SHAs reviewed) and a short human summary. Say what counts as evidence (commands run with their output, file:line). Bound the report (at most N items, M words), say how many items were left out, and report a source it could not read instead of inventing one.
  • Boundaries. What it must never do (push, edit outside the task, weaken tests) and when it stops and returns.

Test it

  1. Dispatch it on a real task from this repo and on one with missing input. Check that the report has every required line and that missing input produces the stop status, not a guess.
  2. Check the tool limits hold: ask the read-only agent to edit a file and confirm it can't.
  3. Check delegation: describe the task in plain words and see whether the main agent picks this agent. Rewrite the description if it doesn't.
  4. A change to an agent's prompt or tools is reviewed like code; a hook that parses its report has a test with a sample report.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.