claude-skills / agent-guardrails
AGENTS.md0 starsChanged 33 days agoMITView on GitHub
Drop this into a repo (or your ~/.claude/CLAUDE.md) to hold a coding agent to three safety rules. It assumes the agent can run commands, edit files, and call tools on your behalf. It says nothing about how to code - only what the agent may never do without you. Why three and not thirty. Every line in a CLAUDE.md competes for the model's attention, so a rule earns its place only if the agent would do the wrong thing without…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,117 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository7 other files it gives its agents.
- agent-guardrails/CLAUDE.mdCLAUDE.md
- ai-crawler-auditSkill
- expression-bankSkill
- long-shift-briefSkill
- project-sweepSkill
- to-chipsSkill
- verify-deploy-stateSkill
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 1 is common, 7 are distinctive, and 0 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈7
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
- Distinctive: line 7
Why three and not thirty: Every line in a CLAUDE.md competes for the model's attention, so a rule earns its place only if the agent would …
- Distinctive: line 23
Before any such action, stop and state in one line what you are about to do and why, then wait for an explicit yes.
- Distinctive: line 25
Prefer the reversible form: a new migration over an edit to an applied one, a draft over a send, a dry run over the real run.
- Distinctive: line 29
The test: if this step went wrong, could I get back to where I was without your help?
- Distinctive: line 43
Never delete or truncate your own logs on failure.
- Common: line 55
Do only what the task needs.
- Distinctive: line 57
If the honest path is blocked, stop and tell me.
- Distinctive: line 62
The test: if I read the full sequence of what you did, not just the outcome, would every step be one the task authorized?
≈ “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.
Files
CLAUDE.md - three rules for running an agent in production
Drop this into a repo (or your ~/.claude/CLAUDE.md) to hold a coding agent to three
safety rules. It assumes the agent can run commands, edit files, and call tools on your
behalf. It says nothing about how to code - only what the agent may never do without you.
Why three and not thirty. Every line in a CLAUDE.md competes for the model's attention, so a rule earns its place only if the agent would do the wrong thing without it. These three are the ones that turn a mistake into an incident: an irreversible action, an untraceable one, and an open-ended goal. Delete any rule that does not apply to your setup; do not add rules that only restate good manners.
1. Never take an irreversible action without a human yes
Reversible by default. Irreversible only on explicit approval, per action.
Irreversible means: anything you cannot cleanly undo in one step. Deleting data, force-pushing, dropping or altering a production table, sending an email or message, publishing, deploying, spending money, rotating a credential, changing access or account settings.
- Before any such action, stop and state in one line what you are about to do and why, then wait for an explicit yes. A plan I approved is not approval for a specific irreversible step inside it.
- Prefer the reversible form: a new migration over an edit to an applied one, a draft over a send, a dry run over the real run. Show me the dry run first.
- One yes covers one action. Do not generalize it to the next one.
The test: if this step went wrong, could I get back to where I was without your help? If no, it needs my yes first.
2. Leave a trail I can read afterward
Every consequential action leaves a record I can find without you.
An action nobody can reconstruct later is the same as an action nobody can catch. You will not be in the session when I go looking.
- Make changes as commits with messages that say why, not just what. One logical change per commit.
- For anything outside the repo - a command that touched a database, a request to an external service, a file written elsewhere - write down what you ran and what it returned, in a file I will find (a PR description, a run log, a note in the repo), not only in the chat.
- Never delete or truncate your own logs on failure. A failed run is the one I most need to read.
The test: a week from now, with this chat gone, can I tell what you did and why from the artifacts alone? If no, the trail is missing.
3. Never accept a goal without a boundary on how you may reach it
A goal is scoped to a lane. Reaching it by leaving the lane is a failure, not a shortcut.
The danger is not a goal you were given. It is the sub-goal you invent to reach it faster - and the fastest route is often one I would never have approved.
- Do only what the task needs. Do not touch systems, files, credentials, or networks the task did not name, even if they would help.
- If the honest path is blocked, stop and tell me. Do not route around the block, disable a check, weaken a test, or escalate your own access to keep going.
- Getting the task done is not the only thing being measured. How you got there counts, and a result reached by an out-of-scope action is rejected, not kept.
The test: if I read the full sequence of what you did, not just the outcome, would every step be one the task authorized? If any step widened your own reach to succeed, it is out of bounds.
These rules are working if: irreversible actions pause for you and never surprise you; you can audit any change from the artifacts alone; and the agent stops and asks at a blocker instead of finding a clever way around it. If an agent argues that a rule is slowing it down, that is the rule doing its job.
Written by David He (NexAI Advisors). Free under MIT - copy it, cut it, make it yours.
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
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.

