pp2p
Skill1 starsChanged 5 months agoMITView on GitHub
Performs two perfection passes plus polish for moderate code refinement with cleanup. Triggers on pp2p or two-pass polish requests.
We split this skill into the rules it gives an agent
23 rules. About 0 are common, 17 are distinctive, and 6 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.
6
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 (create the dir if needed) …
- Very specific: line 135
Read CLAUDE.md, any *ground*truth* / hardware / stack notes in the repo, and whatever the user has already said is running.
- Distinctive: line 143
If you don't have enough info to verify (e.g., the doc claims a runtime version and nothing records it), say "needs verification via …
- Distinctive: line 173
After all agents return:
- Distinctive: line 177
If surviving issues == 0 AND early exit enabled (default): skip remaining critique passes and go to Step 7.
- Distinctive: line 184
If an agent returns empty/garbled: log it, continue with other agents' findings
- Distinctive: line 185
If ALL agents fail: STOP, report error, do not continue to next pass
- Distinctive: line 186
Never retry the same agent prompt — adjust focus if re-dispatching
- Distinctive: line 190
After both critique passes (or early exit), run ONE polish pass.
- Distinctive: line 193
Check for DRY violations introduced during fixes
- Distinctive: line 195
Remove dead code or commented-out lines
- Distinctive: line 196
Ensure CLAUDE.md conventions followed
- Distinctive: line 206
All components still well-defined
- Distinctive: line 217
Prefer a committed mutation driver (copy sources to a tempdir, revert one fix, run its selector, assert non-zero exit.
- Distinctive: line 245
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 266
Delete .claude/perfection-pass.local.md BEFORE ending the turn.
- Distinctive: line 271
When you want thorough refinement AND clean code
- Very specific: line 273
NOT for auth/payments/data-integrity-critical work — use /pp3p
- Very specific: line 274
NOT for trivial changes — use /critique (single pass)
≈ “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 x2 + Polish (/pp2p)
Two critique passes (3-4 agents each) + polish + a cross-family review gate. Thorough refinement for moderate-complexity work — the middle rung between /critique (single pass) and /pp3p (mega-hardening for auth/payments/data integrity).
Scoring contract: critics score + verify with a consistent judge rubric. Discrete labels (BLOCKER / HIGH / MEDIUM / NIT), skeptical standalone stance, >=2-of-3 adversarial survival on contested high-stakes findings, stop after 2 flat cycles. Don't invent a per-pass rubric.
Arguments
Parse $ARGUMENTS string:
| Arg | Effect |
--type TYPE | Set review type: code, plan, design, architecture, strategy (auto-detected if omitted) |
--agents "A,B,C" | Custom agent perspectives (defaults are per-type — see Step 5) |
--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 5) |
--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: 15 minutes for the critique passes. If Pass 1 exceeds 10 min elapsed, apply its surviving findings and skip Pass 2. Polish, the mutation gate, and the cross-family gate are EXEMPT from this budget — they 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 4: 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}.md(create the dir if needed) and delete the original. - Gitignore check: append
.claude/*.local.mdto.gitignoreif no existing pattern covers it. The marker carries the full problem + findings and must not ride agit add -Ainto a repo.
Then create:
---
iteration: 2
max_iterations: 2
include_polish: false
polish_done: true
review_type: <detected type from Step 2>
created_at: <ISO timestamp>
---
## Original Problem
[Problem statement from conversation]
## Current Solution
[The solution/files under review]The pass loop runs INLINE (Step 6). 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 5: Select Agent Perspectives
Choose agents by detected type (unless --agents overrides):
For plans (run all 4):
- Completeness — Are all steps defined? Missing prerequisites? Gaps between steps?
- Feasibility — Can each step actually be executed? Unrealistic assumptions?
- Risk & Edge Cases — What could go wrong? What's the fallback?
- Stack-Reality — Every numeric claim, every "X requires Y GB", every "won't fit / can't run / needs X" must be cross-checked against the user's actual stack (CLAUDE.md, hardware/docs notes, what's already running). If the claim contradicts what's already running, flag it. See "Stack-Reality critic instructions" below.
For code:
- Solution-Problem Fit — Does it solve the stated problem?
- Edge Cases & Gaps — What could break?
- Elegance & Simplicity — Can it be simpler?
Auto-add when the change touches PERSISTENCE / STATE (DB schema or writes, migrations, caches, vector stores, agent memory, or files-used-as-state): add a 4th critic (preferred), or replace Elegance with it only when under the time budget. 4. State-Integrity — Does it follow append-only / supersede-never-overwrite (no lossy in-place updates of data that should be historical), provenance on every derived value (no naked numbers), typed history not blurry chunks, HEAD-and-history move atomically, and never silently lose a fact? If the change overwrites state that someone would later ask "what was this before, and why did it change?" about — that's a finding.
For architecture:
- Separation of Concerns — Clean boundaries? Right abstractions?
- Scalability & Evolution — Will this grow well? Paint into corners?
- Integration Risk — Dependencies, coupling, failure modes?
For design:
- User Flow — Is the happy path clear? Dead ends?
- Consistency — Patterns reused? Naming coherent?
- Edge States — Empty, error, loading, overflow handled?
For strategy:
- Goal Alignment — Do actions connect to stated goals?
- Prioritization — Is sequencing justified? Dependencies right?
- Blind Spots — What's not being considered?
Presets (override type-based defaults):
--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.
Critic model — escalate for critical work. Default to a fast/cheap tier for routine refinement; use the strongest available tier for critic agents when the change touches auth/permissions, money movement, migrations, or destructive/irreversible operations (or when --security/--performance presets are active). If the work is squarely in that territory, consider whether it should be a /pp3p run instead.
Stack-Reality critic instructions (use verbatim in agent prompts when this critic fires)
You are the anti-bullshit critic. Your single job: cross-check every numeric and capability claim in the work product against the user's actual stack. Hardware sizing claims, model availability claims, "this requires X", "won't fit", "needs Y to run", repo-state claims, runtime version claims, pricing claims, project-URL claims — all subject.
Process:
- Read CLAUDE.md, any
*ground*truth*/ hardware / stack notes in the repo, and whatever the user has already said is running. These exist specifically because models keep getting stack facts wrong. - Skim the work product. Highlight every:
- Number (GB, MB, $, %, count, version)
- "Won't fit" / "can't run" / "needs X" / "requires Y"
- Model/repo/tool name asserted as available or unavailable
- Architecture claim about the user's machines
- Pricing / project URL / vendor state assertion
- For each, verify against those notes + current state (
which, package versions,nvidia-smi/sysctl/unameas relevant). If the notes or live state say the model/tool is already running, ANY "won't fit / can't run" claim is wrong — the correct framing is "fits at quant Y; speed Z is the real ceiling" or similar. - If you don't have enough info to verify (e.g., the doc claims a runtime version and nothing records it), say "needs verification via $command" rather than letting the claim stand.
Output: for each problem found, give:
- Quote (exact text from the work product)
- What's wrong (what reality contradicts the claim)
- Source of the contradiction (which file, which line, or which command output)
- Corrected framing (what the doc should say instead)
Severity: any claim that contradicts known ground truth is HIGH severity, even if cosmetic — these are exactly the errors that propagate into downstream decisions.
Step 6: Run Pass Loop (2 passes)
For each pass (1, 2):
6a: Dispatch Critique Agents
Spawn one agent per selected critic — 3 for most types, 4 when the plan set or a persistence auto-add applies.
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."
6b: Verify, Then Apply
After all agents return:
- Count raw issues across agents
- Adversarial verify gate. Critic passes carry a measured ~20-30% false-positive rate at Pass 1. Take each HIGH/BLOCKER finding and try to refute it: re-read the actual code/diff, and for anything non-obvious, default to "not a real issue unless proven." A finding survives only if you can point to the 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 7. 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
6c: 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 7: Polish Pass
After both 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 7.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.
When it fires: the change includes or depends on automated tests (a new suite, new test cases, or a behavior guarded only by tests). Skip 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.
What to do:
- 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 pp2p summary alongside the cross-family verdict.
Step 8: Cross-family Final Gate — LOOP until convergence
After polish completes, get an independent second opinion from a different model family than the one running this pass. If the Codex plugin is available, use /codex:review. Otherwise dispatch one review to GPT / Gemini / Grok / whatever isn't the session model. Do not hardcode a version — it rots.
This is a LOOP, not a single shot. A cross-family reviewer's first pass routinely surfaces the next layer once the first is fixed — keep combing until it comes back clean:
repeat (cap = 3 cross-family passes):
run the reviewer on the LATEST committed/working state
├─ BLOCKER / HIGH returned → adjudicate each (fix it, OR refute it on merit
│ and document why), then LOOP (run again)
├─ only NITs → apply inline or log as follow-up, then one more pass to
│ confirm (the confirming pass counts toward the cap)
└─ no new blockers → CONVERGED → proceed to report
if still flagging blockers at the cap → STOP, document residuals + escalate to the userRules for the loop:
- Each pass reviews the newest state, so fixes from pass N are themselves reviewed in pass N+1 (no fix ships unreviewed).
- Adjudicate, don't auto-accept. A finding is either fixed or refuted on merit with a one-line reason. Disagreeing with the reviewer is allowed and expected.
- Hold the scope line. Adversarial review widens its net each pass; when a finding is real but a different invariant / pre-existing / separate subsystem, document it as a follow-up rather than letting it balloon the change. Convergence means "no new blockers in scope," not "the reviewer ran out of opinions."
- A different model family catches what self-critique misses — that's the whole point of looping it.
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 9: Report & Archive
- Print final summary:
PP2P Complete
Pass 1: X raw → X' surviving → applied
Pass 2: Y raw → Y' 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'+N pass/polish improvements (mutation + cross-family fixes counted on their own lines)- Archive report to
.claude/perfection-passes/pp2p_{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
- Moderate complexity features
- When you want thorough refinement AND clean code
- Balance between speed and quality
- NOT for auth/payments/data-integrity-critical work — use
/pp3p - NOT for trivial changes — use
/critique(single pass)
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
- pp3pSkill
- 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.

