audit-fix-loop
Canonical doctrine for scored iterative improvement, and the generic fallback for ad-hoc 'iteratively improve / audit and fix / grade and improve / hill-climb quality / score and fix' requests that don't map to a domain workflow.
What this skill does
**Announce:** "Using audit-fix-loop to plan a scored iterative improvement loop."
## What this skill is (and isn't)
`/goal` is the **mechanism**: it re-fires turns and uses a separate-model evaluator to gate exit on a condition it reads from the transcript. This skill is the **doctrine** that tells you how to set a loop up so `/goal` enforces the *right* thing — `/goal` will just as happily enforce a wrong condition.
It is also the **generic fallback**. The domain workflows below are specialized, pre-wired instances of this same doctrine — prefer them when one fits. Use this skill directly only for ad-hoc "improve <arbitrary artifact>" requests that don't map to any of them:
| Domain workflow | Use it instead when… |
|---|---|
| **visual-verify** | improving slides/charts/rendered output (Gemini vision, zero-blocking-defects gate) |
| **bluebook-audit** | correcting Bluebook citations in a DOCX |
| **source-verify** | verifying citations exist + quotes match sources |
| **writing-review / writing-revise** | improving a prose draft |
| **workflow-creator** Mode 3 | hardening a skill/workflow (wc-audit substrate gate) |
<EXTREMELY-IMPORTANT>
## Iron Law 1 — The auditor must not be the fixer
**This is the one thing `/goal` cannot supply.** `/goal` decides *when to exit*; it does not enforce that the *score* came from someone other than the fixer. If the agent that wrote the fix also grades it, you get rubber-stamping — the fixer's opinion of its own work is worthless.
The audit must be structurally independent every iteration: a **fresh subagent** (no fixer context), a **different model** (e.g. Gemini), or a **mechanical checker**. If you ran an audit with the fixer's context, DELETE the result and re-run with a fresh auditor — tainted findings are worse than none.
</EXTREMELY-IMPORTANT>
<EXTREMELY-IMPORTANT>
## Iron Law 2 — Gate on the substrate, not on a bare score
**Terminate on the deterministic/categorical substrate going clean + the 0-10 score going FLAT — never on a bare "composite ≥ 9.5".**
The substrate is the convergent signal: **zero CRITICAL and zero HIGH findings outstanding** (and, where the domain has them, mechanical gates pass / citations resolve / zero blocking defects). It monotonically converges and is what "done" actually means.
The 0-10 score is a noisy LLM proxy: it re-rolls ±0.2 each run and regenerates fresh minor findings every pass, so it asymptotes (empirically ~9.0) and never stably crosses 9.5. Chasing it is a treadmill where every fix surfaces a new nit and the last half-point is only buyable by over-engineering the artifact — which makes it *worse*. (See `project_wc_mode3_asymptote`.) Treat the score as an advisory thermometer and a **flatness** check, not the summit.
So the exit condition is: **substrate clean AND score flat (within ±0.2 of the prior turn, at/above your chosen floor)** — or the turn budget elapses. The threshold you pick in Step 1 is a *floor the substrate must clear*, not a bar to grind toward. For a **pure-judgment** scorer with no hard substrate (e.g. prose rhythm), gate on convergence/flat + zero blocking alone — there is no threshold to chase.
</EXTREMELY-IMPORTANT>
<EXTREMELY-IMPORTANT>
## Iron Law 3 — No `/goal` without a plan
**A naive condition like "fix all issues" gives the evaluator nothing concrete to check.** Before setting the `/goal`, identify: (1) the artifact, (2) the scoring surfaces, (3) how the audit stays independent, (4) the substrate gate + score floor. The condition MUST pin completion to external state the auditor writes — `.planning/SCORES.md` (score trend + finding counts) — so the evaluator reads the substrate and the flatness from the transcript, not from your say-so.
If you set a `/goal` without planning, run `/goal clear`, plan via Step 1, and set a new one. No patching a naive condition mid-flight.
</EXTREMELY-IMPORTANT>
## The loop
```
PLAN (Step 1) → /goal <substrate-gate condition pinned to .planning/SCORES.md>
│
└─► each turn the evaluator re-fires:
AUDIT fresh independent auditor scores the artifact
→ findings → .planning/AUDIT.md ; score + CRITICAL/HIGH counts → .planning/SCORES.md
DECIDE substrate clean (0 CRITICAL/0 HIGH) AND score flat? → end turn; evaluator marks done
substrate dirty, OR score still climbing run-to-run? → FIX
FIX apply targeted fixes worst-severity-first (CRITICAL → HIGH → MEDIUM); do NOT self-assess
→ end turn immediately (the /goal refires for re-audit)
```
`/goal` owns the re-firing and the exit decision. You own AUDIT → DECIDE → FIX inside each turn. After fixing, **do not pause to summarize or ask "should I continue?"** — end the turn so the goal refires. The evaluator decides when to stop, not you.
## Step 1: Plan the loop
```
AskUserQuestion(questions=[
{"question": "What artifact are you improving?", "header": "Artifact", "multiSelect": false,
"options": [
{"label": "Writing draft", "description": "Document, essay, paper, or prose"},
{"label": "Skill or workflow", "description": "SKILL.md / workflow being hardened — prefer workflow-creator Mode 3"},
{"label": "Visual output", "description": "Slides/charts/rendered docs — use visual-verify instead"},
{"label": "Citations", "description": "Footnotes / quotes — use bluebook-audit or source-verify instead"}]},
{"question": "Which scoring surfaces should the audit use?", "header": "Scorers", "multiSelect": true,
"options": [
{"label": "AI anti-patterns", "description": "12-category checklist for AI writing indicators"},
{"label": "Style guide", "description": "Legal / econ / Strunk & White"},
{"label": "Enforcement patterns", "description": "12 superpowers enforcement patterns (skills/workflows)"},
{"label": "Source verification", "description": "Citations vs bib + quotes vs sources — use source-verify"}]}
])
```
Redirect to the domain workflow if the artifact is visual / citations / a skill — they already implement this pattern, calibrated.
**Derive the parameters:**
| Parameter | How to derive |
|-----------|--------------|
| Audit method | Fresh subagent reads the scorer's rules (see table), then audits — independence per Iron Law 1 |
| Fix method | Self-edit for small artifacts; parallel subagents for large ones |
| Turn budget | 10 default, encoded as `Stop after N turns` |
| Substrate gate | 0 CRITICAL / 0 HIGH (+ any domain mechanical/categorical gates) |
| Score floor | 9.5/10 default — a floor the substrate must clear, NOT a bar to grind |
| Scorer | Audit method (independence mechanism) |
|--------|---------------------------------------|
| AI anti-patterns | fresh subagent reads `../ai-anti-patterns/SKILL.md` + refs, then audits |
| Style guide | fresh subagent reads the domain skill (writing-legal / -econ / -general), then audits |
| Enforcement patterns | fresh subagent reads `references/enforcement-checklist.md`, scores all 12 |
| Source verification | invoke `Skill(skill="workflows:source-verify")` — mechanical bib grep + quote search |
When multiple scorers are selected, every iteration runs ALL of them and the substrate is the union of their CRITICAL/HIGH findings.
## Step 2: Initialize state files
```bash
mkdir -p .planning
```
**`.planning/AUDIT.md`** (overwritten each iteration) — findings table per scorer: `# | Severity | Finding | Location | Suggestion` (severities CRITICAL/HIGH/MEDIUM/LOW).
**`.planning/SCORES.md`** (append-only) — one row per iteration so the evaluator can read both the substrate and the trend:
```markdown
# Score History
| Iteration | Score | CRITICAL | HIGH | Δ vs prior | Note |
|-----------|-------|----------|------|-----------|------|
| 1 | 6.5 | 3 | 2 | — | baseline |
| 2 | 8.9 | 0 | 0 | +2.4 | substrate clean; not yet flat |
| 3 | 9.0 | 0 | 0 | +0.1 | substrate clean + flat → done |
```
## Step 3: Set the `/goal`
Pin the condition to the substrate (CRITICAL/HIGH counts) **and** score-flatness Related in Ads & Marketing
ads
IncludedMulti-platform paid advertising audit and optimization skill. Analyzes Google, Meta, YouTube, LinkedIn, TikTok, Microsoft, and Apple Ads. 250+ checks with scoring, parallel agents, industry templates, and AI creative generation.
banana
IncludedAI image generation Creative Director powered by Google Gemini Nano Banana models. Use this skill for ANY request involving image creation, editing, visual asset production, or creative direction. Triggers on: generate an image, create a photo, edit this picture, design a logo, make a banner, visual for my anything, and all /banana commands. Handles text-to-image, image editing, multi-turn creative sessions, batch workflows, and brand presets.
rpg-migration-analyzer
IncludedAnalyzes legacy RPG (Report Program Generator) programs from AS/400 and IBM i systems for migration to modern Java applications. Extracts business logic from RPG III/IV/ILE source code, identifies data structures (D-specs), file operations (F-specs), program dependencies (CALLB/CALLP), and converts RPG constructs to Java equivalents. Generates migration reports, complexity estimates, and Java implementation strategies with POJO classes, JPA entities, and service methods. Use when modernizing AS/400 or IBM i legacy systems, analyzing RPG source files (.rpg, .rpgle, .RPGLE), converting RPG to Java, mapping data specifications to Java classes, planning legacy system migration, or when user mentions RPG analysis, Report Program Generator, RPG III/IV/ILE, AS/400 modernization, IBM i migration, packed decimal conversion, or mainframe application rewrite.
brand-library-architect
IncludedBuild a complete brand library for a product — visual asset render pipeline, brand documentation set (BRAND, COPY, MANIFESTO, BIOS, FAQ, GLOSSARY, TONE, PRICING), open-source convention files (README, CONTRIBUTING, SECURITY, CODE_OF_CONDUCT), and a self-contained press kit. This skill should be used when the user asks to "build a brand library / brand kit / press kit / brand assets" for a product, "set up a brand library workflow," "create a positioning manifesto plus visual identity," or any combination of brand documentation + visual asset pipeline. Apply phase-by-phase or run end-to-end. Templates are product-agnostic and use {{TOKEN}} placeholders the skill prompts the user to fill.
writing-tech-post
IncludedAuthors engineering blog posts end-to-end: launch deep-dives, incident postmortems, architecture migrations, performance case studies, tutorials, AI/agent system writeups, security disclosures, and research-to-product translations. Picks the correct archetype, plans the abstraction ladder, enforces an evidence cadence (diagrams, benchmarks, profiles, traces, code, ablations), tunes voice against publisher house styles (Datadog, Vercel, GitHub, AWS, Meta, Cloudflare, Jane Street), and runs a pre-publish gate for narrative momentum and disclosure ethics. Use when drafting a new engineering post, restructuring a draft that feels flat, deciding which evidence form belongs where, validating that depth and product context are balanced, or preparing a postmortem, migration, or performance narrative for external publication. Do not use for API reference documentation, README authoring, marketing copy, release notes, generic SEO content, ghost-written executive thought leadership, or non-engineering long-form essays.
blog-google
IncludedGoogle API integration for blog performance: PageSpeed Insights, CrUX Core Web Vitals with 25-week history, Search Console performance, URL Inspection, Indexing API, GA4 organic traffic, NLP entity analysis for E-E-A-T, YouTube video search for embedding, and Google Ads Keyword Planner. Progressive feature availability based on credential tier (API key, OAuth/service account, GA4, Ads). Shares config with claude-seo at ~/.config/claude-seo/google-api.json. Use when user says "google data", "page speed", "core web vitals", "search console", "indexation", "GA4", "keyword research", "nlp entities", "blog performance", "youtube search", "google api setup".