agentleFS
RUIIIOVORUIIIOVO/agents-md-writer/SKILL.md

agents-md-writer

Skill2 starsChanged 3 months agoMITView on GitHub

Write, review, or refactor AGENTS.md / CLAUDE.md project instruction files. Use when the user asks to "initialize AGENTS.md", "write project rules", "review my AGENTS.md", "clean up CLAUDE.md", "set up project conventions for the agent", or says 写项目规范 / 初始化 AGENTS.md / 检查 AGENTS.md 是否合规 / 整理项目规范. Ships a section skeleton, writing principles, and a lint script.

  • Reads credentials

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. Cogni-AI-OU/cogni-ai-agent-skills★ 4same name
    2. jqaisystems/jqai-ai-skills★ 3same name
    3. cathaysia/skills★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every line is resident context — line count is a cost you pay on every single session.

    line 19
  2. Distinctive:

    Verify every path as you write it, then re-verify the whole file at the end.

    line 57
  3. Distinctive:

    If you cannot verify a command, do not write it.

    line 58
  4. Distinctive:

    Delete whole sections that do not apply.

    line 66
  5. Distinctive:

    Read the file, walk the Checklist top to bottom.

    line 85
  6. Distinctive:

    Verify three things for real:

    line 86
  7. Distinctive:

    Do not rewrite the file. The user asked for a diagnosis.

    line 94
  8. Very specific:

    When the user asks about the whole machine or a whole workspace, locate the files through the filesystem index.

    line 98
  9. Distinctive:

    Ask whether the rule still holds in a different repo.

    line 162
  10. Distinctive:

    Keep one source of truth plus thin entry files — never maintain parallel copies.

    line 174
  11. Very specific:

    Check .gitignore does not already exclude CLAUDE.md or GEMINI.md.

    line 189
  12. Distinctive:

    If the user only runs one agent, create only that one entry file.

    line 190

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “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
SKILL.md

AGENTS.md Writer

Reply in the user's language. These instructions are in English for token efficiency; that does not dictate the conversation language. If the user writes in Chinese, answer in Chinese — including the review findings and the confirmation prompts.

AGENTS.md is a project-level instruction file. Codex, pi, omp, Hermes, Grok CLI, Kimi Code, OpenClaw, DeepSeek Harness and others inject it in full, at the start of every session.

Two consequences drive everything below:

  1. Every line is resident context — line count is a cost you pay on every single session.
  2. The more instructions you add, the lower the compliance rate for all of them, not just the new ones.

So the goal is not coverage. It is economy: every line must earn its place.

Scope: AGENTS.md holds project facts (how to run, test, commit). Personal preferences belong in the global agent config, not here.

Pick a path

User intentPath
No AGENTS.md yet, create oneA — Write
File exists, check it for problemsB — Review (do not edit)
File exists, rewrite / merge / trimC — Refactor

Path A — Write

1. Probe. Never guess.

Wrong commands and dead paths are the number one defect in these files. Verify before writing.

ls -A                                   # repo root
jq '.scripts' package.json 2>/dev/null  # npm scripts (no jq? read the file — do not truncate with grep -A)
cat pyproject.toml 2>/dev/null          # Python deps and test config
cat Cargo.toml 2>/dev/null              # Rust
find . -maxdepth 1 \( -name Makefile -o -name '*.mk' -o -name 'dev-*.sh' \)
git log --format=%s -20                 # existing commit style

PowerShell equivalents: Get-ChildItem -Force, (Get-Content package.json | ConvertFrom-Json).scripts.

Do not use shell globs to probe. Under zsh, ls *.mk with no match aborts the whole command before ls ever runs, and 2>/dev/null cannot suppress it — the error comes from the shell, not from ls. Use find.

  • The project README can be wrong. The filesystem is the source of truth.
  • Verify every path as you write it, then re-verify the whole file at the end.
  • If you cannot verify a command, do not write it. Mark it as a known gap. Never invent one.

2. Follow the skeleton

Sections, ordering, required vs optional: references/skeleton.md.

Blank templates: templates/AGENTS.md.template (English), templates/AGENTS.zh.md.template (Chinese). Delete whole sections that do not apply. Do not leave placeholders behind.

3. Run the checks

./scripts/lint-agents-md.sh AGENTS.md          # macOS / Linux
pwsh -File scripts/lint-agents-md.ps1 AGENTS.md  # Windows

The lint covers the mechanical checks. Run the rest by hand — see Checklist.

4. Add entry points for other agents

See Entry points.

Path B — Review

Read only. Do not edit.

  1. Read the file, walk the Checklist top to bottom.
  2. Verify three things for real:
    • Commands — run the read-only ones. For anything with side effects, check it is at least declared (e.g. present in jq '.scripts' package.json).
    • Paths — test -e each one.
    • Conflicts — against the global config and any other AGENTS.md in the repo.
  3. Report: one-line verdict (fine / needs fixes / rewrite), then a list of location → problem → suggested fix.

Do not rewrite the file. The user asked for a diagnosis.

Reviewing many files at once

When the user asks about the whole machine or a whole workspace, locate the files through the filesystem index. Never run an unbounded recursive scan over $HOME.

mdfind -0 -name 'AGENTS.md' | xargs -0 ./scripts/lint-agents-md.sh          # macOS, Spotlight index
mdfind -0 -onlyin ~/work 'kMDItemFSName == "AGENTS.md"' | xargs -0 ...      # scoped
plocate AGENTS.md                                                          # Linux, if indexed
find <dir> -maxdepth 4 -name AGENTS.md                                     # fallback, always scoped

