/claude-engineering-skills:ai-context-managementfrom Claude Engineering Skills
Manage AGENTS.md and CLAUDE.md alignment across a repo so Claude, Copilot, Cursor, Windsurf, and other AI agents share the same project context. Detects drift, reconciles manually-introduced divergence, and migrates legacy CLAUDE.md-canonical repos to AGENTS.md-canonical. Triggers on: "audit AGENTS.md", "check context drift", "AGENTS.md vs CLAUDE.md", "fix context drift", "migrate to AGENTS.md", "context sync", "what tools read which file", "ai-context-management". Usage: /ai-context-management audit — Score drift + report findings Usage: /ai-context-management reconcile — Apply patches to fix drift Usage: /ai-context-management migrate — Flip legacy repo to AGENTS.md canonical
Ships in Claude Engineering Skills. 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.
Keep AGENTS.md (canonical, shared) and CLAUDE.md (slim, Claude-only addendum)
aligned across a repo, so Claude, Copilot (which reads .claude/skills +
AGENTS.md natively), and other agents share one project context.
Input: $ARGUMENTS — audit | reconcile | migrate
(plus optional --repo <path> for cross-repo invocation).
Where $ARGUMENTS comes from — orchestrator-supplied input first, else
the host's verbatim invocation suffix, else the span of the user's current
message naming this skill or its subject. Never inferred from surrounding
conversation. This site is subcommand; on empty input, default to audit — it is read-only and writes nothing, so it is the safe default. reconcile and migrate write files and are never defaulted into.
Full contract: references/input-acquisition.md.
Worktree preflight — in a linked git worktree the gitignored tooling tree
scripts/.claude-skills/is absent (git worktree adddoes not populate it), so every command below that uses it dies onMODULE_NOT_FOUND. Runnpm run skills:hydratefirst; if no such script exists,references/worktree-preflight.mdholds the entry to add (ask the user first: it editspackage.json). Keys are not copied: put them in~/.audit-loop.env, which every worktree reads.
| Input | Mode | Effect |
|---|---|---|
audit | AUDIT | Run node scripts/check-context-drift.mjs --strict --repo "$REPO"; report findings; no writes |
reconcile | RECONCILE | Detect drift, propose patch, apply after confirmation |
migrate | MIGRATE | Convert legacy CLAUDE.md-canonical → AGENTS.md-canonical |
| (no args) | AUDIT | Default to audit |
REPO=<the --repo path if passed, else cwd> — set this once, here, before
any mode branch. Every command in Steps 1–3 below runs against $REPO, not
the invoking cwd; check-context-drift.mjs itself takes --repo <path>
(default: cwd) for exactly this. Step 3's file operations (reading/writing
AGENTS.md/CLAUDE.md) likewise target $REPO, not the cwd.
For reconcile and migrate, never write files without user confirmation —
present the proposed patch first, ask for apply / cancel, then act. This
gate covers writes to the audited repo's own content (AGENTS.md,
CLAUDE.md). It does NOT cover the Worktree preflight above, which — when it
runs at all — provisions local tooling (scripts/.claude-skills/) before Step
0 is even reached, regardless of mode. That is infrastructure bootstrap, not
a content edit, and every mode including audit needs the tooling present to
run its own commands at all.
Run the drift detector and summarise findings.
node scripts/check-context-drift.mjs --strict --repo "$REPO" 2>&1
Exit codes: 0 = no findings, 1 = HIGH (blocking), 2 = MEDIUM only.
For each finding, show:
ctx/missing-import)Detailed rule reference + severity rubric: references/drift-rules.md.
Goal: bring AGENTS.md and CLAUDE.md into alignment, preserving any genuine
Claude-only content in CLAUDE.md.
Steps:
node scripts/check-context-drift.mjs --format json --repo "$REPO" > .audit/drift.json to get structured findings.ctx/missing-import → propose adding @./AGENTS.md near top of $REPO/CLAUDE.md.ctx/non-allowlist-heading → propose moving the section to $REPO/AGENTS.md and removing from $REPO/CLAUDE.md.ctx/shared-section-drift → propose deleting from $REPO/CLAUDE.md (AGENTS.md wins for shared content).ctx/oversized-claude-md → identify the largest non-allowlisted sections; propose moving them.apply confirmation.$REPO.node scripts/check-context-drift.mjs --strict --repo "$REPO" to confirm green.Full step-by-step playbook with conflict resolution: references/reconcile-playbook.md.
For repos that currently use CLAUDE.md as the canonical project context (legacy
single-file pattern). Flips to AGENTS.md-canonical so the wider AI ecosystem
(Copilot, Cursor, Windsurf, Codex) reads the same content.
Steps:
AGENTS.md exists? Drift vs CLAUDE.md?CLAUDE.md is canonical (full content) vs slim addendum?CLAUDE.md is canonical and AGENTS.md is missing/drifted:
@./AGENTS.md import + Claude-only addendumnode scripts/check-context-drift.mjs --strict --repo "$REPO" to verify alignment.scripts/lib/context.mjs INSTRUCTION_FILE_CANDIDATES for the pattern).Migration playbook with edge cases: references/canonical-flip.md.
After every mode, emit a compact status card:
═══════════════════════════════════════
AI-CONTEXT-MANAGEMENT — <MODE> — Done
HIGH: 0 MEDIUM: 0 Files updated: 2
AGENTS.md: 349 lines CLAUDE.md: 41 lines
Next: node scripts/check-context-drift.mjs --strict --repo "$REPO" (verify) | git diff (review)
═══════════════════════════════════════
reconcile and migrate modes —
show the diff first.Slash Commands,
Hooks, Memory, Local Overrides, Claude-only Notes, etc.) stay in
CLAUDE.md.npm run check), not from CI. A
consumer wires it into its own pre-push if it wants the same gate. The
.github/workflows/context-drift.yml workflow was retired in c12e2178
along with the other push-triggered check workflows.This skill's canonical flow is above. The files below cover specialised situations — read them only when the trigger applies.
| File | Summary | Read when |
|---|---|---|
references/input-acquisition.md | Where a skill's arguments come from on any host, and what to do when there are none. | Reading $ARGUMENTS on a host that does not substitute it, or deciding what empty input means at a site. |
references/drift-rules.md | Per-rule severity, fix recipes, and the Claude-only heading allowlist for ctx/* rules. | A finding's rule ID is unfamiliar, OR you need to extend the allowlist for a custom heading. |
references/reconcile-playbook.md | Step-by-step: bring drifted AGENTS.md and CLAUDE.md back into alignment safely. | RECONCILE mode is firing AND a finding has competing edits in both files. |
references/canonical-flip.md | Migration guide: switch a repo from CLAUDE.md-canonical to AGENTS.md-canonical. | MIGRATE mode is firing on a legacy single-file repo. |
examples/slim-claude-md.md | Canonical 30-line CLAUDE.md template after AGENTS.md flip. | Producing a slim CLAUDE.md from scratch in MIGRATE mode. |
examples/well-formed-agents-md.md | 100-150 line AGENTS.md exemplar with reasoned rules and standard sections. | A repo has no AGENTS.md and you're producing one from project knowledge. |
examples/monorepo-layout.md | Root + per-package AGENTS.md layout for monorepos. | The repo has multiple packages and you're deciding where AGENTS.md goes. |
references/worktree-preflight.md | Worktree preflight remedy — the skills:hydrate npm script to add when a linked worktree lacks the tooling tree. | A command dies with MODULE_NOT_FOUND in a linked worktree AND this repo has no skills:hydrate script. |
examples/monorepo-layout.md (opens in a new tab)examples/slim-claude-md.md (opens in a new tab)examples/well-formed-agents-md.md (opens in a new tab)gate-contract.json (opens in a new tab)references/canonical-flip.md (opens in a new tab)references/drift-rules.md (opens in a new tab)references/input-acquisition.md (opens in a new tab)references/reconcile-playbook.md (opens in a new tab)references/worktree-preflight.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (lbstrydom/claude-engineering-skills) — no native marketplace selected
npx claudepluginhub p/lbstrydom-claude-engineering-skills18 skills in this plugin
/audit-codeIteratively audit code against a plan with GPT + an independent final gate (Gemini, else Claude).
5-pass parallel static analysis (structure, wiring, backend, frontend,
sustainability), R2+ ledger-driven suppression, debt capture for
out-of-scope findings, max 6 rounds with 2-stable-rounds convergence.
Invoke this for ANY code-correctness review, even a small pasted snippet
or diff — don't just review it yourself directly; a single read-through
is not a substitute for the multi-pass GPT + final-gate adjudication this skill
performs, and skipping it means the review didn't actually happen.
Triggers on: "audit my code", "audit my changes", "audit my PR",
"check the implementation", "review my code", "audit code", "/audit-code",
"audit this", "verify the implementation".
Usage: /audit-code <plan-file> — Audit code against plan (--scope diff default)
Usage: /audit-code <plan-file> --scope plan — Audit only files mentioned in the plan
Usage: /audit-code <plan-file> --scope full — Full repo audit
/audit-planIteratively audit a plan file (docs/plans/*.md) with GPT + final gate (Gemini/Claude).
Multi-round refinement with an acceptance-rate early-stop (3 rounds default).
Ledger-driven suppression on R2+ rounds prevents finding churn.
Judges the plan DOCUMENT before anyone builds it. "Was the plan actually
built?" is /ux-lock verify — that reads a live app, this reads only the file.
Triggers on: "audit the plan", "iterate on the plan", "plan-audit",
"audit docs/plans/", "review the plan", "is this plan good",
"check the plan", "/audit-plan".
Usage: /audit-plan <plan-file> — Audit existing plan iteratively
Usage: /audit-plan <task-description> — Generate plan with /plan, then audit
/brainstormMulti-LLM concept-level brainstorming. Sends the user's topic to OpenAI
(and optionally Gemini) so the user can compare independent perspectives
alongside Claude's. Convergence is manual — Claude waits for the user
to ask for synthesis instead of auto-merging the views. Supports model
selection, repo-architecture context attachment (auto on arch topics),
a debate second round, depth budgets, session resume, extra context and
artifact attachment, and saving keeper insights from prior rounds.
Triggers on: "brainstorm", "let's think about", "get other LLMs on this",
"what would Gemini/GPT say", "/brainstorm".
Full command syntax: see the Usage section in this skill.
/click-testStructural DOM audit of a live app — walk every interactive element and
assert semantic-HTML contracts (duplicate IDs, orphan labels, inputs without
names, ARIA misuse, heading hierarchy, missing alt text, undersized touch
targets). Complements /persona-test: persona-test catches narrative UX issues
a real user would hit; click-test catches structural issues that hide in
JS-rendered surfaces and silently break assistive tech, form submissions, or
React reconciliation. Drives a browser via the shared driver contract; optional
--with-modals opens each modal/dropdown and rescans; device presets and
matrix mode cover responsive breakpoints.
Triggers on: "click test", "click-test", "structural audit", "DOM audit",
"accessibility audit", "duplicate ID check", "walk every element",
"audit the DOM", "structural QA", "/click-test".
Full command syntax: see the Usage section in this skill.
/cycleEnd-to-end feature cycle orchestrator. Runs the full skill chain in
sequence: /plan → /audit-plan → (wait for human implementation) →
/audit-code → /persona-test (if frontend/full-stack) → /ux-lock (if
fixes shipped) → /ship-checked. Use when starting a new feature or non-trivial
fix and you want the whole workflow on autopilot. Supports resuming from
an existing plan or straight to code-audit, per-step skips, max-round
pass-through, an opt-in autonomous mode that implements + audits each
plan cluster (the default still pauses for the human), and a remediate
mode that fixes triaged persona-test/audit findings against an accepted
plan with a focused audit and a rerun of only the affected journeys.
Triggers on: "run the full cycle", "do the whole flow", "plan + audit
+ ship", "feature cycle", "remediate the persona findings", "/cycle".
Full command syntax: see the Usage section in this skill.
/explainExplain WHY a piece of code is structured the way it is. Synthesises
architectural-memory similar-symbols, git history (blame + commits +
PR context), AGENTS.md/CLAUDE.md principles, and any plan documents
that mention the target. Useful for onboarding ("why is this here?"),
debugging ("why is X structured this way and not Y?"), and refactoring
("can I change this safely or is there hidden context?").
Pick by INPUT: a TOPIC to survey comes here ("have we touched rate
limiting?"); a CLAIM to test goes to /investigate ("that landed in July" —
it uses --history as one of its instruments). Invoke on the question's
shape, don't pre-check the target exists first — Step 0 validates it and
reports cleanly if missing; don't Grep/Glob and answer directly instead.
Triggers on: "why is this", "explain this code", "why does this exist",
"what is this for", "/explain", "give me context on".
Full command syntax: see the Usage section in this skill.
Other plugins' skills for the same job