agentleFS
NexaiGuyNexaiGuy/nex-ai-skills/skills/md-context-writer/SKILL.md

md-context-writer

Skill1 starsChanged 15 days agoMITView on GitHub

Write, audit and fix CLAUDE.md, AGENTS.md and .claude/rules from facts in your repository, with a linter that checks them against the code. Use when: Create a CLAUDE.md or AGENTS.md built on the real build, test and lint commands; Audit an existing instruction file for stale commands, moved paths and secrets; Split a long CLAUDE.md into path-scoped .claude/rules that load only when needed.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create a CLAUDE.md or AGENTS.md built on the real build, test and lint commands

    line 42
  2. Very specific:

    Add python lint_claude_md.py to CI so the file fails the build when it drifts from the code again.

    line 97

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill 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
SKILL.md

CLAUDE.md Writer

Free skill by Nex AI. This file is the public guide from Agensi. Scripts, extension source, and templates from the original package are not in this folder.

What it does

The instruction file is read at the start of every agent session. Most are generated once and never checked, or grow into generic advice the agent stops following. This skill writes one from verified facts and keeps it honest.

Two scripts, standard library only

repo_facts.py reports what the repo actually contains: every defined command (package.json per workspace, Makefile, justfile, Taskfile, pyproject, tox, nox, composer), what CI really runs, toolchain and versions, lint/test/type tools, layout, existing agent files for Claude, Codex, Cursor, Copilot, Gemini and Windsurf, commit style, and env var names (never values).

lint_claude_md.py checks the instruction file against the repo:

  • commands that do not exist (pnpm run e2e, make deploy), with dependency binaries like pnpm vitest understood
  • paths that moved, broken or too-deep @imports
  • secrets, vague rules nobody can verify, contradictions, too much shouting
  • oversized files, rules frontmatter that silently fails, an AGENTS.md Claude Code ignores, a CLAUDE.local.md about to be committed
  • non-zero exit on errors, so it runs in CI and pre-commit

The workflow

Collect facts, verify the commands, ask only what files cannot answer (at most five questions), write under 200 lines, put area-specific rules in path-scoped .claude/rules/, lint until clean. Includes a writing guide with before/after examples, a template, and a complete example file.

Tested on real repositories (a Python library and a large pnpm monorepo) and with 19 automated tests.

Built by Nex AI, nex-ai.be

When to use

  • Create a CLAUDE.md or AGENTS.md built on the real build, test and lint commands
  • Audit an existing instruction file for stale commands, moved paths and secrets
  • Split a long CLAUDE.md into path-scoped .claude/rules that load only when needed
  • Set up one shared AGENTS.md for Claude Code, Codex, Cursor and Copilot
  • Fail CI when the instruction file no longer matches the repository

Known limitations

The linter verifies npm, pnpm, yarn and bun scripts, make and just targets; other command runners are not checked. Path checks cover paths written in backticks. It checks facts, it cannot judge whether a rule is wise.

Example

Request

Our CLAUDE.md is a year old and Claude keeps running commands that don't exist. Fix it.

Result

CLAUDE.md audited and rewritten

I ran the linter against the repo first:

$ python lint_claude_md.py
WARN  CLAUDE.md:1   [shouting] 6 uses of IMPORTANT/MUST/NEVER/ALWAYS in caps
ERROR CLAUDE.md:6   [commands] `pnpm run e2e`: no package.json script named 'e2e'
ERROR CLAUDE.md:7   [commands] `make deploy`: there is no Makefile
WARN  CLAUDE.md:10  [paths] `src/checkout/` does not exist in the repo
WARN  CLAUDE.md:13  [vague] "write clean code" cannot be verified
WARN  CLAUDE.md:14  [conflicts] says both use and do not use 'moment'
ERROR CLAUDE.md:16  [secrets] looks like a connection string with password

3 error, 4 warning, 0 info

What I changed

ProblemFix
pnpm run e2e and make deploy do not existReplaced with the commands CI runs: pnpm test, pnpm lint, pnpm typecheck
src/checkout/ was removed in a refactorRemoved; the file now names src/orders/ and src/payments/
"Never use moment" and "use moment for timezones"Kept one rule: dates are ISO 8601 in UTC at the API
A staging database URL with passwordRemoved; it now names DATABASE_URL. Rotate that password, it has been in git
Six rules in capitalsPlain, specific instructions

Added what was missing: how to run one test (pnpm vitest run src/orders/service.test.ts) and a "before saying a task is done" line.

$ python lint_claude_md.py
Checked CLAUDE.md (16 lines)
0 error, 0 warning, 0 info

Next step

Add python lint_claude_md.py to CI so the file fails the build when it drifts from the code again.

Questions

How is this different from /init?

/init drafts a file once. This skill grounds every command in the repo or CI, asks only what files cannot answer, places area-specific rules where they load on demand, and the linter keeps the file true as the code changes.

Does it work for AGENTS.md?

Yes. The linter checks AGENTS.md and rules files, and warns when Claude Code would silently ignore an AGENTS.md next to a CLAUDE.md.

Will it rewrite my file without asking?

No. It shows a diff with a reason for every removed section and never drops your content silently.


Built by Nex AI. More skills, including the paid catalog: https://www.agensi.io/creators/ch1n4-g3nd4x

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.