agent-skills
AGENTS.md3 starsChanged 33 days agoMITView on GitHub
Instructions for agents editing this repo. CLAUDE.md is a symlink to this file. The repo ships two Agent Skills: coding-standards (code rules, enforced by write-time hooks) and writing-standards (document rules, delivered as a reminder injected on SessionStart and UserPromptSubmit). The maintainer's settings wire the coding-standards hooks, so a violating write here is blocked like anywhere else: no junk-drawer file names (ST-005), no any/Any/interface{}/dynamic/mixed, no Hungarian notation, no 4+ positional arguments, no deep imports (ST-003). If a rule is wrong, fix…
- Deletes or force-pushes
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 31,542 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 repository3 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- coding-standardsSkill
- writing-standardsSkill
The file
We split this AGENTS.md into the rules it gives an agent
12 rules. About 0 are common, 2 are distinctive, and 10 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.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 39
Put the rule code in every message: FN-005: function takes 4+ positional arguments.
- Very specific: line 47
Create skills/coding-standards/references/<framework>/structure.md, opening with ## Builds on common/structure.md and naming the universal …
- Very specific: line 48
Add a row to the detection table in SKILL.md Step 3.
- Very specific: line 49
Update the coverage table in hooks/README.md.
- Very specific: line 54
Never run bootstrap or hooks against the real ~/.claude/settings.json.
- Very specific: line 67
Run the suite with the interpreter that has tree-sitter (the bootstrap venv): hooks/tests/run-all.py.
- Distinctive: line 69
Test a single hook by piping a payload:
- Very specific: line 80
After touching scope detection, run hooks/tests/test-bootstrap-matrix.py.
- Very specific: line 86
Run outside any .claude/ tree → refuses without writing.
- Very specific: line 93
Test design, performance tuning, security review, visual UI review, and anything the project's own linter (tsc, ESLint, ruff, …
- Distinctive: line 98
Every PR passes its own hooks.
- Very specific: line 99
Keep hooks/README.md and its coverage table in sync with the hook files.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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
AGENTS.md
Instructions for agents editing this repo. CLAUDE.md is a symlink to this file.
The repo ships two Agent Skills: coding-standards (code rules, enforced by write-time hooks) and writing-standards (document rules, delivered as a reminder injected on SessionStart and UserPromptSubmit).
The skill's rules apply to this repo
The maintainer's settings wire the coding-standards hooks, so a violating write here is blocked like anywhere else: no junk-drawer file names (ST-005), no any/Any/interface{}/dynamic/mixed, no Hungarian notation, no 4+ positional arguments, no deep imports (ST-003). If a rule is wrong, fix the rule and add a test case. Never bypass the hook.
Layout
skills/
coding-standards/
SKILL.md entry point; Step 0 runs bootstrap.py
bootstrap.py installer; must stay at the skill root
_bootstrap/ installer internals
hooks/ enforcement hooks, shared helpers (_*.py), tests/
references/ common/ rules + <framework>/structure.md
workers/ prompts for the review pipeline's agents
evals/ false-block-rate and block-recovery evals for the hooks
writing-standards/
SKILL.md, bootstrap.py, _bootstrap/, hooks/, references/common/
evals/ with/without-skill agent evals (`claude plugin eval .`)
.github/workflows/ CI: hook suite on Linux and macOS, plus the skill linting itselfPaths inside a SKILL.md are relative to that SKILL.md. The skill is installed by symlink and must work from ~/.claude/skills/<name>/ and <project>/.claude/skills/<name>/ alike.
Adding a hook
- Register the script's basename in
_bootstrap/hook_registry.pyonly, under its event:HOOK_FILES(PreToolUse),POST_TOOL_USE_FILES,STOP_FILES. Entry builders, recognizers,hooks/settings.example.jsonand the config-sync test all read these lists.PostToolUseandStopbelong to the opt-in comment judge (COMMENT_JUDGE_EVENTSin_bootstrap/hook_identity.py): their scripts are required only once the judge is wired. - Bootstrap never changes a user's machine unasked: SKILL.md Step 0 asks before a first install, and anything with a running cost is opt-in.
- Hooks are stdlib-only Python. A required third-party package goes in
_bootstrap/dependencies.py'sREQUIRED_PACKAGESonly, as one(import_name, pip_name)tuple; raiseMIN_PYTHONthere if it needs a newer Python. Prefer a regex orastcheck over a new dependency. - Route every path written into a hook command through
command_path(_bootstrap/paths.py). Git Bash on Windows eats the backslashes of a native path. Paths Claude Code reads directly, such aspermissions.additionalDirectories, stay native.hooks/tests/test-windows-command-paths.pyguards this. - Precision over recall: a pattern with a false-positive rate above ~1% must not hard-block. Record the trade-off in the hook's docstring.
- Strip strings and comments before matching content (
strip_strings_and_comments()). Exceptions: import-path checks, andblock-swallowed-errors.py, where a comment inside an emptycatchis the allowed EH-002 escape. - Put the rule code in every message:
FN-005: function takes 4+ positional arguments. - PreToolUse: exit 2 with stderr to block, exit 0 to pass. A real but imprecise signal exits 0 with an advisory, and the hook is named
advise-*. - Emit advisories through
advise()/advisory_message()in_hook_run.py; stderr from an exit-0 hook reaches only the debug log. Read them back withadvisory_text(). - End every
UserPromptSubmitcommand with; exit 0. Exit 2 there erases the user's prompt, and a command the shell cannot start exits 2 before the script runs. Other events keep their exit codes.hooks/tests/test-prompt-hook-fail-open.pyguards both installers. - A new language's extension goes in
hooks/_languages.py:SOURCE_EXTENSIONSfor the path and god-file checks,CONTENT_HOOK_EXTENSIONSonce its content hook ships.
Adding a framework
- Create
skills/coding-standards/references/<framework>/structure.md, opening with## Builds on common/structure.mdand naming the universal rules it specializes or exempts. - Add a row to the detection table in
SKILL.mdStep 3. Pair file extensions with framework-specific markers (package.jsonkeys, root config files);.tsalone is not a signal. - Update the coverage table in
hooks/README.md. - For a new language, ship
block-<lang>-violations.pycovering at least argument count, the language'sany, and its Hungarian convention.
Testing
Never run bootstrap or hooks against the real ~/.claude/settings.json. Point HOME at a sandbox first:
SANDBOX=$(mktemp -d)
export HOME="$SANDBOX/home"
mkdir -p "$HOME/.claude/skills"
ln -sf /path/to/repo/skills/coding-standards "$HOME/.claude/skills/coding-standards"
# run bootstrap.py / hooks here
rm -rf "$SANDBOX"Bootstrap tests build that sandbox through hooks/tests/bootstrap_sandbox.py.
Run the suite with the interpreter that has tree-sitter (the bootstrap venv): hooks/tests/run-all.py. Exit 0 is pass, 1 is a failure, 2 means the AST checks were skipped. CI also fails when review-files.py reports any finding on the repo's own Python.
Test a single hook by piping a payload:
echo '{"tool_name":"Write","tool_input":{"file_path":"/r/a.py","content":"def f(a,b,c,d): pass"}}' \
| python3 hooks/block-py-violations.py # exit 2, FN-005Bootstrap scope detection
Scope comes from the install path, which carries the .claude/skills/ segment. Anchor on Path(...).absolute(), never .resolve(): resolving follows the symlink to the canonical checkout, which has no .claude ancestor. _bootstrap/paths.py takes the anchor from the main script (sys.modules["__main__"].__file__, falling back to sys.argv[0]), because Python keeps the symlinked path only for the main script. bootstrap.py therefore stays at the skill root; moving it shifts SKILL_DIR and misplaces hooks/, commands/ and the permission grants.
After touching scope detection, run hooks/tests/test-bootstrap-matrix.py. It automates the 6-test matrix:
- Project install, no settings.json → wired with
${CLAUDE_PROJECT_DIR}paths. - Re-run → noop.
- Unrelated
PreToolUsehook and other settings keys → preserved. - Global install → wired with absolute paths into
~/.claude/settings.json. - Run outside any
.claude/tree → refuses without writing. - Upgrade from an older entry of ours → replaced, unrelated entries kept.
The same test checks that the comment judge is off by default, follows --with-comment-judge / --without-comment-judge, and survives a re-run without either flag.
Out of scope
Test design, performance tuning, security review, visual UI review, and anything the project's own linter (tsc, ESLint, ruff, golangci-lint, PHPStan, Roslyn) already catches.
Commits and PRs
- Short present-tense subjects:
add block-jvm-violations.py,fix Hungarian false positive on aUser. Conventional commits are optional. - Every PR passes its own hooks.
- Keep
hooks/README.mdand its coverage table in sync with the hook files.
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.

