/agent-instructions
Scoped AGENTS.md, CLAUDE.md or Cursor rules built from what your repo actually runs.
Then type /agent-instructions in Claude Code, or describe the task and let it pick the skill.
What you get back recorded run · 9 Oct 2026
- I've added two files:
AGENTS.mdholds all the instructions, andCLAUDE.mdpulls them in with an import, so Codex and Claude Code read the same text. Nothing is committed yet. - The default reading speed (230 words per minute) is set in two places,
src/count.jsandbin/mdtally.js, so they have to change together. - The lint script names each file it checks, so any new source file has to be added to it by hand.
Input → output from the run
{
"name": "mdtally",
"version": "0.3.1",
"description": "Count words and estimate reading time for Markdown files",
"type": "module",
"bin": { "mdtally": "bin/mdtally.js" },
"engines": { "node": ">=20" },
"scripts": {
"test": "node --test",
"lint": "node --check bin/mdtally.js && node --check src/count.js"
},
"license": "MIT"
}Before finishing a change, run `npm test` and `npm run lint`; both must pass. ## Conventions - Keep zero dependencies. Use Node built-ins (`node:fs`, `node:test`, `node:assert/strict`) rather than adding packages. - Use double quotes, semicolons, and named exports, matching existing files. - Add a test in `test/count.test.js` for any change to counting or reading-time behavior. - The default reading speed is 230 wpm, and it is set in two places: `readingMinutes` in `src/count.js` and the CLI fallback in `bin/mdtally.js`. Change both together. - Reading time rounds up to whole minutes, with a minimum of 1. Tests assert this.
When to use it
Use when coding-agent guidance is missing, stale, duplicated or conflicting.
Skip it if you want generic agent advice or a file for every vendor; it writes only what the repo proves, for the runtime you name.
The thinking behind itAgents work best when they know how your repo actually runs. Give them the real commands and rules, and they stop guessing and breaking the build.
Output contract from the skill's Output contract section
When editing, deliver:
- the requested instruction file or files;
- a short scope summary naming which directories and runtimes they govern;
- a command table with verification labels;
- conflicts resolved, preserved, or still requiring a decision;
- any facts deliberately omitted because they were unverified or too volatile.
Keep files concise enough to scan, but let repository complexity determine length. Prefer concrete imperatives and paths over explanatory essays.
How it checks its own work from the instructions
- Every path, script, port, and env variable exists in the repo
- Nested files never contradict inherited rules
- Unverified syntax is labeled unverified, not presented as established
- Documented-only commands are never described as tested
Requirements what it needs
- Works in
- Codex, Claude Code, Cursor
- Needs
- project files, terminal commands
The instructions SKILL.md · 127 lines
Instructions & references
Back to overview ↑On this page 12 sections
Agent instructions
Write the smallest set of instruction files that each target runtime actually loads. A correct file in a location the runtime skips, or one shadowed by another file, does nothing. Recover facts from the repository before asking, and separate commands you ran from commands you only read about.
Choose the task
- Create: no instruction files exist.
- Improve: one existing file is thin, stale or bloated.
- Reconcile: files duplicate or contradict each other, or one runtime ignores guidance the others see.
- Scope a subtree: a package or directory needs different commands, ownership or boundaries.
- Explain loading: the user asks why an agent ignores its instructions. Report what each runtime loads here. Change nothing unless asked.
Infer the target runtimes from the request, existing files and the user's tooling. Ask only when the answer changes which files exist. "Make this work for our agents" with no other signal means Claude Code, Codex and Cursor.
Read the loading matrix first
Read the loading matrix before choosing any file. It records which files Claude Code, Codex and Cursor read, in what order, with which limits, checked on a stated date. Follow its run-time rule: re-check a runtime's docs when the check date is more than about 90 days old or the installed runtime is older than a version it names.
Inventory every instruction source
pwd
git rev-parse --show-toplevel
rg --files --hidden -g '!node_modules' -g '!.git' \
-g '**/AGENTS.md' -g '**/AGENTS.override.md' -g '**/CLAUDE.md' -g '**/CLAUDE.local.md' \
-g '**/.claude/rules/**' -g '**/.cursor/rules/**' -g '**/.cursorrules'
Then check three places rg misses:
- Ancestors above the repository root. Claude Code loads every
CLAUDE.md,.claude/CLAUDE.mdandCLAUDE.local.mdfrom cwd upward. One in a parent folder shadows the repository'sAGENTS.mdfor Claude Code. Ignore~/.claude/CLAUDE.md; it does not shadow. - Codex fallback names. Read
project_doc_fallback_filenamesandproject_doc_max_bytesin~/.codex/config.toml(or$CODEX_HOME) when present. A fallback-named file is an instruction file for Codex. - Fixture and example directories. An
AGENTS.mdorCLAUDE.mdinside test fixtures, examples or proof folders loads as a real instruction for Claude Code and Cursor when work touches that folder.
For each file record: directory, runtimes that load it, when it loads (launch or on demand), what it shadows or is shadowed by, size, and statements that conflict with a nearer file or with repository evidence.
Treat user-global files (~/.claude/CLAUDE.md, ~/.codex/AGENTS.md) as context that explains behavior. Do not edit them unless asked.
Choose the layout
Default for a repository shared across runtimes:
- One root
AGENTS.mdas the shared source. Codex and Cursor read it. Claude Code reads it when noCLAUDE.mdexists in cwd or above. - Add
CLAUDE.mdonly when Claude-specific rules exist (plan-mode areas, hooks, Claude tool notes) or aCLAUDE.mdalready exists. Its first line is@AGENTS.md; Claude-only notes go below. - Never create a
CLAUDE.md,.claude/CLAUDE.mdorCLAUDE.local.mdwithout that import in a repository that relies onAGENTS.md. It silently dropsAGENTS.mdfor Claude Code. This includes advising a user to add a personalCLAUDE.local.md. - Existing
CLAUDE.mdwith shared content plusAGENTS.md: move shared facts intoAGENTS.md, reduceCLAUDE.mdto@AGENTS.mdplus Claude-only notes. Ask before deleting aCLAUDE.mdthat holds anything beyond the import. - Cursor:
AGENTS.mdalready covers it. Add.cursor/rules/*.mdconly for activationAGENTS.mdcannot express: glob-scoped rules or description-selected rules. Do not copyAGENTS.mdcontent into rules. Cursor does not inline@filereferences in rules, so put must-have content in the rule body. - Path-scoped Claude rules: use
.claude/rules/*.mdwithpaths:for guidance that matters only for some files, instead of growingCLAUDE.mdpast about 200 lines. - Do not create
AGENTS.override.mdfor shared rules. Only Codex reads it. Flag an existing one as a divergence. - Keep shared content inline in
AGENTS.md.@pathimports expand only in Claude Code. Codex documents no import syntax, so imported content is invisible to it.
Do not create parallel vendor files the runtimes do not need. One AGENTS.md often covers all three.
Nested files
Add a nested AGENTS.md only when a subtree needs different commands, ownership or boundaries. Put only the difference in it. Nearer files come later in context in all three runtimes. Codex and Cursor treat that as precedence; Claude Code does not guarantee it, so a nested file must add to its parents, not contradict them. Reach also differs:
- Claude Code and Cursor pick up a nested file when work touches that directory.
- Codex loads only directories from the project root down to where it was started. Started at the root, it never sees
services/payments/AGENTS.md.
So when a subtree rule must hold for Codex, add a one-line pointer in the root file ("Before editing services/payments/, read services/payments/AGENTS.md"), or document starting Codex in that directory.
Size
Codex stops adding files once the combined size reaches 32 KiB by default, so a long root file pushes nested files out. Claude Code recommends under 200 lines per CLAUDE.md, and imports do not reduce context cost. Cut content an agent can derive from the code: directory trees, dependency lists, generic style advice.
Build an evidence map
Read the minimum evidence needed to establish:
- package or workspace boundaries and runtime versions;
- install, dev, build, lint, typecheck, test and release commands;
- generated files, migrations, credentials, deployment configuration and other high-risk areas;
- conventions an agent would get wrong from defaults (package manager, test runner, formatting, file placement);
- required services, environment variables, ports and setup order.
Prefer manifests, scripts, CI workflows and executable configuration over prose. When sources disagree, report the conflict and use the source that controls execution (CI usually wins over README).
Include a path only when it changes how an agent navigates, edits or verifies. Write instructions an agent can check: "Run npm test before finishing" beats "test your changes".
Verify commands proportionately
Label each command:
- executed: ran successfully here;
- partially verified: syntax or a narrow target ran, but dependencies or services blocked the full run;
- documented only: found in a trusted project source, not run;
- stale or conflicting: contradicted by configuration, or failed for a repository reason.
Run safe, relevant checks. Do not start long-lived services, mutate external systems, install dependencies or run destructive commands to upgrade a label. State prerequisites next to commands that need them.
Resolve conflicts explicitly
For each conflict choose one action:
- retain the nearer scoped rule;
- replace stale guidance with verified repository behavior;
- separate runtime-specific mechanics from shared facts;
- ask the user when two live policies express different intent the repository cannot settle.
Do not silently choose between policy statements about deployment, generated files, security, data handling or ownership.
Output contract
- The instruction files written or changed (or, in Explain loading mode, none).
- A loading table: for each target runtime, which files load at the root and in each scoped directory, and which are shadowed or skipped.
- A command table with verification labels.
- Conflicts resolved, preserved, or awaiting a decision.
- Facts left out because they were unverified or volatile, and any loader fact re-checked against docs this run, with the date.
Verify
- Re-read every instruction file that applies to each edited location. Confirm each target runtime loads the intended files and nothing shadows them, using the loading matrix.
- Where a runtime is installed, confirm with its own check:
/context allor/memoryin Claude Code;codex --ask-for-approval never "Summarize the current instructions."(add--cd <dir>for a subtree) in Codex; Customize, Rules in Cursor. Otherwise label loading as reasoned from docs, not observed. - Measure combined bytes on each Codex path (
wc -c) against the 32 KiB default and eachCLAUDE.mdagainst about 200 lines. - Confirm every path, script, package name, port and environment variable exists in repository evidence.
- Re-run the safe commands used as acceptance checks, or label them accurately.
- Confirm nested files hold only scope-specific differences and do not contradict inherited rules.
- Check
.mdcfrontmatter and glob coverage against the files each rule should govern. - Remove unsupported claims, generic agent advice and duplicated repository documentation. Do not describe a documented-only command as tested.
Instruction loading matrix
Which files Claude Code, Codex and Cursor load, in what order, and with which limits. Checked 2026-11-04 against Claude Code 2.1.318, Codex CLI 0.166.0 (npm @openai/codex) and Cursor's rules docs.
Run-time rule: these loaders change often. Before choosing files from this table, re-check the source for any runtime you are targeting if this check date is more than about 90 days old, or if the installed version is older than a version named here. When the docs and this file disagree, follow the docs and say so in the report. For any runtime not listed, read its docs; do not assume it treats AGENTS.md like these three.
Contents
Summary
| Claude Code | Codex | Cursor | |
|---|---|---|---|
Reads root AGENTS.md |
Yes, since v2.1.277, only if no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md exists in cwd or above |
Yes | Yes |
| Own file | CLAUDE.md, .claude/CLAUDE.md, CLAUDE.local.md, .claude/rules/**/*.md |
AGENTS.override.md, then AGENTS.md, then configured fallback names |
.cursor/rules/**/*.mdc |
| Ancestors above cwd | All loaded at launch, root first | From project root (usually git root) down to cwd only | Not documented |
| Subdirectories below cwd | Loaded on demand when Claude reads a file there | Never. Only directories between root and cwd | Nested AGENTS.md applies when working with files in that directory |
| Files per directory | CLAUDE.md then CLAUDE.local.md |
One: the first of override, AGENTS.md, fallbacks |
All matching rules |
| Order and conflicts | Concatenated root to cwd; nearer files read last. Conflicts are not resolved; Claude may follow either | Concatenated root to cwd; nearer files override because they come later | Nested AGENTS.md combined with parents, more specific wins. Rule order: Team, then Project, then User; earlier wins |
| Import syntax | @path in CLAUDE.md and in an AGENTS.md Claude reads, relative to the file, max 4 hops |
None documented | @file in a rule is a pointer the agent may read. Not inlined |
| Size | Target under 200 lines per CLAUDE.md. Files over 4 MiB skipped. On-demand files (subdirectory CLAUDE.md, path-scoped rules) truncated past 40,000 characters on a 200K context window |
Combined cap project_doc_max_bytes, 32 KiB by default. Files past the cap are not added |
Keep each rule under 500 lines (guidance) |
| Check what loaded | /context all (Memory files) or /memory |
codex --ask-for-approval never "Summarize the current instructions.", or --cd <dir> for a subtree |
Customize, Rules shows each rule's status |
Claude Code
- Load order: managed policy
CLAUDE.md, then~/.claude/CLAUDE.md, then project files from the filesystem root down to cwd. In each directoryCLAUDE.local.mdfollowsCLAUDE.md. All are concatenated; none overrides another. .claude/rules/*.md(recursive) withoutpaths:load at launch with.claude/CLAUDE.mdpriority. Withpaths:frontmatter (globs relative to the folder that holds.claude), they load when Claude reads, writes or edits a matching file.pathsis the only frontmatter field read.AGENTS.mdshadowing: by default (Project instructions =claude-md-or-agents-md) Claude readsAGENTS.mdonly when none ofCLAUDE.md,.claude/CLAUDE.mdorCLAUDE.local.mdexists in cwd or above.~/.claude/CLAUDE.md, a managedCLAUDE.mdand.claude/rules/do not count and load alongsideAGENTS.md.- With both files present, the documented shared setup is a
CLAUDE.mdwhose first line is@AGENTS.md, Claude-only notes below. Claude skips anAGENTS.mdit already loaded, so the import never doubles it. A symlinkCLAUDE.md -> AGENTS.mdalso works, but breaks on Windows clones withoutcore.symlinks, and Claude's edit tools refuse to write through it. - When reading
AGENTS.mddirectly, Claude also loads.claude/AGENTS.md, and a subdirectoryAGENTS.mdwhen it opens a file there and that subdirectory has noCLAUDE.mdof its own. It never readsAGENTS.local.md,AGENTS.override.mdor.agents/. - Some sessions cannot read
AGENTS.mddirectly: versions before 2.1.277, the built-in plugin disabled, the first session after upgrading from 2.1.276 or earlier, and before 2.1.281 some Bedrock or telemetry-off sessions. The@AGENTS.mdimport covers all of these. - Other users can change the default with Project instructions in
/config(claude-md-and-agents-md,claude-md,managed-only). That is personal configuration. Do not depend on it in a repository file. claudeMdExcludes(any settings layer) skips instruction files by glob. Use it in.claude/settings.local.jsonfor files a user should not load, such as fixture instruction files.- Block-level HTML comments in
CLAUDE.mdare stripped before injection. Use them for maintainer notes. - A git worktree nested inside the main checkout (for example under
.claude/worktrees/) has the main checkout's files as ancestors. The memory docs point to separate handling for.claude/worktrees/that this check did not cover. Read that section before assuming the parent checkout's files load or shadow.
Codex
- Global: in
~/.codex(orCODEX_HOME),AGENTS.override.mdif present, otherwiseAGENTS.md. First non-empty file only. - Project: from the project root (typically the git root; in a git worktree, the worktree) down to cwd. In each directory:
AGENTS.override.md, elseAGENTS.md, else each name inproject_doc_fallback_filenames. At most one file per directory. Empty files skipped. - Merge: concatenated root down with blank lines. Later (nearer) files override earlier guidance.
- Cap: stops adding files once the combined size reaches
project_doc_max_bytes(32 KiB default). Root guidance that is too long can push nested guidance out entirely. - Started at the repository root, Codex does not see
services/payments/AGENTS.mdwhile editing files underservices/payments/. Nested files reach Codex only when it starts in or below that directory. - The chain is built once per run or TUI session. Restart after editing instruction files.
- Code review in GitHub reads a
## Code Review Rulessection from theAGENTS.mdnearest the code.
Cursor
- Project rules live in
.cursor/rules/(subfolders allowed) and must use.mdc. A plain.mdfile there is ignored. - Frontmatter
alwaysApply,description,globsdecide activation:alwaysApply: true: always included;globsanddescriptionignored.globsset,alwaysApply: false: attached when a matching file is in context. Comma-separate multiple globs.- only
description: the agent decides from the description. - none: only when @-mentioned.
AGENTS.mdis supported at the root and in subdirectories. Nested files combine with parents, more specific wins. Plain markdown, no frontmatter.@fileinside a rule tells the agent where to look; the file is not inlined. Put must-have content in the rule body.- Rules do not affect Cursor Tab.
- Legacy
.cursorrulesis not described on the rules page checked 2026-11-04. Treat an existing one as legacy: migrate its live content rather than extending it.
Cross-runtime traps
- Shadowing. Adding any
CLAUDE.md,.claude/CLAUDE.mdorCLAUDE.local.mdto a repository that relies onAGENTS.mdsilently dropsAGENTS.mdfor Claude Code unless that file imports@AGENTS.md. This includes a personalCLAUDE.local.md. - Import asymmetry.
@pathexpands for Claude Code only. Content behind an import inAGENTS.mdis invisible to Codex and only a pointer to Cursor. Keep shared content inline inAGENTS.md. - Override asymmetry.
AGENTS.override.mdchanges Codex only. Shared rules placed there never reach Claude Code or Cursor. - Nested reach. Claude Code and Cursor pick up nested files when work touches that directory. Codex does not unless started there. A rule that must hold for Codex in a subtree needs a pointer in the root file or an instruction to start Codex in that directory.
- Fixtures load as instructions. Example or fixture directories that contain
AGENTS.mdorCLAUDE.mdare loaded by Claude Code on demand and applied by Cursor when files there are touched. Rename them (for exampleAGENTS.example.md) or exclude them. - Byte budget. A root
AGENTS.mdnear 32 KiB leaves no room for Codex to load nested files.
Sources checked 2026-11-04
- Claude Code memory and
AGENTS.md: https://code.claude.com/docs/en/memory - Claude Code release dates: npm registry
npm view @anthropic-ai/claude-code time(2.1.277 on 2026-09-18, 2.1.281 on 2026-09-23, latest 2.1.318) - Codex
AGENTS.md: https://developers.openai.com/codex/guides/agents-md (redirects to https://learn.chatgpt.com/docs/agent-configuration/agents-md) - Codex CLI version: npm registry
npm view @openai/codex version(0.166.0) - Cursor rules and
AGENTS.md: https://cursor.com/docs/context/rules (redirects to https://cursor.com/docs/rules)
Put this skill to work
Learn a workflow. Take the skill with you.
Claude app, ChatGPT and ZIP download
local coding agent required
This skill requires project files and terminal commands. Uploading it to a chat app does not provide equivalent execution.
ChatGPT Skills
This workflow needs a local coding environment or capabilities that a chat-only Skills upload does not provide.
Package details
- Package
- agent-instructions/SKILL.md
- Author
- @tushaarmehtaa
- Added
- 16 Jun 2026
- Tags