/agent-instructions

Scoped AGENTS.md, CLAUDE.md or Cursor rules built from what your repo actually runs.

Build·Project → Context·MIT
$npx skills add tushaarmehtaa/tushar-skills --skill agent-instructions -g -a claude-code -y

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

claude · tallyroom

Using /agent-instructions
One AGENTS.md for both tools, with CLAUDE.md importing it.
Claude Code 2.1.295·56s·2 files changed
  • I've added two files: AGENTS.md holds all the instructions, and CLAUDE.md pulls 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.js and bin/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

package.json
{
  "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"
}
AGENTS.md it wrote
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

Use when coding-agent guidance is missing, stale, duplicated or conflicting.

Skip it when

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 it

Agents 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:

  1. the requested instruction file or files;
  2. a short scope summary naming which directories and runtimes they govern;
  3. a command table with verification labels;
  4. conflicts resolved, preserved, or still requiring a decision;
  5. 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 ↑
SKILL.md · MIT

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.md and CLAUDE.local.md from cwd upward. One in a parent folder shadows the repository's AGENTS.md for Claude Code. Ignore ~/.claude/CLAUDE.md; it does not shadow.
  • Codex fallback names. Read project_doc_fallback_filenames and project_doc_max_bytes in ~/.codex/config.toml (or $CODEX_HOME) when present. A fallback-named file is an instruction file for Codex.
  • Fixture and example directories. An AGENTS.md or CLAUDE.md inside 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:

  1. One root AGENTS.md as the shared source. Codex and Cursor read it. Claude Code reads it when no CLAUDE.md exists in cwd or above.
  2. Add CLAUDE.md only when Claude-specific rules exist (plan-mode areas, hooks, Claude tool notes) or a CLAUDE.md already exists. Its first line is @AGENTS.md; Claude-only notes go below.
  3. Never create a CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md without that import in a repository that relies on AGENTS.md. It silently drops AGENTS.md for Claude Code. This includes advising a user to add a personal CLAUDE.local.md.
  4. Existing CLAUDE.md with shared content plus AGENTS.md: move shared facts into AGENTS.md, reduce CLAUDE.md to @AGENTS.md plus Claude-only notes. Ask before deleting a CLAUDE.md that holds anything beyond the import.
  5. Cursor: AGENTS.md already covers it. Add .cursor/rules/*.mdc only for activation AGENTS.md cannot express: glob-scoped rules or description-selected rules. Do not copy AGENTS.md content into rules. Cursor does not inline @file references in rules, so put must-have content in the rule body.
  6. Path-scoped Claude rules: use .claude/rules/*.md with paths: for guidance that matters only for some files, instead of growing CLAUDE.md past about 200 lines.
  7. Do not create AGENTS.override.md for shared rules. Only Codex reads it. Flag an existing one as a divergence.
  8. Keep shared content inline in AGENTS.md. @path imports 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:

  1. retain the nearer scoped rule;
  2. replace stale guidance with verified repository behavior;
  3. separate runtime-specific mechanics from shared facts;
  4. 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

  1. The instruction files written or changed (or, in Explain loading mode, none).
  2. A loading table: for each target runtime, which files load at the root and in each scoped directory, and which are shadowed or skipped.
  3. A command table with verification labels.
  4. Conflicts resolved, preserved, or awaiting a decision.
  5. Facts left out because they were unverified or volatile, and any loader fact re-checked against docs this run, with the date.

Verify

  1. 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.
  2. Where a runtime is installed, confirm with its own check: /context all or /memory in 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.
  3. Measure combined bytes on each Codex path (wc -c) against the 32 KiB default and each CLAUDE.md against about 200 lines.
  4. Confirm every path, script, package name, port and environment variable exists in repository evidence.
  5. Re-run the safe commands used as acceptance checks, or label them accurately.
  6. Confirm nested files hold only scope-specific differences and do not contradict inherited rules.
  7. Check .mdc frontmatter and glob coverage against the files each rule should govern.
  8. Remove unsupported claims, generic agent advice and duplicated repository documentation. Do not describe a documented-only command as tested.
View on GitHub ↗
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
agents-mdclaude-mdcursorcodexproject-instructions