CommunityProgramación y desarrollogithub.com

automation-audit

Find work that agents and people repeat across a repository's sessions and decide, with evidence, what should become a script, a hook, a shared skill or one instruction line, and what should stay as it is. Use when asked which skills to add, what to automate or make deterministic, what the team does the same way over and over, or how to unify how people work in a repository.

¿Qué es automation-audit?

automation-audit is a Claude Code agent skill that find work that agents and people repeat across a repository's sessions and decide, with evidence, what should become a script, a hook, a shared skill or one instruction line, and what should stay as it is. Use when asked which skills to add, what to automate or make deterministic, what the team does the same way over and over, or how to unify how people work in a repository.

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

Installed? Explore more Programación y desarrollo skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Automation audit

Most repeated work should stay as it is. A script, hook or skill is code the team keeps: it pays only when the same steps come back often, cost something each time, and nothing already does them. This skill finds the few that pass, says why the rest do not, and changes nothing until approved.

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 2.

1. Scope

Default: this 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 when the user names a topic ("our PR flow"), a period or a person.

2. What repeats

node <plugin>/scripts/sessions.mjs --days 30 --out $TMPDIR/sessions.jsonl
node <plugin>/scripts/repeats.mjs $TMPDIR/sessions.jsonl > $TMPDIR/repeats.json
node <plugin>/scripts/repeats.mjs $TMPDIR/sessions.jsonl --prompts > $TMPDIR/prompts.txt

repeats.json counts three things; its header says how:

  • steps: a command run in many sessions. Look hardest at failed and retried: an agent that fails, works around and runs a step again is paying for a missing script or a missing line.
  • sequences: steps in the same order in many sessions. A procedure without a name.
  • prompts: requests the person typed with mostly the same words.

Then read prompts.txt and group the requests by intent, not by words: "address the review on #197" and "new comments on #222" are one intent. Keep each intent seen in 3 or more sessions. An intent the person types again and again, with the same follow-ups or corrections each time, is the strongest sign of a missing skill.

For each candidate, open 2 or 3 of its sessions in the digest and read what happened around it:

jq -c 'select(.session | startswith("<id>")) | [.t[11:16], .kind, .text[0:120]]' $TMPDIR/sessions.jsonl

Write down the steps as they really ran, which ones changed from session to session, the tool calls and minutes it took, and the failures and corrections on the way. Counts alone mislead: the edit, build, commit loop repeats in every session and is just the work.

3. What already exists

Before calling anything missing, list what the repository and the user already have:

  • make targets (grep -E '^[a-zA-Z_-]+:' Makefile */Makefile), package scripts, scripts/ and bin/ directories
  • skills and commands: .claude/skills/, .claude/commands/, ~/.claude/skills/, and the skills this session lists from plugins
  • hooks: .claude/settings.json, ~/.claude/settings.json
  • the instruction files: a line that already says how

If something covers the candidate and agents did not use it, the item is exists: the fix is discoverability (one line where the agent looks, or a better skill description), not a new thing.

4. The bar

A candidate goes on only if all four hold. Name the one that failed for every candidate you drop.

  1. Recurs: 3 or more sessions on 3 or more different days, or 2 or more people in the team.
  2. Same steps: the steps and their order hold across those sessions; what changes can be named as inputs (a PR number, a branch, a page). Different steps each time is judgment work, not a procedure.
  3. Costs something now: 3 or more tool calls each time, a failure or retry, a correction, or the person typing the same instructions again. A one-line command already costs nothing.
  4. Not already there: step 3 found nothing that does it.

5. The form

The cheapest form that removes the cost:

formwhenwhere it goes
proposal (one instruction line)the agent lacked one fact: a flag, a path, "gh needs the user's terminal"via instruction-audit
scriptevery step is mechanical: same inputs, same output, no reading in betweena make target or package script, so people and CI can run it too
hooka check must happen at a fixed moment (before a commit, after an edit) and was skipped in 2 or more sessions.claude/settings.json
skillthe steps hold but need judgment between them (read the review, pick what to change), or the person explains the same procedure again and again.claude/skills/<name>/SKILL.md; the mechanical parts call a script

Prefer a script over a skill whenever the steps allow it: it runs the same way every time, costs no tokens, and can be tested. A skill that only runs commands in order is a script in disguise.

Team or personal: a candidate seen with 2 or more people goes into the repository, so everyone gets the same way of doing it. One seen only in this user's sessions is personal: ~/.claude/ or nothing. When people do the same intent with different steps, say so: that is the case for one shared skill, and the item names whose steps it should follow and why.

6. Argue against it

For every candidate still standing, write the case against it in one or two sentences, then decide:

  • Would it have saved time in each session you read, or only in some?
  • Will the steps still hold in a month, or is this one project's burst that is already over?
  • Who keeps it working when the code moves, and what breaks if it goes stale?
  • Would a teammate find and use it, or would agents keep doing it by hand?

Drop it (rejected) if the case against wins. Fewer, stronger items are the goal; an empty list with clear reasons is a good result.

7. The team (needs /quesma:login)

As EVIDENCE.md says: status, briefing once, then counts only.

  • Spread of a step: metrics_query on bash_commands for this repository and period: per first two words of the command, the runs, sessions and distinct people. Never return whole commands; they can hold tokens and paths.
  • Spread of an intent: lake_query counting sessions and distinct people where a user turn matches one or two patterns for the intent (ILIKE '%address%review%'). Counts only; the judge refuses text.
  • Different ways: for an intent with 2 or more people, count per person the steps their matching sessions ran. Different steps for one intent is the case for a shared skill.

Add what only the team shows: a step or intent with 2 or more people that this machine never saw.

Report

As EVIDENCE.md says, to $TMPDIR/quesma/automation-audit.json with kind: "automation-audit", repo, scope (sessions, days, people, what could not be read), one item per candidate:

  • status: script, hook, skill, proposal, exists or rejected.
  • id: what it would be called: make pr-shots, .claude/skills/pr-review, AGENTS.md; for exists, the thing that already does it; for rejected, a short name of the pattern.
  • rule: the pattern in one line, as a person would say it.
  • detail: the counts: "7 sessions on 6 days, 2 people; 9 tool calls and 1 retry each time".
  • change: what it does: its inputs, its steps, what it prints or leaves behind.
  • tradeoff: the case against from step 6, and who keeps it.
  • action: for rejected, the bar it failed; otherwise the first step to build it.
  • evidence: session ids.

Set next to the one item worth building first. End your answer with one line of counts per status and the top item. Then ask which items to build.

Building what was approved

Build exactly the approved items, as EVIDENCE.md says, then:

  • script: write it, add the make target or package script, run it once on a case from the sessions you read, and show the output.
  • hook: show the settings change and the command it runs; test the command alone first.
  • skill: a SKILL.md with a description that names when to use it in the words people typed; steps in order; mechanical parts as a script it calls. Keep it short.
  • proposal: hand it to instruction-audit as one change.

Do not commit unless asked.

Individual skills in this repo

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

Skills relacionados