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

agents-md-writer

Skill2 starsChanged 16 days 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

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. Cogni-AI-OU/cogni-ai-agent-skills★ 4same name
    2. jqaisystems/jqai-ai-skills★ 3same name
    3. cathaysia/skills★ 2same name
    4. pauloribeiro16/my-skills★ 1same 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

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. 0 are common, 17 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 17

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep it short: redundant instructions consume context and can compete with important constraints.

    line 15
  2. Distinctive:

    Verify every command or path that survives content selection before including it.

    line 35
  3. Distinctive:

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

    line 53
  4. Distinctive:

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

    line 54
  5. Distinctive:

    Delete whole sections that do not apply.

    line 65
  6. Very specific:

    Run the bundled script by its absolute skill path, not a project-local ./scripts/ path:

    line 69
  7. Distinctive:

    Run the rest by hand — see Checklist.

    line 77
  8. Distinctive:

    Read the file, walk the Checklist top to bottom.

    line 88
  9. Distinctive:

    Verify three things for real:

    line 89
  10. Distinctive:

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

    line 97
  11. Very specific:

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

    line 101
  12. Distinctive:

    If yes, omit it. A directory map can also imply that unlisted paths do not matter.

    line 136
  13. Distinctive:

    Keep a rule when it supplies missing knowledge that changes an action, for example:

    line 139
  14. Distinctive:

    Use supplied context, existing decision records, or verified history as evidence.

    line 158
  15. Distinctive:

    Keep short, currently relevant records here.

    line 160
  16. Distinctive:

    If the root file passes ~200 lines, first check for duplicated code/config information, then move detailed decisions or module-local …

    line 192
  17. Distinctive:

    Ask whether the rule still holds in a different repo.

    line 207
  18. Distinctive:

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

    line 219
  19. Very specific:

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

    line 234
  20. Distinctive:

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

    line 235

“Common” is measured: kept by at least 6 in 10 of the 4 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 project-level context. Loading and discovery depend on the agent; see the registry. Keep it short: redundant instructions consume context and can compete with important constraints. There is no universal instruction-count or line-count limit that guarantees compliance.

Scope: write only project knowledge that code and configuration do not express: hidden constraints, operational traps, and important decisions with their reasons. Do not reproduce a directory map, script list, dependency versions, or conventions already evident in the repo. 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.

Verify every command or path that survives content selection before including it.

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.
  • Discovery is input to your reasoning, not a list to copy into AGENTS.md. Apply Content selection before writing. If nothing qualifies, report that; do not manufacture a file to fill a template.

2. Follow the skeleton

Candidate sections and layering: references/skeleton.md. No section is mandatory; do not add a section merely because it appears in the template.

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

Run the bundled script by its absolute skill path, not a project-local ./scripts/ path:

<skill-dir>/scripts/lint-agents-md.sh AGENTS.md
pwsh -File <skill-dir>/scripts/lint-agents-md.ps1 AGENTS.md

The lint covers mechanical checks only. It does not prove rule compliance or functional correctness. Run the rest by hand — see Checklist.

4. Add entry points for other agents

See Entry points. If no AGENTS.md was needed, do not create entry files pointing to a nonexistent file.

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 projectConstraints and traps not expressed by code or config; important decisions
    Promote to globalPersonal preferences: language, output style, local machine setup
    Push down to subdirectoryHidden constraints that only concern one module
    Move to a skill / decision documentMulti-step procedures or detailed Event / Decision / Reason records
    DeleteDuplicated repo information, stale content, freshness stamps, one-off requests
  3. Show the classification and concrete changes. If the user already authorized this scope, proceed; ask only about unresolved choices that change product behavior or discard still-relevant knowledge.
  4. Re-run the checklist. Preserve important decisions in the structured format below; do not discard their reasons while trimming the original discussion.

Content selection

For each candidate rule, ask: can the agent already learn this from code or configuration? If yes, omit it. A directory map can also imply that unlisted paths do not matter; inspect the repository for the current task instead of making a fixed map in AGENTS.md.

Keep a rule when it supplies missing knowledge that changes an action, for example:

  • Integration tests silently skip without a local database; a green run can be incomplete.
  • A command documented as local maintenance actually targets a shared environment by default.
  • A tempting solution was rejected for a compatibility reason the code cannot reveal.

A command or path may appear as part of explaining such a trap, after verification. Do not add an ordinary command catalogue or directory listing around it. Do not copy generic coding advice.

Important decisions

Record important project decisions as Event / Decision / Reason (事件 / 决策 / 原因 in Chinese):

- **Event**: A request can time out after the payment provider accepts it.
- **Decision**: Do not automatically retry payment creation until idempotency is guaranteed.
- **Reason**: A retry can charge twice; the provider does not deduplicate requests.

Use supplied context, existing decision records, or verified history as evidence. Never invent an incident, a rejected option, or its rationale. Ask about a missing reason when it is material. Keep short, currently relevant records here; put detailed records in an existing decision-document location and link them with a reading trigger. Do not preserve every rejected idea. Update or retire obsolete decisions rather than accumulating contradictions. See references/rules-and-decisions.md when reviewing decisions or critical constraints.

Execution mechanisms

For critical constraints, inspect whether tests, lint, CI, or tool permissions actually enforce them. Report the existing mechanism or the gap; AGENTS.md text and a passing document lint are not enforcement. A configured CI check is not proof that merging or releasing is blocked on it. Reuse verified mechanisms. Do not install hooks, create new checks, or change permissions unless that work is authorized. Keep this assessment in the review report; include it in AGENTS.md only when it explains a project-specific trap that the configuration does not reveal.

Writing principles

PrincipleWhy
Make every instruction verifiable"Confirm the integration cases ran" identifies evidence; "Test thoroughly" does not.
Never let two rules contradictConflicting instructions make behavior less predictable; resolve or report the conflict.
Keep it as short as it can beKeep only knowledge missing from code and config. Push module-local constraints down.
No YAML frontmatterAGENTS.md has no frontmatter spec. Loaders inject it as plain markdown, so it lands in context verbatim as noise.
No freshness dates or version stampsDo not duplicate git log or dependency config. A real deadline or incident date may be meaningful; review date warnings in context.
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?

If the root file passes ~200 lines, first check for duplicated code/config information, then move detailed decisions or module-local constraints to their appropriate location. This is a review signal, not a target length; a useful file may contain only a few lines.

Verifiable instructions

CandidateTreatment
Ordinary formatting or coverage adviceOmit it when formatter configuration or tests already express it.
Integration tests can report green without a databaseExplain that they skip; verify database availability before relying on the run.
A vendor-maintained directory must not be editedName the verified path and the ownership reason if the repo does not reveal it.
Payment creation must not retryRecord Event / Decision / Reason and verify any existing regression check.

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): ..."Omit if evident in history or commit configDo not repeat discoverable conventions.
"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 as heuristics. 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 redundant freshness stampsReview date warnings in context; retain meaningful event dates or deadlines.✅
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"
10Verification instructions are checkableDescribe the specific evidence needed to resolve a hidden trap. Put prohibitions in hidden constraints. Human-only checks must be labelled; AI must not claim they are 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.
13Only knowledge absent from code / configNo directory maps, command catalogues, dependency lists, or repeated coding conventions.
14Important decisions retain their contextEvent / Decision / Reason, supported by evidence; detailed records have a triggered pointer.
15Critical rules have an enforcement assessmentReport verified tests, lint, CI, permissions, or gaps; do not claim document lint enforces behavior.

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.