pp3p
Skill1 starsChanged 5 months agoMITView on GitHub
Performs three perfection passes plus polish for maximum code refinement with cleanup. Triggers on pp3p or three-pass polish requests.
We split this skill into the rules it gives an agent
21 rules. About 0 are common, 17 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈17
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 41
Scope guard: If target is >15 files, ask user to narrow scope.
- Very specific: line 45
If --type not specified, auto-detect from content:
- Distinctive: line 55
Read CLAUDE.md if present (extract code quality rules, patterns — max 50 lines).
- Distinctive: line 56
Run git log --oneline -5 for pattern awareness.
- Very specific: line 63
Stale-marker check: if the file already exists, copy it to .claude/perfection-passes/stale-{YYYYMMDD-HHMMSS}.md and delete the original.
- Distinctive: line 149
After all agents return:
- Distinctive: line 153
If surviving issues == 0 AND early exit enabled (default): skip remaining critique passes and go to Step 6.
- Distinctive: line 160
If an agent returns empty/garbled: log it, continue with other agents' findings
- Distinctive: line 161
If ALL agents fail: STOP, report error, do not continue to next pass
- Distinctive: line 162
Never retry the same agent prompt — adjust focus if re-dispatching
- Distinctive: line 166
After all critique passes (or early exit), run ONE polish pass.
- Distinctive: line 169
Check for DRY violations introduced during fixes
- Distinctive: line 171
Remove dead code or commented-out lines
- Distinctive: line 172
Ensure CLAUDE.md conventions followed
- Distinctive: line 182
All components still well-defined
- Distinctive: line 190
Prefer a committed mutation driver (copy sources to a tempdir, revert one fix, run its selector, assert non-zero exit.
- Distinctive: line 213
Hold the scope line: When a finding is real but a *different invariant / pre-existing / separate subsystem*, document it as a follow-up …
- Distinctive: line 217
If no second model family is available, say so in the report and skip this gate rather than pretending a same-family re-read counts.
- Very specific: line 239
Delete .claude/perfection-pass.local.md BEFORE ending the turn.
- Distinctive: line 246
When you want maximum confidence + clean code
- Very specific: line 247
NOT for trivial changes — use /critique (single pass) instead
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Perfection Pass x3 + Polish (/pp3p)
Three critique passes (3-5 agents each) + polish. Maximum refinement.
Scoring contract: critique + verify with the same judge rubric as pp2p (BLOCKER / HIGH / MEDIUM / NIT, skeptical standalone stance, >=2-of-3 adversarial survival on contested high-stakes findings). Same contract as the cross-family review, so verdicts are comparable across passes and across AIs.
Arguments
Parse $ARGUMENTS string:
| Arg | Effect |
--type TYPE | Review type: code, plan, design, architecture, strategy (auto-detected if omitted) |
--agents "A,B,C" | Custom agent perspectives (defaults are per-type — see Step 4) |
--security | Preset: Solution-Fit, Security, Edge Cases |
--performance | Preset: Solution-Fit, Performance, Elegance |
--api | Preset: Solution-Fit, API Design, Edge Cases |
--stack-reality | Stack-Reality critic on its own — fact-check a doc/plan against known stack state (solo mode, see Step 4) |
--sequential | Agents see each other's findings (slower but more coherent) |
--no-early-exit | Disable early exit on convergence |
--files "path1,path2" | Explicit file targets (skip context detection) |
Time budget: 20 minutes for the critique passes. If elapsed time exceeds 15 min after ANY pass, skip the remaining critique passes and go to polish. Polish, the mutation gate, and the cross-family gate are EXEMPT from this budget — for pp3p they are non-negotiable and always run.
Step 1: Verify Context
Identify what to refine. Check in order:
--filesargument → Read those files- Recent code changes in conversation context
- Uncommitted changes:
git diff --name-only→ if files exist, confirm with user - Nothing found → ask user:
"Nothing to refine. Point me to files or paste code/plan to review."
Then STOP.
Scope guard: If target is >15 files, ask user to narrow scope.
Step 2: Detect Review Type
If --type not specified, auto-detect from content:
- Contains code / function definitions →
code - Markdown with headers, no code →
plan - Discusses components, interfaces, modules →
architecture - UI/UX flows, wireframes →
design - Goals, priorities, sequencing →
strategy - Default:
code
Step 3: Gather Context
Read CLAUDE.md if present (extract code quality rules, patterns — max 50 lines).
Run git log --oneline -5 for pattern awareness.
Step 3.5: Create Run Marker
The marker lives at .claude/perfection-pass.local.md in the project git root. Skip it if cwd is outside a project.
Before creating:
- Stale-marker check: if the file already exists, copy it to
.claude/perfection-passes/stale-{YYYYMMDD-HHMMSS}.mdand delete the original. - Gitignore check: append
.claude/*.local.mdto.gitignoreif no existing pattern covers it.
Then create:
---
iteration: 3
max_iterations: 3
include_polish: false
polish_done: true
review_type: <detected type from Step 2>
created_at: <ISO timestamp>
---
## Original Problem
[Problem statement]
## Current Solution
[The solution/files under review]The pass loop runs INLINE (Step 5). The marker is a crash record, not a chaining mechanism. Append each pass's findings to the body as you go — but ONLY inside fenced code blocks. A bare --- line or a column-0 key: line in the body corrupts YAML frontmatter parsers.
Step 4: Select Agents
Choose base agents by type (unless --agents overrides):
code:
- Solution-Problem Fit — Does it solve the stated problem correctly?
- Edge Cases & Gaps — What inputs/states could break it?
- Elegance & Simplicity — Can it be simpler without losing correctness?
- State-Integrity (auto-add when the change touches persistence/state — DB schema/writes, migrations, caches, vector stores, agent memory, files-as-state): check append-only / supersede-never-overwrite / provenance-on-derived-values / atomic-HEAD-and-history / never-silently-lose-a-fact. For
pp3p(used on data integrity), this critic is mandatory whenever data is touched.
plan:
- Completeness — All steps defined? Missing prerequisites? Gaps?
- Feasibility — Can each step be executed? Unrealistic assumptions?
- Risk & Edge Cases — What could go wrong? Fallbacks?
architecture:
- Separation of Concerns — Clean boundaries? Right abstractions?
- Scalability & Evolution — Will this grow well?
- Integration Risk — Dependencies, coupling, failure modes?
design:
- User Flow — Happy path clear? Dead ends?
- Consistency — Patterns reused? Naming coherent?
- Edge States — Empty, error, loading, overflow?
strategy:
- Goal Alignment — Actions connect to stated goals?
- Prioritization — Sequencing justified?
- Blind Spots — What's not being considered?
Stack-Reality (MANDATORY for pp3p, EVERY type) — append this critic to whatever set the type or preset selects. The anti-bullshit critic: cross-check every numeric/capability/version/pricing/repo-state claim against CLAUDE.md, stack notes, and current state. Any claim contradicting known ground truth is HIGH severity. Use the verbatim critic instructions in the pp2p skill ("Stack-Reality critic instructions") — they are canonical; do not paraphrase. pp3p guides high-stakes downstream work, so it needs this pass at least as much as pp2p does.
Presets (override type defaults; Stack-Reality is still appended):
--security: Solution-Fit, Security, Edge Cases--performance: Solution-Fit, Performance, Elegance--api: Solution-Fit, API Design, Edge Cases--stack-reality: solo mode — run ONE pass of the lone Stack-Reality critic with the verify gate as usual, then report. Skip polish, the mutation gate, and the cross-family loop unless its findings triggered actual edits — this is a fact-check, not a refinement run.
Step 5: Run Pass Loop (3 passes)
For each pass (1, 2, 3):
5a: Dispatch Critique Agents
Spawn one agent per selected critic — 4 for most types (base 3 + mandatory Stack-Reality), 5 when the persistence auto-add applies.
Critic model — escalate for critical work. pp3p is used on auth, payments, and data integrity; its critics are the last line before such code ships. Default to a fast/cheap tier for routine refinement; use the strongest available tier for the critic agents when the change touches auth/permissions, money movement, migrations, or destructive/irreversible operations (or when --security/--performance presets are active). The cheapest critic on the most critical pass is a false economy.
Parallel (default): Launch all simultaneously.
Sequential (--sequential): Launch one at a time, each sees prior findings.
Each agent prompt MUST include:
- The current solution (full text or file contents)
- The original problem statement
- Project context (CLAUDE.md excerpt)
- Their specific critique focus
- Instruction: "Return a numbered list of specific, actionable issues. If no issues found, return NONE."
5b: Verify, Then Apply
After all agents return:
- Count raw issues across agents
- Adversarial verify gate. Critic passes carry a measured false-positive rate (~20-30% Pass 1, ~5-10% Pass 3). Try to refute each HIGH/BLOCKER finding against the actual code — a finding survives only with an exact line + a concrete failure it causes; drop the rest with a one-line reason. On contested high-stakes findings (auth/payments/data), escalate to a pass@K consensus (sample the critic 3x, keep findings appearing in >=2 runs) rather than a single refute.
- Print summary:
Pass N: X raw → Y surviving (per-agent: ...) - If surviving issues == 0 AND early exit enabled (default): skip remaining critique passes and go to Step 6. Early exit skips CRITIQUE passes only — polish, the mutation gate, and the cross-family gate still run before the report.
- Synthesize surviving findings into concrete improvements
- Apply improvements (Edit files or revise solution); append findings + dropped-at-gate reasons to the run marker (inside fenced code blocks)
- Continue to next pass with the UPDATED solution
5c: Error Handling
- If an agent returns empty/garbled: log it, continue with other agents' findings
- If ALL agents fail: STOP, report error, do not continue to next pass
- Never retry the same agent prompt — adjust focus if re-dispatching
Step 6: Polish Pass
After all critique passes (or early exit), run ONE polish pass.
For code: Review modified files yourself (no subagent needed):
- Check for DRY violations introduced during fixes
- Verify naming consistency
- Remove dead code or commented-out lines
- Ensure CLAUDE.md conventions followed
- Apply non-controversial cleanups
For plan: Re-read full plan, check for:
- Ambiguous language introduced during revisions
- Missing details in newly added steps
- Consistent formatting
For design/architecture: Re-read full document, check for:
- Internal consistency after changes
- All components still well-defined
- No contradictions introduced
Step 6.5: Mutation gate — "test the tests" (when the change adds/relies on a test suite)
A green test suite proves nothing until you prove it would go RED on a real bug. Mandatory for pp3p whenever the change includes or depends on automated tests. Skip only for pure-doc / config-only changes. On an early-exit run where no fixes were applied, mutate the pre-existing behaviors the suite guards, or mark N/A. pp3p is used on auth/payments/data integrity, so a green suite you haven't falsified is exactly the kind of false confidence this pass exists to kill.
- For each behavior the suite claims to cover, revert the fix / inject the bug in a throwaway copy and run the matching test. Assert it fails. A mutation that survives (test stays green against broken code) is a test gap — fix the test, not the code. The classic survivor is a test that reimplements the logic inline instead of calling the real function — extract the function and call it.
- Prefer a committed mutation driver (copy sources to a tempdir, revert one fix, run its selector, assert non-zero exit; flag STALE when the target string moved so it can't silently rot) over one-off manual mutation — it stays a regression asset.
- Report
N/N mutations caught. Anything less than 100% is a gap to close before the cross-family gate.
Receipt: "X tests · Y/Y mutations caught" belongs in the pp3p summary alongside the cross-family verdict.
Step 7: Cross-family Adversarial Review
After polish, get an independent second opinion from a different model family than the one running this pass, framed adversarially — it challenges the chosen implementation, design tradeoffs, and assumptions (not just defect hunting). If the Codex plugin is available, use /codex:adversarial-review. Otherwise dispatch one adversarial review to GPT / Gemini / Grok / whatever isn't the session model. Do not hardcode a version.
LOOP until convergence (this is the non-negotiable final gate for pp3p):
repeat (cap = 3 cross-family passes):
run adversarial review on the LATEST state
├─ BLOCKER / HIGH → adjudicate each (fix it, OR refute on merit + document why), then LOOP
├─ only NITs → apply inline / log as follow-up, then one more pass to
│ confirm (the confirming pass counts toward the cap)
└─ no new blockers → CONVERGED → archive
if still flagging at the cap → STOP, document residuals + escalate to the user- Each pass reviews the newest state — no fix ships unreviewed.
- Adjudicate, don't auto-accept. Fixed, or refuted with a one-line reason. For data-integrity work, validate fixes against a real datastore where possible, not just types/tests.
- Hold the scope line. When a finding is real but a different invariant / pre-existing / separate subsystem, document it as a follow-up instead of ballooning the change. Convergence = "no new blockers in scope."
A different model family catches issues self-critique can miss. Mandatory for pp3p given its use on critical implementations (auth, payments, data integrity).
If no second model family is available, say so in the report and skip this gate rather than pretending a same-family re-read counts.
Step 8: Report & Archive
- Print final summary:
PP3P Complete
Pass 1: X raw → X' surviving → applied
Pass 2: Y raw → Y' surviving → applied (or: skipped — converged / time budget)
Pass 3: Z raw → Z' surviving → applied (or: skipped — converged / time budget)
Polish: N cleanups applied
Mutation gate: Y/Y mutations caught (or: N/A — no test suite)
Cross-family: converged in K pass(es) (or: skipped — no second family available)
Total: X'+Y'+Z'+N pass/polish improvements (mutation + cross-family fixes counted on their own lines)- Archive report to
.claude/perfection-passes/pp3p_{topic}_{YYYYMMDD-HHMMSS}.md(timestamped so same-day reruns never overwrite) containing:- Original problem
- Issues found per pass (including findings dropped at the verify gate)
- Final solution state
- Delete
.claude/perfection-pass.local.mdBEFORE ending the turn.
When to Use
- Critical implementations (auth, payments, data integrity)
- Complex architectural decisions
- Work guiding significant downstream effort
- When you want maximum confidence + clean code
- NOT for trivial changes — use
/critique(single pass) instead
Total Effort
- 3 passes x 4-5 agents = 12-15 agent critiques (base 3 per type + mandatory Stack-Reality, + State-Integrity when data is touched)
- 1 polish pass (self-review, no subagents)
- 1 mutation gate (falsify the tests — mandatory when a suite is in play)
- 1 cross-family adversarial review (looped to convergence)
- Total: 12+ agent perspectives + polish + mutation gate + cross-family challenge
In this repository54 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/deep-recon/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adversarial-researchSkill
- algorithmic-artSkill
- api-integrationSkill
- breakdownSkill
- c4-architectSkill
- canvas-designSkill
- coding-agentsSkill
- compound-engineeringSkill
- context-budgetSkill
- counterfactualSkill
- critiqueSkill
- d3js-visualizationSkill
- data-analyst-agentSkill
- database-migrationsSkill
- deep-reconSkill
- design-tasteSkill
- doc-coauthoringSkill
- e2b-sandboxSkill
- ecosystem-auditSkill
- excalidraw-diagramSkill
- executing-plansSkill
- frontend-designSkill
- fullstack-agentSkill
- grillSkill
- kickoffSkill
- mcp-builderSkill
- model-migrationSkill
- naming-the-machineSkill
- full-output-enforcementSkill
- package-researchSkill
- pdf-generationSkill
- pp2pSkill
- prompt-engineerSkill
- prompt-groundingSkill
- redesignSkill
- requesting-code-reviewSkill
- reverse-engineer-to-learnSkill
- review-changesSkill
- scratchpadSkill
- shipSkill
- slack-gif-creatorSkill
- sprint-architectSkill
- techdebtSkill
- test-and-fixSkill
- threat-modelSkill
- verification-before-completionSkill
- visual-verdictSkill
- webapp-testingSkill
- web-asset-generatorSkill
- whatdidimissSkill
- writing-plansSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