Report as a table — path, line count, error/warning counts — then ask which ones to fix. Fix them one at a time, and for each one list the full path and the exact changes before writing anything.

Path C — Refactor

  1. cp AGENTS.md AGENTS.md.bak and tell the user where the backup is.
  2. Classify every existing block and show the table before touching anything:

    DestinationWhat goes there
    Keep in projectProject facts: layout, commands, boundaries, conventions
    Promote to globalPersonal preferences: language, output style, local machine setup
    Push down to subdirectoryRules that only concern one module
    Move to a skillMulti-step procedures, low-frequency specialist knowledge
    DeleteStale content, meta-rules, hand-written dates, one-off requests
  3. Get confirmation, then edit.
  4. Re-run the checklist.

Writing principles

PrincipleWhy
Make every instruction verifiable"Run npm test" is executable. "Test your changes" is not.
Never let two rules contradictOn conflict the model picks one at random. Behaviour becomes unpredictable.
Keep it as short as it can beSee the two consequences at the top. When it grows, push down before you trim wording.
No YAML frontmatterAGENTS.md has no frontmatter spec. Loaders inject it as plain markdown, so it lands in context verbatim as noise.
No hand-written dates or version stampsgit log is the authority. A hand-typed date rots into a second source of truth.
No meta-rules ("this file only describes how to...")Written for the human maintainer. Does not change agent behaviour. Pure budget.
Multi-step procedures, module-local contentMove to a skill or a subdirectory AGENTS.md. Keep them out of the root file.
Pointers to external docs go lastThe top of the file is for the hardest constraints.

Length

No hard line limit. The test is: can you delete a line without losing information?

Rough scale: an ordinary repo needs about 100 lines. If a monorepo root file passes ~200 lines, that is a signal to push content down into subdirectory files, not to compress the prose.

For calibration, the agents.md showcase includes files of 522 and 322 lines. Those are examples of module-local content piling up in the root file — a caution, not a target.

Verifiable instructions

✗✓
Follow the project code styleRun cargo fmt && cargo clippy -- -D warnings before committing
Mind test coverageNew logic needs a case in tests/; run pytest tests/ -x
Do not touch core modulessrc/kernel/ is read-only. Propose a plan and wait for approval before changing it.
Use appropriate log levelsUse logger.debug for diagnostics. print is forbidden.

Global vs project

Ask whether the rule still holds in a different repo. Yes → global. No → project.

RuleBelongs toWhy
"Always answer in Chinese"GlobalHolds anywhere. It is a personal preference.
"Match the existing commit style in git log"GlobalThe method is universal.
"Commits here use feat(scope): ..."ProjectIt is a fact about this repo.
"Never read .env"GlobalUniversal safety floor.
"config/secrets.yml is ops-owned, do not edit"ProjectNames a specific file in this repo.

Entry points

Keep one source of truth plus thin entry files — never maintain parallel copies.

SituationAction
Codex, pi, omp, OpenCode, Grok CLI, Kimi Code, OpenClaw, DeepSeek Harness, Hermes, CopilotNothing to do. They read AGENTS.md directly.
Claude CodeCreate CLAUDE.md containing one line: @AGENTS.md
Gemini CLICreate GEMINI.md with prose pointing at AGENTS.md
Cursor, Cline, WindsurfDifferent formats — do not symlink. See the registry.

Per-agent paths, evidence levels, format caveats, and how to detect installed agents instead of hardcoding a list: references/agent-registry.md.

  • Do not use symlinks for project-level entry files. Committed symlinks degrade into plain text files containing a path on Windows and some CI runners. Symlinks are fine for user-level config (~/.claude/, ~/.codex/).
  • Check .gitignore does not already exclude CLAUDE.md or GEMINI.md.
  • If the user only runs one agent, create only that one entry file.

Checklist

Rows 1–5 are covered by scripts/lint-agents-md.sh / .ps1. Run the rest by hand.

#CheckHowAuto
1No hardcoded developer-machine paths/Users/<name>/, /home/<name>/, C:\.... Machine-bound paths (remote hosts, external tool installs) must state which machine and OS.✅
2No YAML frontmatterFirst line is not ---✅
3No hand-written datesNo YYYY-MM-DD in body text✅
4Referenced paths existEvery backticked path resolves on disk✅
5Length is justifiedReport line count; flag root files over ~200 lines for push-down✅
6Commands actually runExecute read-only ones. Declared-only for the rest. Mark unverifiable ones as known gaps.
7Cross-platform commands are completeIf the project is developed on multiple OSes, give portable commands or list them per platform and label which is which.
8Referenced tools exist"Run ESLint" requires an ESLint config in the repo. Otherwise label it a known gap.
9No contradictionsLook for "always X" next to "never X"
10Review items are verifiableThe review section lists verification actions, not "do not do X" (that belongs in Boundaries). Items needing a human — visual diffs, real-device runs — must be marked "human verifies this; AI must not claim it is done".
11Subdirectory files do not repeat the parentDiff against the root file; keep only the differences.
12Entry files existSee Entry points, or confirm they are gitignored.

Content that belongs elsewhere

  • Runtime prompts or deployment artifacts placed at the repo root as AGENTS.md. The agent will read them as constraints on working in this repo. They are not.
  • One-off requests, temporary plans, single-iteration goals. These go in docs/ or an issue.

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.