instruction-audit

Audit a repository's AGENTS.md, CLAUDE.md, DESIGN.md and SKILL.md files against real sessions and against each other - which rules agents followed, skipped or never met and why, which lines are stale, duplicated, conflicting or vague, and what to change - then apply the changes the user approves. Use when asked to audit, check or clean up agent instructions, whether a rule earns its place, or to add, remove or reword a rule.

O que é instruction-audit?

instruction-audit is a Claude Code agent skill that audit a repository's AGENTS.md, CLAUDE.md, DESIGN.md and SKILL.md files against real sessions and against each other - which rules agents followed, skipped or never met and why, which lines are stale, duplicated, conflicting or vague, and what to change - then apply the changes the user approves. Use when asked to audit, check or clean up agent instructions, whether a rule earns its place, or to add, remove or reword a rule.

Funciona com✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/QuesmaOrg/quesma-agent-plugin/tree/HEAD/skills/instruction-audit

Installed? Explore more Programação e Desenvolvimento skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Instruction audit

One report for the instruction files: what agents followed, what they omitted and why, what is stale or conflicting, and what to change. Evidence comes from real sessions and the repository, never from reading a rule and guessing.

The scripts are in this plugin's scripts/ directory: two levels up from this skill's base directory. Session evidence, the report and applying changes follow <plugin>/scripts/EVIDENCE.md; read it before step 4.

1. Scope

Default: every instruction file in the repository, the last 30 days of this machine's sessions, and the team's sessions if status says connected. Say the scope in one line before you start. Narrow it only when the user asks:

  • Named files, rules or a period: only those.
  • Files only ("just check the files", or no sessions to read): steps 2, 6 and 7.
  • One change ("add a rule that X", "drop line 42"): steps 3 and 4 for that rule, then one proposal from step 7.

2. Rules

node <plugin>/scripts/rules.mjs --discover . > $TMPDIR/rules.jsonl

Or name the files the user asked about. Each rule has an id file:line; use it in every finding. List the files, their line counts and how they load each other (@ imports, "read X first" links). An instruction file nothing loads is dead weight; say so.

3. Turn each rule into something observable

For each rule, write one trigger and one check, both things a transcript can show:

ruletrigger (the situation)check (what following it looks like)
make check is the commit gatea git commit ranmake check ran earlier in the session, after the last edit
Ask before adding a dependencypnpm add, go get, pip install ran, or a manifest was editeda user message approved it before
No comments in src/an edit under src/the diff adds no // or /* */

A rule with no observable trigger (taste, tone, "think about X") is untestable. Do not invent evidence for it.

4. Followed, skipped, never met

Gather the evidence as EVIDENCE.md says: this machine, then the team. One status per rule:

  • followed: the trigger fired and the check held. These rules earn their place.
  • skipped: the trigger fired and the check did not hold.
  • unused: the trigger never fired in scope. Not a failure; a candidate for removal if it stays unused over a longer period.
  • untestable: no observable trigger. Goes to step 7 as a reword or a removal.

Also look for missing rules: a correction event that no rule covers, seen in more than one session. Each one becomes a proposal in step 7, with the session ids.

5. Why a rule was skipped

For each skipped rule, one cause, from the evidence, not from the wording alone:

  • the file was not loaded in that session (no @ import reaches it, wrong directory)
  • the rule is buried: far down a long file, or under an unrelated heading
  • another rule or the user's instruction contradicts it (cite the other id)
  • the wording has no visible trigger, so the agent did not see that it applied
  • the agent saw it and chose otherwise (a quote-free summary of the turn)

6. Hygiene

What the files say against each other and against the repository. A stale, duplicated or conflicting line often explains a skip: cite it in that rule's cause.

  • stale: every path, link, make target and package script a rule names that no longer exists: node <plugin>/scripts/refs.mjs --missing $(jq -r .file $TMPDIR/rules.jsonl | sort -u). Then check by hand what the script cannot: a tool, flag or workflow the code no longer uses (grep before calling it gone), a number that changed, a "today" or "for now" that is old.
  • duplicate: two rules that say the same thing, in one file or across files. Name both ids and keep the one closer to the code it governs. A component's file narrowing a root rule is not a duplicate.
  • conflict: two rules that cannot both be followed in one situation. Quote both ids and the situation. Do not resolve it; the owner decides.
  • vague: no observable trigger or check ("be careful with X"). Give the testable form in one sentence, or suggest removing it.

7. Proposals

One per change: what to change, the evidence (session ids, counts, or the stale reference; "seems useful" is not evidence), and the trade-off (what it could block or make worse; "none found" only after looking). Rank removals of stale or duplicated lines first, then rewording of skipped rules, then new rules. A new rule needs a failure seen in more than one session.

When a proposal writes a rule:

  • One rule, one line where possible. Imperative, with the trigger and the check visible in the words.
  • Put it in the file closest to the code it governs, and only there; never repeat it in a file this one imports or is imported by.
  • Say why in a clause when the reason is not obvious; an agent follows a rule it understands.
  • Keep the file's existing voice, headings and order.

Report

As EVIDENCE.md says, to $TMPDIR/quesma/instruction-audit.json with kind: "instruction-audit", repo, scope (files, rules, sessions, dates), and the items of steps 4 to 7 together: followed, skipped (action = the cause from step 5), unused, untestable, stale, duplicate, conflict and vague (action = the fix), and proposal items with id, rule (the current line, or "new", numbered "1. ..."), change, evidence and tradeoff. Set next to the single most useful proposal.

End your answer with two short lines: the tally and the top proposal. Then ask which proposals to apply, and apply them as EVIDENCE.md says.

Individual skills in this repo

This repo contains 2 individual skills — each has its own dedicated page.

Habilidades Relacionadas