/lstack:agent-configfrom lstack
Creates, updates, or audits AGENTS.md or CLAUDE.md agent instruction files. Merges .cursorrules into a single file readable by Claude Code, Codex, and Cursor.
Ships in lstack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Create, update, or audit the instruction files coding agents load every session. AGENTS.md is the default output: it's the open standard that Claude Code (v2.1.277+), Codex, Cursor, Copilot, and others read. Produce CLAUDE.md as the output only on an explicit request, meaning the user asks for a CLAUDE.md to be written or edited ("create a CLAUDE.md", "add X to CLAUDE.md"). Naming it as a source doesn't count ("migrate our CLAUDE.md to AGENTS.md"), and neither does a CLAUDE.md that already exists on disk. Skip READMEs and contributor docs, skills (skill-creator), and subagent files under .claude/agents/.
These files are context, not enforced configuration. They load every session, and the agent may still deviate from them.
PreToolUse hook plus permissions. Verification of the work goes in tests or CI.Which layer owns an instruction: references/knowledge-routing.md. Loading rules and sources: references/official-standards.md.
origin set, for anything that writes. audit only needs read access.git, and write access to the target path.$ARGUMENTS
audit, "review", or "check". Read-only.create, update, a specific change, or a path such as packages/api/AGENTS.md).Every mode runs Step 1 first. After Step 1, a write run is a targeted edit when the user named a specific change to an existing file. Otherwise it's a full pass. Write runs continue with Steps 2–4; audit jumps to Audit.
Before a write run changes anything, sync with the remote. audit skips this. git fetch is the read-only dry run.
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin # dry-run: read-only preview
git status # validate clean tree
git pull --rebase origin "$branch" # only once the tree is clean
If the tree is dirty, back it up with git stash push -u -m "pre-sync-backup", sync, then run git stash pop. Stop and ask the user to confirm whether to skip the sync if any of these happen: the directory isn't a git repo, origin is missing, the HEAD is detached, the branch has no upstream, the pull or rebase fails, or the pop fails. If the user does not authorise skipping the sync, write nothing and end with the final report as BLOCKED. Never overwrite an existing agent file without reading it and showing a diff.
The output is AGENTS.md in the repo root, or the path the user gave. It's CLAUDE.md only on an explicit request (see When to Use).
Shadow check. By default, Claude Code reads AGENTS.md only when no CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md exists in the launch directory or any directory above it; ~/.claude/CLAUDE.md doesn't count. A subdirectory's AGENTS.md loads only when that directory has no CLAUDE file of its own. Any file that counts shadows AGENTS.md. From the repo root, list CLAUDE files above the root and inside the repo:
root="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"; d="$(dirname "$root")"
while :; do for f in CLAUDE.md .claude/CLAUDE.md CLAUDE.local.md; do p="$d/$f"
{ [ -e "$p" ] || [ -L "$p" ]; } && [ "$p" != "$HOME/.claude/CLAUDE.md" ] && echo "ABOVE-REPO $(ls -l "$p")"
done; [ "$d" = / ] && break; d="$(dirname "$d")"; done
find "$root" \( -name node_modules -o -name .git \) -prune -o \( -name CLAUDE.md -o -name CLAUDE.local.md -o -name AGENTS.md \) -print |
while read -r p; do ls -l "$p"; grep -qE '^@(\.\.?/)*AGENTS\.md' "$p" 2>/dev/null && echo " -> imports AGENTS.md" || true; done
Classify every CLAUDE file found. Each gets its own action:
| File | Action |
|---|---|
Above the repo root (for example ~/CLAUDE.md) | Never edit it. Warn that it blocks AGENTS.md in every repo below it, and suggest moving its content to ~/.claude/CLAUDE.md, which doesn't count |
CLAUDE.local.md | Never edit it. Warn that it stops Claude from reading AGENTS.md for its owner. Suggest @AGENTS.md as its first line, or /config → Project instructions → claude-md-and-agents-md. That setting is per-user and ignored in project settings |
A symlink to AGENTS.md | Nothing to do. Write to the link's target, because Edit and Write refuse to write through symlinks |
Already imports AGENTS.md | Keep it, holding only Claude-only lines |
| In the repo, no import | Migrate: move shared rules to AGENTS.md, and shrink the file to the import plus its Claude-only lines. Import paths are relative to the file, so .claude/CLAUDE.md uses @../AGENTS.md |
AGENTS.md.AGENTS.md exists. Write the CLAUDE.md as the import plus Claude-only lines, and touch AGENTS.md only if asked.Claude-only lines name Claude Code features: plan mode, /commands, skills, hooks, subagents, or MCP tools. They stay in a CLAUDE file that already exists or was requested. Otherwise they go to .claude/rules/<topic>.md, which loads alongside AGENTS.md without shadowing it. Never create a CLAUDE.md just to hold them.
When the user reports that AGENTS.md isn't loading and the shadow check is clean, check the environment before rewriting any content: claude --version (v2.1.277+), the Project instructions value in /config, and whether the agents-md plugin is enabled (official-standards.md → Claude Code).
Done when the output path(s), the branch, each CLAUDE file's action, and the raw shadow-check output are shown.
Collect only what an agent would otherwise get wrong:
package.json scripts, pyproject.toml, Makefile, .github/workflows/*): install, dev, test all and one, lint, and typecheck, with the flags CI uses.pnpm, not npm)..cursor/rules/, .cursorrules, and .github/copilot-instructions.md. Keep what is still true, and leave those files in place.Done when every command you will write was read from a file. If no manifest or CI defines a command, write none for it and ask the user; never guess one.
For a targeted edit, make the requested change, add the token-efficiency block if it's missing, and change nothing else. A request for general workflow, coding-discipline, or unit-test rules is met by the matching block in references/optional-blocks.md. List other prune candidates in the report, but don't apply them. A model or agent upgrade, or a file at 150+ lines, makes a re-prune due (When to re-prune). For a full pass, read references/agents-md-writing.md first. It holds the template, the writing rules, and the evidence behind them. Then:
references/optional-blocks.md (workflow orchestration, coding discipline, unit tests) only when the user asks for them.In either kind of run, a rule the user asked for goes in as asked. A rule you propose yourself from a repeated mistake, review, audit or session corrections (not Step 2's commands and boundaries) must first pass the evidence bar in references/knowledge-routing.md (A rule the agent proposes): two cited occurrences, a trigger a diff or command can check, and a disprove check; one that fails is reported as a candidate, never written.
Done when every remaining line is a command, a pin, a constraint, or a pointer.
BLOCKED.Result: FAIL and name the check:
wc -l is under 200 for each file.grep -c '^## Token Efficiency' returns 1 in the source of truth and 0 everywhere else.AGENTS.md import.AGENTS.md./memory lists AGENTS.md. In Codex, run codex --ask-for-approval never "Summarize the current instructions.". Clients that cannot read AGENTS.md need a one-line CLAUDE.md holding @AGENTS.md: Claude Code before v2.1.277, and some Bedrock or telemetry-off sessions before v2.1.281. Offer that file, but don't create it unasked.AGENTS.mdAGENTS.override.md.claude/settings.json and .claude/settings.local.json, for hooksreferences/agents-md-checklist.md, and report every item as pass, fail, or N/A with a one-line reason. Its loading section catches CLAUDE files that shadow without importing, prose telling Claude to "read AGENTS.md", a SessionStart hook that prints AGENTS.md, and an AGENTS.override.md that Codex reads instead.references/anti-patterns.md.references/knowledge-routing.md. A rule a machine can check gets its gate and loses its prose, and a rule broken again since it was written is proposed as a hook (A rule broken again).git status must be unchanged. Give the overall verdict (PASS, PARTIAL, or FAIL) as the audit report's Result: line. Suggest /memory to see what loaded, and /doctor prompt-audit (v2.1.283+) for a second pass.Append the fenced block from references/token-efficiency-block.md once, as the last section of the source-of-truth file. The source of truth is the root AGENTS.md, or CLAUDE.md on the claude-only branch. Never add the block to a wrapper, a nested package file, or a .claude/rules/ file: those load alongside the root file, and a second copy would double it. It is the only general advice added without a request: these are always-on rules for how the agent spends its context window. Non-negotiable: add it on every write run where the source of truth lacks it, including a targeted edit, and say so in the report. The one exception is the wrapper branch: don't edit an AGENTS.md that already exists just to add the block; report that it's missing instead.
After each step, output:
◆ [Step Name] ([step N of M])
··································································
[Check 1]: √ pass
[Check 2]: × fail — [reason]
[Criteria]: √ N/M met
____________________________
Result: PASS | FAIL | PARTIAL
Use √ for pass and × for fail. Adapt the check names to each step.
End every run, including one that stops early, with the final report from references/final-report.md: Result: first (COMPLETE, PARTIAL, or BLOCKED), then Evidence:, Uncertainty:, and Decision:. The reference defines each status and holds the reader checks.
CLAUDE.md was created.AGENTS.md or is a symlink to it. Files above the repo and CLAUDE.local.md were left unedited, and the user was warned about them.references/agents-md-checklist.md. Wrappers and rules files pass sections 1–3 and 6.AGENTS.md and a CLAUDE file.references/anti-patterns.md.Result: PASS. Audit runs report every checklist item, give each failing line a routing recommendation, leave git status unchanged, and give the overall verdict.references/final-report.md. Without user feedback, human understanding of the report stays unconfirmed.| Branch | Files after the run |
|---|---|
| agents-only | AGENTS.md: Commands, Constraints, Done when, any optional sections, then ## Token Efficiency |
| migrate / wrapper | AGENTS.md as above, plus each CLAUDE file reduced to the @AGENTS.md import and its Claude-only lines |
| claude-only | CLAUDE.md with the full content and the token block |
| audit | no writes; a checklist report with routing and a Result: PASS, PARTIAL, or FAIL verdict |
Every branch then prints the final report. A sample file is in references/agents-md-writing.md, a sample audit report is in references/agents-md-checklist.md, and sample final reports are in references/final-report.md.
AGENTS.md per package over a growing root file. Codex and most agents give priority to the closest file. Claude reads the root file plus each subdirectory's file on demand, and a CLAUDE file shadows the AGENTS.md in its own directory. Ask which scope to edit.AGENTS.md, or holds a pasted copy of it (from /init or /import): it lacks the import, so migrate it.AGENTS.override.md or AGENTS.local.md: Codex reads AGENTS.override.md instead of that directory's AGENTS.md, and Claude reads neither. Say so before writing one.~/.claude/CLAUDE.md, ~/.codex/AGENTS.md): audit and propose only. Never rewrite a personal file from a repo-scoped run.Optional and propose-only. After the run's result is delivered, run this check:
AGENTS.md section./config setting, or shadow-check command failed and a workaround worked.references/ (the directory holding this SKILL.md). Bump the patch number of metadata.version. If the skill is an installed copy or tracked in git, say so. Commit nothing unless the user asks.Off — the user opted out.references/agents-md-checklist.md (opens in a new tab)references/agents-md-writing.md (opens in a new tab)references/anti-patterns.md (opens in a new tab)references/final-report.md (opens in a new tab)references/knowledge-routing.md (opens in a new tab)references/official-standards.md (opens in a new tab)references/optional-blocks.md (opens in a new tab)references/token-efficiency-block.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
agent-instructions, claude-md, agents-md, cursorrules, configuration
npx claudepluginhub luongnv89/skills --plugin lstack20 skills in this plugin
/auto-pushGenerate a commit message, stage all changes, and push to remote after scanning for secrets, large files, and protected-branch risks. Skip for opening PRs, code review, or cutting releases/tags./cleanup-projectPrepare a git repo before new work: review uncommitted changes, fix .gitignore, delete merged branches, end on clean main, or inspect one branch before deciding. Don't use for dead code, commit-and-push, releases, LICENSE files, or git how-tos./cli-builderBuild production-quality CLIs with language detection and a five-step approval-gated workflow. Use when wrapping an existing module or app. Don't use for GUI/TUI apps, web APIs, or one-off shell scripts./code-analysis-setupPlan, then install on approval, free static analysis (lint, SAST, secrets, deps) across repos, merged into existing hooks and CI. Use when adding code analysis. Don't use for one-repo security stacks (security-setup) or CI/CD (devops-pipeline)./code-reviewReview or improve code in four modes: bug/security review (default), performance, clean-code audit, slop cleanup (mode:review|perf|clean|cleanup). Don't use for features, tests (test-coverage) or a full comment audit (comment-audit)./comment-auditAudit every code comment in a repo or path: sort as Tautology, Excuse, Stale or Decision Record, act on each after approval, ratchet a comment ban, and estimate lines shed. Don't use for slop cleanup (code-review) or writing docs.Other plugins' skills for the same job