Codex compatibility note:
- Invoke repository skills with
$skill-name in Codex; this mirrored copy rewrites legacy Claude /skill-name references.
- Task tracker mandate: BEFORE executing any workflow or skill step, create/update task tracking for all steps and keep it synchronized as progress changes.
- User-question prompts mean to ask the user directly in Codex.
- Ignore Claude-specific mode-switch instructions when they appear.
- Strict execution contract: when a user explicitly invokes a skill, execute that skill protocol as written.
- Subagent authorization: when a skill is user-invoked or AI-detected and its protocol requires subagents, that skill activation authorizes use of the required
spawn_agent subagent(s) for that task.
- Do not skip, reorder, or merge protocol steps unless the user explicitly approves the deviation first.
- For workflow skills, execute each listed child-skill step explicitly and report step-by-step evidence.
- If a required step/tool cannot run in this environment, stop and ask the user before adapting.
Codex Project-Reference Loading (No Hooks)
Codex uses static project-reference loading instead of runtime-injected project docs.
When coding, planning, debugging, testing, or reviewing, open project docs explicitly using this routing.
Always read:
docs/project-config.json (project-specific paths, commands, modules, and workflow/test settings)
docs/project-reference/docs-index-reference.md (routes to the full docs/project-reference/* catalog)
docs/project-reference/lessons.md (always-on guardrails and anti-patterns)
Missing/stale context route: If docs/project-config.json, the docs index, lessons.md, CLAUDE.md, AGENTS.md, or any task-required reference doc is missing or stale, auto-run $project-init or the narrow setup route ($project-config, $docs-init, $scan-all, $scan --target=<key>, $claude-md-init) before ordinary project-specific work. If Codex mirrors or AGENTS.md are missing/stale, ask the user to run $sync-codex; do not auto-run it.
Situation-based docs:
- Project structure/architecture/tech-stack/deployment/setup (any layer — backend, frontend, or infra):
project-structure-reference.md
- Backend/CQRS/API/domain/entity changes:
backend-patterns-reference.md, domain-entities-reference.md
- Frontend/UI/styling/design-system:
frontend-patterns-reference.md, scss-styling-guide.md, design-system/README.md
- Spec authoring,
docs/specs/ pathing, or TC format: feature-spec-reference.md, spec-system-reference.md, spec-principles.md
- Behavior/public-contract changes or spec-test-code sync:
workflow-spec-test-code-cycle-reference.md plus the spec docs above
- Derived spec indexes/ERDs/reimplementation guides:
spec-system-reference.md and source Feature Specs under docs/specs/
- Integration test implementation/review:
integration-test-reference.md
- E2E test implementation/review:
e2e-test-reference.md
- Code review/audit work:
code-review-rules.md plus domain docs above based on changed files
Do not read all docs blindly. Start from docs-index-reference.md, then open only relevant files for the task.
[BLOCKING] Execute skill steps in declared order. NEVER skip, reorder, or merge steps without explicit user approval.
[BLOCKING] Before each step or sub-skill call, update task tracking: set in_progress when step starts, set completed when step ends.
[BLOCKING] Every completed/skipped step MUST include brief evidence or explicit skip reason.
[BLOCKING] If Task tools are unavailable, create and maintain an equivalent step-by-step plan tracker with the same status transitions.
Quick Summary
Goal: Block shipping an unproven fix — adopt a SKEPTIC's stance and try to DISPROVE the fix first, then build a code proof trace (like a debugger stack trace) for each change with confidence percentages, so every code change carries a file:line evidence chain that survived a genuine refutation attempt and a fix ships only when its correctness is proven (≥80%), never assumed.
Summary:
- Purpose / default stance is SKEPTIC, not validator — find why the fix is WRONG or INCOMPLETE, never confirm it works. Skill name ("prove-fix") + post-
$fix context + points rubric all bias toward confirmation; the Adversarial Verification Mindset forces a reset so confidence is earned by surviving attack, not awarded for coherence.
- The 5 main steps (run in order, NEVER skip): (1) Change Inventory — list EVERY change (file:line, before/after, type: root-cause/secondary/defensive/cleanup); (2) Proof Trace per change — stack-trace chain symptom → trigger path → root cause → fix mechanism → why-correct → refutation attempt → related paths → edge cases → side effects, every arrow
file:line; (3) Confidence Scoring — points rubric + SKEPTIC caps; (4) Cross-Verification — Anti-Bias Gate FIRST, then interaction/completeness/regression/dependency/performance (paging+index DB protocol); (5) Final Verdict + Goal Satisfaction update.
- Runs AFTER
$fix (NEVER before) — the non-negotiable verification gate between $fix and $code-simplifier; ≥80% ship · 60-79% flag · <60% BLOCK (route back to $debug-investigate or $fix).
- For EACH change, run a Refutation Pass FIRST (strongest case the fix is wrong/incomplete: counter-cases, unclosed feeder paths, wrong layer, regression risk, "test passes for the wrong reason") before scoring — an un-attacked change cannot exceed 79%.
- Trace ALL related things — every caller, consumer, sibling/alternate path, feeder path, downstream dependent, shared-state writer the change touches; an un-enumerated related path is an unproven path and caps confidence below 80%. — why: the reproduction exercises one path; the bug survives through paths you never traced.
- Score with the points rubric (root cause +25, fix mechanism +20, pattern precedent +15, framework +10, edge cases +5 each, side effects +10, no regressions +5); pattern precedent (1+ working example), edge cases (error/null/concurrent), survived refutation, and spec-loop evidence (property TC + mutation-kill + Dual-Feedback) are REQUIRED, not optional.
- Map every fix part to a primary/contributing/latent root cause from the hypothesis matrix and prove ALL feeder paths closed; finish with the Anti-Bias Gate + cross-change checks + final verdict, then resolve the active Goal Contract (map each proof trace to its success criterion, emit the PASS/FAIL/BLOCKED matrix) — a SHIP verdict does NOT close work while any required criterion remains FAIL.
Workflow:
- Inventory — List every code change made by the fix (file:line, before/after)
- Trace + Refute — For each change, build a proof chain (symptom → root cause → fix) AND run a refutation pass that tries to break it before believing it
- Score — Assign confidence percentage per change with evidence; confidence is earned by surviving refutation, not awarded for coherence
- Verify — Anti-Bias Gate + cross-check fix against edge cases, side effects, and ALL related paths
- Verdict — Overall fix confidence and any remaining risks
Key Rules:
- Default stance is SKEPTIC, not validator — actively try to DISPROVE each change before scoring it; "looks correct" is the bias this gate exists to break
- Every claim MUST ATTENTION have
file:line evidence — no exceptions
- Each change gets its OWN proof trace, refutation pass, and confidence score
- A change that has not been genuinely attacked (refutation pass) cannot exceed 79%
- If ANY change scores below 80%, flag it and recommend additional investigation
- Always run this proof-trace step after
$fix — non-negotiable, never skip it
Frontend/UI Context (if applicable)
When this task involves frontend or UI changes,
- Component patterns:
docs/project-reference/frontend-patterns-reference.md
- Styling/BEM guide:
docs/project-reference/scss-styling-guide.md
- Design system tokens:
docs/project-reference/design-system/README.md
Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence percentages (Idea should be more than 80%).
Prove Fix
Post-fix verification skill building evidence-based proof chains for every code change. A code debugger's stack trace, but for proving WHY a fix is correct.
When to Use
- After
$fix in bugfix, hotfix, or any fix workflow
- After applying code changes that fix a reported bug
- Verify fix correctness before review/commit
When NOT to Use
- Before fix applied (use
$debug-investigate instead)
- New feature verification (use
$test instead)
- Code quality review (use
$code-review instead)
Adversarial Verification Mindset (NON-NEGOTIABLE)
Default stance: SKEPTIC, not validator. Your job is to prove the fix is WRONG or INCOMPLETE — and only conclude it is correct when every attack fails.
Confirmation-bias trap (acute for THIS skill): The skill is literally named "prove-fix", you arrive immediately after $fix (you may have written the fix yourself), and the scoring rubric awards points for verified items — three forces that all pull toward confirming the fix works. A reviewer who already endorsed the fix cannot also be its skeptic without a forced reset. This section is that reset. — why: "build a proof FOR X" silently becomes "find reasons X is right"; real verification is "try to break X and report what survived".
Reframe the goal: Do NOT set out to demonstrate the fix is correct. Set out to demonstrate it is BROKEN. Confidence is whatever is left standing after a genuine attempt to break it — never a tally of agreements.
Refutation Techniques (apply ALL per change before scoring)
| Technique |
Think (try to make the fix FAIL) |
| Counter-case hunt |
Find ONE input/state/timing where the "fixed" code still produces the symptom. If you cannot, prove the input domain is exhausted — don't assume it. |
| Test-passes-for-wrong-reason |
Does the regression test pass because the fix is correct, or because the test is weak (asserts the example, not the invariant; mocks away the bug; never executes the fixed line)? |
| Unclosed feeder path |
Name every OTHER producer/caller/event/job/cache that can write the observed final state. Did the fix close ALL of them, or just the one you reproduced? |
| Wrong-layer challenge |
Argue the fix patches a symptom site, not the invariant owner. Would the bug recur through a sibling path that bypasses this fix? |
| Regression injection |
Assume the fix introduced a NEW bug. Where would it be? (changed scope, broadened catch, altered ordering, new query without paging/index.) |
| Steel-man "no fix" |
Argue the original code was actually correct and the real bug is elsewhere. If that argument has any legs, the root cause is unproven. |
| Contrarian verdict |
Before writing the score, argue in 2 sentences that this change should be BLOCKED. Then choose the stronger of ship-vs-block. |
Forbidden Patterns
| Forbidden |
Required correction |
| "Fix is obviously correct" |
Obviousness is the illusion this gate breaks. Run the refutation pass anyway. |
| "Reproduction test passes → proven" |
A passing example ≠ a closed invariant. Attack the test before trusting it. |
| Award points for coherence |
Points require survived attack, not a plausible-sounding chain. |
| "I wrote the fix, I know it works" |
Author ≠ reviewer. Reset to skeptic; attack your own change hardest. |
| Stop at the path you reproduced |
Enumerate ALL feeder/related paths; an un-attacked path is an unproven path. |
Anti-Bias Gate (MANDATORY before any SHIP/SHIP-WITH-CAVEATS verdict)
Complete ALL of these — per change — before writing the final verdict (MUST ATTENTION):
Any box unchecked → verification is NOT complete; confidence is capped at 79% (flag, do not ship). NEVER round an un-refuted change up to 80%.
Step 1: Change Inventory
List ALL changes made by the fix. For each change, document:
CHANGE #N: [short description]
File: [path/to/file.ext]
Lines: [start-end]
Before: [code snippet — the broken version]
After: [code snippet — the fixed version]
Type: [root-cause-fix | secondary-fix | defensive-fix | cleanup]
Change types:
- root-cause-fix — Directly addresses the root cause of the bug
- secondary-fix — Fixes a related issue discovered during investigation
- defensive-fix — Prevents the same class of bug from recurring
- cleanup — Removed dead code or simplified logic (no behavior change)
Step 2: Proof Trace (per change)
For EACH change, build a stack-trace-style proof chain — the core of the skill.
Proof Trace Format
PROOF TRACE — Change #N: [description]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SYMPTOM (what the user sees):
→ [Observable behavior, e.g., "UI doesn't refresh after assigning PIC"]
TRIGGER PATH (how the symptom occurs):
1. [file:line] User action → [method/event]
2. [file:line] → calls [method]
3. [file:line] → dispatches [action/event]
4. [file:line] → handler/effect [name]
5. [file:line] ← BUG HERE: [exact broken behavior]
ROOT CAUSE (proven):
→ [One sentence: what exactly is wrong and why]
→ Evidence: [file:line] shows [specific code proving the bug]
→ Hypothesis matrix mapping: RC-[N] status [primary/contributing/latent] from [report path/section]
→ Feeder paths closed: [path names or "single path verified"]; unresolved paths: [none/list]
FIX MECHANISM (how the change fixes it):
→ [One sentence: what the fix does differently]
→ Before: [broken code path with file:line]
→ After: [fixed code path with file:line]
→ Owning fix layer: [layer/component] — why this is the lowest shared owner
WHY THIS FIX IS CORRECT:
→ [Reasoning backed by code evidence]
→ Pattern precedent: [file:line] shows same pattern working elsewhere
→ Framework behavior: [file:line or doc reference] confirms expected behavior
→ Forward convergence: [origin/trigger] -> [corrected transformations] -> [observed final output no longer stale/wrong]
RELATED PATHS TRACED (all related things — none left un-attacked):
→ Callers/consumers of changed symbol: [file:line list] — [each unaffected/updated, with evidence]
→ Other feeder paths that write the final state: [file:line list] — [each closed / explicitly unverified]
→ Sibling/alternate paths (retry, async, cache, background, alternate UI/API): [file:line] — [status]
→ Downstream dependents (graph trace --direction downstream when graph.db exists): [evidence]
REFUTATION ATTEMPT (try to break it — REQUIRED before scoring):
→ Strongest counter-case attempted: [input/state/timing] → [why it does NOT reproduce, with file:line]
→ Test attacked: [does the regression test fail on un-fixed code? assert invariant or just the example?] — [file:line]
→ Wrong-layer challenge: [strongest argument this is a symptom patch] → [rebuttal with file:line, or CONCEDED]
→ New-regression hunt: [most plausible bug the change could introduce] → [ruled out with file:line, or OPEN]
→ Contrarian verdict (2 sentences arguing BLOCK): [...] → [why ship still wins, or why it does not]
→ Survived attack? [YES — all attacks failed / NO — finding(s): ...]
EDGE CASES CHECKED:
→ [edge case 1]: [verified/not-verified] — [evidence]
→ [edge case 2]: [verified/not-verified] — [evidence]
SIDE EFFECTS:
→ [None / List of potential side effects with evidence]
CONFIDENCE: [X%] (earned by surviving the refutation pass, NOT by tallying agreements)
Survived attacks: [list of attacks attempted that failed to break the fix]
Verified: [list of verified items]
Not verified / un-attacked: [list of unverified items — each caps confidence below 80%]
Proof Trace Rules
- Every arrow (→) MUST ATTENTION have a
file:line reference — no exceptions
- TRIGGER PATH must be traceable — someone should be able to follow it step-by-step in the code
- REFUTATION ATTEMPT is REQUIRED and must be GENUINE — you MUST try to break the fix (counter-case, weak-test, wrong-layer, new-regression, contrarian) before scoring. A trace with an empty or token refutation pass is INCOMPLETE and caps confidence at 79%. Default to "broken until proven otherwise", not "correct until disproven".
- RELATED PATHS must be fully traced ("all related things") — enumerate every caller, consumer, sibling/alternate path, feeder path, downstream dependent, and shared-state writer the change touches; an un-enumerated related path is an unproven path and caps confidence below 80%.
- Hypothesis matrix mapping is REQUIRED for bugfixes — every fix part maps to a primary/contributing/latent root cause or is flagged as unrelated scope
- Feeder paths must be accounted for — prove the fix closes every path that can write the final observed state, or explicitly list remaining unverified paths
- Pattern precedent is REQUIRED — find at least 1 working example of the same pattern elsewhere in the codebase
- Edge cases MUST ATTENTION be enumerated — at minimum: error path, null/empty input, concurrent access
- Side effects MUST ATTENTION be assessed — what else could this change affect?
- The regression test MUST be attacked, not trusted — confirm it FAILS on the un-fixed code and asserts the protected invariant (not just the reproduction example, not a mock that hides the bug, and the fixed line actually executes). A test you did not try to break is not evidence.
- Spec-loop evidence is REQUIRED for a complete proof (canonical:
SYNC:spec-loop-discipline) — the proof MUST carry, with file:line: (a) the regression property TC guarding the fixed invariant — a universally-quantified property ("for ALL inputs in {domain}, {invariant} holds") + boundary counter-case, not just the reproduction example; (b) mutation-kill evidence for the fixed core-logic line — show a surviving mutant on that line is now killed (MUTATION-SCORE bar, not line-coverage %); (c) a Dual-Feedback entry — the spec rule restored/added AND the guarding test that feeds it back. A proof trace missing any of (a)/(b)/(c) is INCOMPLETE — cap its confidence below the 80% ship threshold until the spec-loop evidence is supplied.
Step 3: Confidence Scoring
Each change gets an individual confidence score:
| Score |
Meaning |
Action Required |
| 95-100% |
Full proof trace complete, all edge cases verified, pattern precedent found |
Ship it |
| 80-94% |
Main proof trace complete, some edge cases unverified |
Ship with caveats noted |
| 60-79% |
Proof trace partial, some links unverified |
Flag to user — recommend additional investigation |
| <60% |
Insufficient evidence |
BLOCK — do not proceed until evidence gathered |
Scoring Criteria
Award points for each verified item:
| Criterion |
Points |
Evidence Required |
| Root cause identified with file:line |
+25 |
Code reference |
| Fix mechanism explained with before/after |
+20 |
Code diff |
| Pattern precedent found in codebase |
+15 |
Working example at file:line |
| Framework behavior confirmed |
+10 |
Framework source or docs |
| Edge cases checked (per case) |
+5 each |
Verification result |
| Side effects assessed |
+10 |
Impact analysis |
| No regressions identified |
+5 |
Test results or code analysis |
Total possible: 100+ (normalize to percentage)
[SKEPTIC GATE — applied AFTER the additive score] The rubric measures evidence gathered; it does not measure whether the fix survived attack. Apply these caps regardless of the additive total — a high tally never overrides a failed/missing attack:
- Refutation Pass not genuinely attempted, or any related/feeder path left un-enumerated → cap at 79% (flag, do not ship).
- Any refutation attack succeeded (counter-case reproduces, test is weak, wrong layer, open regression) → that is a finding: score reflects the unresolved defect (typically <60%, BLOCK) until the finding is closed.
- Contrarian (BLOCK) argument is stronger than the ship argument → BLOCK, route back to
$debug-investigate or $fix.
Confidence is what remains after the attack — never the additive tally alone.
Step 4: Cross-Verification
After individual proof traces, perform cross-change verification:
- Anti-Bias Gate (MANDATORY first) — Complete every box of the Anti-Bias Gate (from the Adversarial Verification Mindset section) for the change set as a whole before any SHIP verdict. An unchecked box means verification is incomplete — go back, do not ship.
- Interaction check — Do the changes interact with each other? Could one change break another?
- Completeness check — Does the combined fix address ALL reported symptoms? Steel-man "the bug is still present somewhere" — what would prove it?
- Regression check — Could the combined changes introduce new bugs? Assume they did; where?
- Dependency check — Are there other code paths that depend on the changed behavior?
- Performance regression check — Does the fix introduce performance issues?
[IMPORTANT] Database Performance Protocol (MANDATORY):
- Paging Required — ALL list/collection queries MUST ATTENTION use pagination. NEVER load all records into memory. Verify: no unbounded
GetAll(), ToList(), or Find() without Skip/Take or cursor-based paging.
- Index Required — ALL query filter fields, foreign keys, and sort columns MUST ATTENTION have database indexes configured. Verify: entity expressions match index field order, database collections have index management methods, migrations include indexes for WHERE/JOIN/ORDER BY columns.
Step 5: Final Verdict
Produce a summary verdict:
FIX VERIFICATION VERDICT
━━━━━━━━━━━━━━━━━━━━━━━
Overall Confidence: [X%]
Anti-Bias Gate: [ALL boxes checked? YES/NO — if NO, verdict CANNOT be SHIP]
Changes Summary:
#1: [description] — [X%] ✅/⚠️/❌ — refutation: [survived / finding: ...]
#2: [description] — [X%] ✅/⚠️/❌ — refutation: [survived / finding: ...]
#N: [description] — [X%] ✅/⚠️/❌ — refutation: [survived / finding: ...]
Symbols: ✅ ≥80% (ship) | ⚠️ 60-79% (flag) | ❌ <60% (block)
Attacks that FAILED to break the fix (these earn the confidence):
- [attack]: [why it could not reproduce — file:line]
Attacks that SUCCEEDED (open findings — block until closed):
- [attack]: [the defect it exposed — file:line] (or "none")
Remaining Risks:
- [risk 1]: [likelihood] × [impact] — [mitigation]
- [risk 2]: [likelihood] × [impact] — [mitigation]
Verification Method:
- [Manual testing required? Which scenarios?]
- [Automated tests cover this? Which tests?]
- [Additional monitoring needed post-deploy?]
Recommendation: [SHIP / SHIP WITH CAVEATS / INVESTIGATE FURTHER / BLOCK]
Goal Satisfaction update (MANDATORY after verdict): resolve the active Goal Contract per SYNC:goal-contract-satisfaction-loop and map each proof trace to the saved success criterion it satisfies. Append proof evidence and remaining gaps to the goal file's Iteration Log and update its Goal Satisfaction matrix (PASS/FAIL/BLOCKED per criterion). A SHIP recommendation does NOT close the work while any required goal criterion remains FAIL — route the validated gap into another bounded fix loop or escalate a blocker.
Example: Proof Trace for NgRx Effect Fix
PROOF TRACE — Change #1: Move catchError inside switchMap
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SYMPTOM:
→ UI doesn't refresh after assigning PIC, Job Opening, or changing stage
TRIGGER PATH:
1. candidate-quick-card-v2.component.ts:445 — User clicks "Assign PIC"
2. candidate-card.container.component.ts:892 — onPersonInChargeChange($event)
3. candidate-card.effect.ts:275 — SavePersonInCharge effect
4. candidate-card.effect.ts:284 — dispatches LoadCandidateDetailsAction
5. candidate-card.effect.ts:48 ← EFFECT IS DEAD — never processes the action
ROOT CAUSE:
→ catchError at outer pipe level (effect.ts:64) causes effect completion on ANY error
→ Evidence: effect.ts:43-69 shows catchError OUTSIDE switchMap
→ Evidence: ngrx-effects.js:156-165 confirms defaultEffectsErrorHandler
only catches errors, not completions
FIX MECHANISM:
→ Move catchError INSIDE switchMap so errors are caught per-request
→ Before: effect.ts:64 — catchError at outer pipe → effect COMPLETES → DEAD
→ After: effect.ts:52 — catchError inside switchMap → inner obs completes → outer SURVIVES
WHY THIS FIX IS CORRECT:
→ RxJS: catchError inside switchMap catches per-emission, outer stream continues
→ Pattern precedent: effect.ts:120 (moveApplicationToNextState) uses same inner pattern
→ Framework: NgRx effects auto-resubscribe on ERROR but NOT on COMPLETION
RELATED PATHS TRACED:
→ Callers of SavePersonInCharge effect: container:892 only — verified no other dispatcher
→ Other effects sharing the dead-stream bug: grep catchError outside switchMap →
effect.ts:300 (SaveJobOpening), effect.ts:355 (ChangeStage) have SAME bug —
⚠ NOT fixed by this change; listed as unverified/out-of-scope feeder paths
→ Downstream consumers of LoadCandidateDetailsAction: reducer.ts:88 — unaffected (no contract change)
REFUTATION ATTEMPT:
→ Counter-case: a SECOND error after the fix → inner catchError re-catches; outer survives (verified effect.ts:52)
→ Test attacked: spec fails on un-fixed code (effect completes, no SetCandidateDetails emitted) AND asserts
the effect still emits on the 2nd call — invariant, not just the one example (effect.spec.ts:140-176)
→ Wrong-layer challenge: could fix at component? NO — effect owns the stream lifetime invariant; component patch
would leave SaveJobOpening/ChangeStage broken. Layer confirmed correct.
→ New-regression hunt: broadened catch could swallow a real error → ruled out, same error branch returns
same action, only scope moved (effect.ts:52 vs :64)
→ Contrarian: "BLOCK — two sibling effects still carry the bug." → Ship THIS change (correct + tested) but
the sibling paths are a SEPARATE finding to route back to $fix, not a reason to block this one.
→ Survived attack? YES for this change — but surfaced 2 un-fixed sibling feeder paths as findings.
EDGE CASES:
→ 403 Forbidden: verified — returns SetCandidateDetails with isAllowDisplayed=false
→ Network timeout: verified — returns EMPTY, effect survives
→ Multiple rapid requests: verified — switchMap cancels previous (unchanged)
SIDE EFFECTS:
→ None for this effect — same error handling logic, only scope changed
CONFIDENCE: 90% (this change), with a BLOCKING completeness finding
Survived attacks: counter-case, weak-test, wrong-layer, new-regression all failed to break it
Verified: root cause, fix mechanism, pattern precedent, framework source, all edge cases
Not verified / open finding: SaveJobOpening (effect.ts:300) and ChangeStage (effect.ts:355) share the
identical bug and are NOT fixed — the original symptom ("UI doesn't refresh after ... changing stage")
is only PARTIALLY resolved. Completeness check FAILS until those are fixed too.
What the skeptic stance bought here: a confirmation-biased pass would have scored this 95% ("root cause found, test passes, ship it") and shipped a fix that leaves two-thirds of the reported symptom alive. The refutation pass + "trace all related things" caught the sibling feeder paths the reproduction never exercised.
Run python .claude/scripts/code_graph trace <file> --direction downstream --json to prove fix doesn't break downstream.
Graph Intelligence (RECOMMENDED if graph.db exists)
If .code-graph/graph.db exists, enhance analysis with structural queries:
- Verify test coverage:
python .claude/scripts/code_graph query tests_for <function> --json
- Trace affected code paths:
python .claude/scripts/code_graph query callers_of <function> --json
- Batch analysis:
python .claude/scripts/code_graph batch-query file1 file2 --json
Graph-Trace for Fix Verification
When graph DB is available, use trace to PROVE the fix doesn't break downstream consumers:
python .claude/scripts/code_graph trace <fixed-file> --direction downstream --json — verify all downstream consumers, event handlers, and bus message listeners are unaffected
python .claude/scripts/code_graph trace <fixed-file> --direction both --json — full context: what triggered the bug (upstream) + what the fix affects (downstream)
- Include trace results as evidence in the proof chain
Integration with Other Skills
This skill is the mandatory verification gate between $fix and $code-simplifier in fix workflows.
Workflow position:
... → $fix → $prove-fix → $code-simplifier → $changes-review → ...
If proof trace reveals issues:
- Score ≥80%: proceed to next step
- Score 60-79%: ask user whether to proceed or investigate further
- Score <60%: BLOCK — return to
$debug-investigate or $fix step
$ARGUMENTS
Workflow Recommendation
MANDATORY IMPORTANT MUST ATTENTION — NO EXCEPTIONS: If you are NOT already in a workflow, you MUST ATTENTION use ask the user directly to ask the user. Do NOT judge task complexity or decide this is "simple enough to skip" — the user decides whether to use a workflow, not you:
- Activate
workflow-bugfix workflow (Recommended) — scout → investigate → debug → plan → fix → prove-fix → review → test
- Execute
$prove-fix directly — run this skill standalone
Next Steps
MANDATORY IMPORTANT MUST ATTENTION — NO EXCEPTIONS after completing this skill, you MUST ATTENTION use ask the user directly to present these options. Do NOT skip because the task seems "simple" or "obvious" — the user decides:
- "$code-simplifier (Recommended)" — Clean up fix implementation
- "$integration-test" — Generate/update regression integration tests
- "$workflow-review-changes" — Review all changes before commit
- "Skip, continue manually" — user decides
[IMPORTANT] Use task tracking to break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ATTENTION ask user whether to skip.
Prerequisites: MUST ATTENTION READ before executing:
docs/project-reference/domain-entities-reference.md — Domain entity catalog, relationships, cross-service sync (read when task involves business entities/models)
External Memory: For complex or lengthy work (research, analysis, scan, review), write intermediate findings and final results to a report file in plans/reports/ — prevents context loss and serves as deliverable.
Evidence Gate: MANDATORY IMPORTANT MUST ATTENTION — every claim, finding, and recommendation requires file:line proof or traced evidence with confidence percentage (>80% to act, <80% must verify first).
End-to-Start Debugger Trace — For non-trivial bugs, failed verification, regression fixes, behavior-changing code, or unclear code flow, start from the observed final state and walk backward before proposing a fix.
- Frame 0: observed end state — Name the exact user-visible output, failing assertion, log line, persisted value, API response, rendered UI, or aggregate bucket. Record the reader/query/renderer that produced it with
file:line evidence.
- Walk backward one hop at a time — Trace final reader -> projection/cache/storage -> writer -> consumer/handler/job -> producer/caller -> original trigger. At every hop record: input, transformation, output, owner, and evidence.
- Enumerate all feeder paths — Find every upstream producer/caller/event/job that can write into the final path, including retry, async, cache, background, and alternate UI/API paths. Mark each path verified, ruled out, or still unknown.
- Build the hypothesis matrix — For each plausible cause, list evidence for, evidence against, how to reproduce/verify, blast radius, and status (
primary, contributing, ruled out, latent). Do not fix until competing causes are explicitly resolved or bounded.
- Choose the owning fix layer — Identify the invariant owner and the lowest shared point that protects all downstream consumers. A fix at the symptom site is rejected unless the symptom site owns the invariant.
- Prove convergence forward — After choosing the fix, walk start -> end again and show how the corrected state reaches the observed final output. Map each root cause to a fix part and each fix part to a test/proof.
BLOCKED until: final state named · backward trace written · all feeder paths enumerated · hypothesis matrix completed · owning fix layer justified · forward convergence proof mapped to tests.
NEVER: Start at the first suspicious code path. Collapse multiple producers into one "flow". Treat duplicate symptoms as duplicate records without proving the read model. Skip ruled-out hypotheses.
UI System Context — For ANY task touching .ts, .html, .scss, or .css files:
MUST ATTENTION READ before implementing:
docs/project-reference/frontend-patterns-reference.md — component base classes, stores, forms
docs/project-reference/scss-styling-guide.md — BEM methodology, SCSS variables, mixins, responsive
docs/project-reference/design-system/README.md — design tokens, component inventory, icons
Reference docs/project-config.json for project-specific paths.
Graph-Assisted Investigation — MANDATORY when .code-graph/graph.db exists.
HARD-GATE: MUST ATTENTION run at least ONE graph command on key files before concluding any investigation.
Pattern: Grep finds files → trace --direction both reveals full system flow → Grep verifies details
| Task |
Minimum Graph Action |
| Investigation/Scout |
trace --direction both on 2-3 entry files |
| Fix/Debug |
callers_of on buggy function + tests_for |
| Feature/Enhancement |
connections on files to be modified |
| Code Review |
tests_for on changed functions |
| Blast Radius |
trace --direction downstream |
CLI: python .claude/scripts/code_graph {command} --json. Use --node-mode file first (10-30x less noise), then --node-mode function for detail.
Critical Thinking Mindset — Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act.
Anti-hallucination: Never present guess as fact — cite sources for every claim, admit uncertainty freely, self-check output for errors, cross-reference independently, stay skeptical of own confidence — certainty without evidence root of all hallucination.
Understand Code First — HARD-GATE: Do NOT write, plan, or fix until you READ existing code.
- Search 3+ similar patterns (
grep/glob) — cite file:line evidence
- Read existing files in target area — understand structure, base classes, conventions
- Run
python .claude/scripts/code_graph trace <file> --direction both --json when .code-graph/graph.db exists
- Map dependencies via
connections or callers_of — know what depends on your target
- Write investigation to
.ai/workspace/analysis/ for non-trivial tasks (3+ files)
- Re-read analysis file before implementing — never work from memory alone. — why: long context drifts from the file; the file is ground truth
- NEVER invent new patterns when existing ones work — match exactly or document deviation. — why: divergent patterns fragment the codebase and slow every future reader
BLOCKED until: - [ ] Read target files - [ ] Grep 3+ patterns - [ ] Graph trace (if graph.db exists) - [ ] Assumptions verified with evidence
Fix-Layer Accountability — NEVER fix at the crash site. Trace the full flow, fix at the owning layer.
AI default behavior: see error at Place A → fix Place A. This is WRONG. The crash site is a SYMPTOM, not the cause.
MANDATORY before ANY fix:
- Trace full data flow — Map the complete path from data origin to crash site across ALL layers (storage → backend → API → frontend → UI). Identify where the bad state ENTERS, not where it CRASHES.
- Identify the invariant owner — Which layer's contract guarantees this value is valid? That layer is responsible. Fix at the LOWEST layer that owns the invariant — not the highest layer that consumes it.
- One fix, maximum protection — Ask: "If I fix here, does it protect ALL downstream consumers with ONE change?" If fix requires touching 3+ files with defensive checks, you are at the wrong layer — go lower.
- Verify no bypass paths — Confirm all data flows t
…(truncated)
1---2name: prove-fix3description: [Code Quality] Use when you need to prove fix correctness with adversarial code proof traces — a skeptic tries to DISPROVE the fix and trace all related paths first, with confidence scoring and stack-trace-style evidence chains, so confidence is earned by surviving attack, not by confirming it works.4---5
6> Codex compatibility note:
7>
8> - Invoke repository skills with `$skill-name` in Codex; this mirrored copy rewrites legacy Claude `/skill-name` references.
9> - Task tracker mandate: BEFORE executing any workflow or skill step, create/update task tracking for all steps and keep it synchronized as progress changes.
10> - User-question prompts mean to ask the user directly in Codex.
11> - Ignore Claude-specific mode-switch instructions when they appear.
12> - Strict execution contract: when a user explicitly invokes a skill, execute that skill protocol as written.
13> - Subagent authorization: when a skill is user-invoked or AI-detected and its protocol requires subagents, that skill activation authorizes use of the required `spawn_agent` subagent(s) for that task.
14> - Do not skip, reorder, or merge protocol steps unless the user explicitly approves the deviation first.
15> - For workflow skills, execute each listed child-skill step explicitly and report step-by-step evidence.
16> - If a required step/tool cannot run in this environment, stop and ask the user before adapting.
17
18<!-- CODEX:PROJECT-REFERENCE-LOADING:START -->
19
20## Codex Project-Reference Loading (No Hooks)
21
22Codex uses static project-reference loading instead of runtime-injected project docs.
23When coding, planning, debugging, testing, or reviewing, open project docs explicitly using this routing.
24
25**Always read:**
26
27- `docs/project-config.json` (project-specific paths, commands, modules, and workflow/test settings)
28- `docs/project-reference/docs-index-reference.md` (routes to the full `docs/project-reference/*` catalog)
29- `docs/project-reference/lessons.md` (always-on guardrails and anti-patterns)
30
31**Missing/stale context route:** If `docs/project-config.json`, the docs index, `lessons.md`, `CLAUDE.md`, `AGENTS.md`, or any task-required reference doc is missing or stale, auto-run `$project-init` or the narrow setup route (`$project-config`, `$docs-init`, `$scan-all`, `$scan --target=<key>`, `$claude-md-init`) before ordinary project-specific work. If Codex mirrors or `AGENTS.md` are missing/stale, ask the user to run `$sync-codex`; do not auto-run it.
32
33**Situation-based docs:**
34
35- Project structure/architecture/tech-stack/deployment/setup (any layer — backend, frontend, or infra): `project-structure-reference.md`
36- Backend/CQRS/API/domain/entity changes: `backend-patterns-reference.md`, `domain-entities-reference.md`
37- Frontend/UI/styling/design-system: `frontend-patterns-reference.md`, `scss-styling-guide.md`, `design-system/README.md`
38- Spec authoring, `docs/specs/` pathing, or TC format: `feature-spec-reference.md`, `spec-system-reference.md`, `spec-principles.md`
39- Behavior/public-contract changes or spec-test-code sync: `workflow-spec-test-code-cycle-reference.md` plus the spec docs above
40- Derived spec indexes/ERDs/reimplementation guides: `spec-system-reference.md` and source Feature Specs under `docs/specs/`
41- Integration test implementation/review: `integration-test-reference.md`
42- E2E test implementation/review: `e2e-test-reference.md`
43- Code review/audit work: `code-review-rules.md` plus domain docs above based on changed files
44
45Do not read all docs blindly. Start from `docs-index-reference.md`, then open only relevant files for the task.
46
47<!-- CODEX:PROJECT-REFERENCE-LOADING:END -->
48
49<!-- PROMPT-ENHANCE:STEP-TASK-ANCHOR:START -->
50
51> **[BLOCKING]** Execute skill steps in declared order. NEVER skip, reorder, or merge steps without explicit user approval.
52> **[BLOCKING]** Before each step or sub-skill call, update task tracking: set `in_progress` when step starts, set `completed` when step ends.
53> **[BLOCKING]** Every completed/skipped step MUST include brief evidence or explicit skip reason.
54> **[BLOCKING]** If Task tools are unavailable, create and maintain an equivalent step-by-step plan tracker with the same status transitions.
55
56<!-- PROMPT-ENHANCE:STEP-TASK-ANCHOR:END -->
57
58## Quick Summary
59
60**Goal:** Block shipping an unproven fix — adopt a SKEPTIC's stance and try to DISPROVE the fix first, then build a code proof trace (like a debugger stack trace) for each change with confidence percentages, so every code change carries a `file:line` evidence chain that survived a genuine refutation attempt and a fix ships only when its correctness is proven (≥80%), never assumed.
61
62**Summary:**
63
64- **Purpose / default stance is SKEPTIC, not validator** — find why the fix is WRONG or INCOMPLETE, never confirm it works. Skill name ("prove-fix") + post-`$fix` context + points rubric all bias toward confirmation; the Adversarial Verification Mindset forces a reset so confidence is _earned by surviving attack_, not awarded for coherence.
65- **The 5 main steps (run in order, NEVER skip):** (1) **Change Inventory** — list EVERY change (file:line, before/after, type: root-cause/secondary/defensive/cleanup); (2) **Proof Trace per change** — stack-trace chain symptom → trigger path → root cause → fix mechanism → why-correct → **refutation attempt** → related paths → edge cases → side effects, every arrow `file:line`; (3) **Confidence Scoring** — points rubric + SKEPTIC caps; (4) **Cross-Verification** — Anti-Bias Gate FIRST, then interaction/completeness/regression/dependency/performance (paging+index DB protocol); (5) **Final Verdict** + Goal Satisfaction update.
66- Runs AFTER `$fix` (NEVER before) — the non-negotiable verification gate between `$fix` and `$code-simplifier`; ≥80% ship · 60-79% flag · <60% BLOCK (route back to `$debug-investigate` or `$fix`).
67- For EACH change, run a **Refutation Pass** FIRST (strongest case the fix is wrong/incomplete: counter-cases, unclosed feeder paths, wrong layer, regression risk, "test passes for the wrong reason") before scoring — an un-attacked change cannot exceed 79%.
68- **Trace ALL related things** — every caller, consumer, sibling/alternate path, feeder path, downstream dependent, shared-state writer the change touches; an un-enumerated related path is an unproven path and caps confidence below 80%. — why: the reproduction exercises one path; the bug survives through paths you never traced.
69- Score with the points rubric (root cause +25, fix mechanism +20, pattern precedent +15, framework +10, edge cases +5 each, side effects +10, no regressions +5); pattern precedent (1+ working example), edge cases (error/null/concurrent), survived refutation, and spec-loop evidence (property TC + mutation-kill + Dual-Feedback) are REQUIRED, not optional.
70- Map every fix part to a primary/contributing/latent root cause from the hypothesis matrix and prove ALL feeder paths closed; finish with the **Anti-Bias Gate** + cross-change checks + final verdict, then resolve the active Goal Contract (map each proof trace to its success criterion, emit the PASS/FAIL/BLOCKED matrix) — a SHIP verdict does NOT close work while any required criterion remains FAIL.
71
72**Workflow:**
73
741. **Inventory** — List every code change made by the fix (file:line, before/after)
752. **Trace + Refute** — For each change, build a proof chain (symptom → root cause → fix) AND run a refutation pass that tries to break it before believing it
763. **Score** — Assign confidence percentage per change with evidence; confidence is earned by surviving refutation, not awarded for coherence
774. **Verify** — Anti-Bias Gate + cross-check fix against edge cases, side effects, and ALL related paths
785. **Verdict** — Overall fix confidence and any remaining risks
79
80**Key Rules:**
81
82- **Default stance is SKEPTIC, not validator** — actively try to DISPROVE each change before scoring it; "looks correct" is the bias this gate exists to break
83- Every claim MUST ATTENTION have `file:line` evidence — no exceptions
84- Each change gets its OWN proof trace, refutation pass, and confidence score
85- A change that has not been genuinely attacked (refutation pass) cannot exceed 79%
86- If ANY change scores below 80%, flag it and recommend additional investigation
87- Always run this proof-trace step after `$fix` — **non-negotiable**, never skip it
88
89### Frontend/UI Context (if applicable)
90
91> When this task involves frontend or UI changes,
92
93- Component patterns: `docs/project-reference/frontend-patterns-reference.md`
94- Styling/BEM guide: `docs/project-reference/scss-styling-guide.md`
95- Design system tokens: `docs/project-reference/design-system/README.md`
96
97**Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence percentages (Idea should be more than 80%).**
98
99# Prove Fix
100
101Post-fix verification skill building evidence-based proof chains for every code change. A code debugger's stack trace, but for proving WHY a fix is correct.
102
103---
104
105## When to Use
106
107- **After `$fix`** in bugfix, hotfix, or any fix workflow
108- After applying code changes that fix a reported bug
109- Verify fix correctness before review/commit
110
111## When NOT to Use
112
113- Before fix applied (use `$debug-investigate` instead)
114- New feature verification (use `$test` instead)
115- Code quality review (use `$code-review` instead)
116
117---
118
119## Adversarial Verification Mindset (NON-NEGOTIABLE)
120
121**Default stance: SKEPTIC, not validator. Your job is to prove the fix is WRONG or INCOMPLETE — and only conclude it is correct when every attack fails.**
122
123> **Confirmation-bias trap (acute for THIS skill):** The skill is literally named "prove-fix", you arrive immediately after `$fix` (you may have written the fix yourself), and the scoring rubric _awards points for verified items_ — three forces that all pull toward confirming the fix works. A reviewer who already endorsed the fix cannot also be its skeptic without a forced reset. This section is that reset. — why: "build a proof FOR X" silently becomes "find reasons X is right"; real verification is "try to break X and report what survived".
124
125**Reframe the goal:** Do NOT set out to demonstrate the fix is correct. Set out to demonstrate it is BROKEN. Confidence is whatever is left standing _after_ a genuine attempt to break it — never a tally of agreements.
126
127### Refutation Techniques (apply ALL per change before scoring)
128
129| Technique | Think (try to make the fix FAIL) |
130| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
131| Counter-case hunt | Find ONE input/state/timing where the "fixed" code still produces the symptom. If you cannot, prove the input domain is exhausted — don't assume it. |
132| Test-passes-for-wrong-reason | Does the regression test pass because the fix is correct, or because the test is weak (asserts the example, not the invariant; mocks away the bug; never executes the fixed line)? |
133| Unclosed feeder path | Name every OTHER producer/caller/event/job/cache that can write the observed final state. Did the fix close ALL of them, or just the one you reproduced? |
134| Wrong-layer challenge | Argue the fix patches a symptom site, not the invariant owner. Would the bug recur through a sibling path that bypasses this fix? |
135| Regression injection | Assume the fix introduced a NEW bug. Where would it be? (changed scope, broadened catch, altered ordering, new query without paging/index.) |
136| Steel-man "no fix" | Argue the original code was actually correct and the real bug is elsewhere. If that argument has any legs, the root cause is unproven. |
137| Contrarian verdict | Before writing the score, argue in 2 sentences that this change should be BLOCKED. Then choose the stronger of ship-vs-block. |
138
139### Forbidden Patterns
140
141| Forbidden | Required correction |
142| ----------------------------------- | ----------------------------------------------------------------------------- |
143| "Fix is obviously correct" | Obviousness is the illusion this gate breaks. Run the refutation pass anyway. |
144| "Reproduction test passes → proven" | A passing example ≠ a closed invariant. Attack the test before trusting it. |
145| Award points for coherence | Points require _survived attack_, not a plausible-sounding chain. |
146| "I wrote the fix, I know it works" | Author ≠ reviewer. Reset to skeptic; attack your own change hardest. |
147| Stop at the path you reproduced | Enumerate ALL feeder/related paths; an un-attacked path is an unproven path. |
148
149### Anti-Bias Gate (MANDATORY before any SHIP/SHIP-WITH-CAVEATS verdict)
150
151Complete ALL of these — per change — before writing the final verdict (MUST ATTENTION):
152
153- [ ] Ran the Refutation Pass (≥1 genuine counter-case attempt, recorded with `file:line` evidence of why it fails to reproduce)
154- [ ] Attacked the regression test itself — confirmed it fails on the _un-fixed_ code and asserts the invariant, not the example
155- [ ] Enumerated ALL related/feeder paths and proved each is closed or explicitly listed as unverified
156- [ ] Stated the strongest argument the fix is at the WRONG layer, and rebutted it with evidence
157- [ ] Named ≥1 plausible NEW regression the change could introduce, and ruled it out with evidence
158- [ ] Wrote the contrarian (BLOCK) argument and explained why ship still wins
159
160Any box unchecked → verification is NOT complete; confidence is capped at 79% (flag, do not ship). NEVER round an un-refuted change up to 80%.
161
162---
163
164## Step 1: Change Inventory
165
166List ALL changes made by the fix. For each change, document:
167
168```
169CHANGE #N: [short description]
170 File: [path/to/file.ext]
171 Lines: [start-end]
172 Before: [code snippet — the broken version]
173 After: [code snippet — the fixed version]
174 Type: [root-cause-fix | secondary-fix | defensive-fix | cleanup]
175```
176
177**Change types:**
178
179- **root-cause-fix** — Directly addresses the root cause of the bug
180- **secondary-fix** — Fixes a related issue discovered during investigation
181- **defensive-fix** — Prevents the same class of bug from recurring
182- **cleanup** — Removed dead code or simplified logic (no behavior change)
183
184---
185
186## Step 2: Proof Trace (per change)
187
188For EACH change, build a **stack-trace-style proof chain** — the core of the skill.
189
190### Proof Trace Format
191
192```
193PROOF TRACE — Change #N: [description]
194━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
195
196SYMPTOM (what the user sees):
197 → [Observable behavior, e.g., "UI doesn't refresh after assigning PIC"]
198
199TRIGGER PATH (how the symptom occurs):
200 1. [file:line] User action → [method/event]
201 2. [file:line] → calls [method]
202 3. [file:line] → dispatches [action/event]
203 4. [file:line] → handler/effect [name]
204 5. [file:line] ← BUG HERE: [exact broken behavior]
205
206ROOT CAUSE (proven):
207 → [One sentence: what exactly is wrong and why]
208 → Evidence: [file:line] shows [specific code proving the bug]
209 → Hypothesis matrix mapping: RC-[N] status [primary/contributing/latent] from [report path/section]
210 → Feeder paths closed: [path names or "single path verified"]; unresolved paths: [none/list]
211
212FIX MECHANISM (how the change fixes it):
213 → [One sentence: what the fix does differently]
214 → Before: [broken code path with file:line]
215 → After: [fixed code path with file:line]
216 → Owning fix layer: [layer/component] — why this is the lowest shared owner
217
218WHY THIS FIX IS CORRECT:
219 → [Reasoning backed by code evidence]
220 → Pattern precedent: [file:line] shows same pattern working elsewhere
221 → Framework behavior: [file:line or doc reference] confirms expected behavior
222 → Forward convergence: [origin/trigger] -> [corrected transformations] -> [observed final output no longer stale/wrong]
223
224RELATED PATHS TRACED (all related things — none left un-attacked):
225 → Callers/consumers of changed symbol: [file:line list] — [each unaffected/updated, with evidence]
226 → Other feeder paths that write the final state: [file:line list] — [each closed / explicitly unverified]
227 → Sibling/alternate paths (retry, async, cache, background, alternate UI/API): [file:line] — [status]
228 → Downstream dependents (graph trace --direction downstream when graph.db exists): [evidence]
229
230REFUTATION ATTEMPT (try to break it — REQUIRED before scoring):
231 → Strongest counter-case attempted: [input/state/timing] → [why it does NOT reproduce, with file:line]
232 → Test attacked: [does the regression test fail on un-fixed code? assert invariant or just the example?] — [file:line]
233 → Wrong-layer challenge: [strongest argument this is a symptom patch] → [rebuttal with file:line, or CONCEDED]
234 → New-regression hunt: [most plausible bug the change could introduce] → [ruled out with file:line, or OPEN]
235 → Contrarian verdict (2 sentences arguing BLOCK): [...] → [why ship still wins, or why it does not]
236 → Survived attack? [YES — all attacks failed / NO — finding(s): ...]
237
238EDGE CASES CHECKED:
239 → [edge case 1]: [verified/not-verified] — [evidence]
240 → [edge case 2]: [verified/not-verified] — [evidence]
241
242SIDE EFFECTS:
243 → [None / List of potential side effects with evidence]
244
245CONFIDENCE: [X%] (earned by surviving the refutation pass, NOT by tallying agreements)
246 Survived attacks: [list of attacks attempted that failed to break the fix]
247 Verified: [list of verified items]
248 Not verified / un-attacked: [list of unverified items — each caps confidence below 80%]
249```
250
251### Proof Trace Rules
252
2531. **Every arrow (→) MUST ATTENTION have a `file:line` reference** — no exceptions
2542. **TRIGGER PATH must be traceable** — someone should be able to follow it step-by-step in the code
2553. **REFUTATION ATTEMPT is REQUIRED and must be GENUINE** — you MUST try to break the fix (counter-case, weak-test, wrong-layer, new-regression, contrarian) before scoring. A trace with an empty or token refutation pass is INCOMPLETE and caps confidence at 79%. Default to "broken until proven otherwise", not "correct until disproven".
2564. **RELATED PATHS must be fully traced ("all related things")** — enumerate every caller, consumer, sibling/alternate path, feeder path, downstream dependent, and shared-state writer the change touches; an un-enumerated related path is an unproven path and caps confidence below 80%.
2575. **Hypothesis matrix mapping is REQUIRED for bugfixes** — every fix part maps to a primary/contributing/latent root cause or is flagged as unrelated scope
2586. **Feeder paths must be accounted for** — prove the fix closes every path that can write the final observed state, or explicitly list remaining unverified paths
2597. **Pattern precedent is REQUIRED** — find at least 1 working example of the same pattern elsewhere in the codebase
2608. **Edge cases MUST ATTENTION be enumerated** — at minimum: error path, null/empty input, concurrent access
2619. **Side effects MUST ATTENTION be assessed** — what else could this change affect?
26210. **The regression test MUST be attacked, not trusted** — confirm it FAILS on the un-fixed code and asserts the protected invariant (not just the reproduction example, not a mock that hides the bug, and the fixed line actually executes). A test you did not try to break is not evidence.
26311. **Spec-loop evidence is REQUIRED for a complete proof** (canonical: `SYNC:spec-loop-discipline`) — the proof MUST carry, with `file:line`: (a) the **regression property TC** guarding the fixed invariant — a universally-quantified property ("for ALL inputs in {domain}, {invariant} holds") + boundary counter-case, not just the reproduction example; (b) **mutation-kill evidence** for the fixed core-logic line — show a surviving mutant on that line is now killed (MUTATION-SCORE bar, not line-coverage %); (c) a **Dual-Feedback entry** — the spec rule restored/added AND the guarding test that feeds it back. A proof trace missing any of (a)/(b)/(c) is INCOMPLETE — cap its confidence below the 80% ship threshold until the spec-loop evidence is supplied.
264
265---
266
267## Step 3: Confidence Scoring
268
269Each change gets an individual confidence score:
270
271| Score | Meaning | Action Required |
272| ----------- | --------------------------------------------------------------------------- | -------------------------------------------------- |
273| **95-100%** | Full proof trace complete, all edge cases verified, pattern precedent found | Ship it |
274| **80-94%** | Main proof trace complete, some edge cases unverified | Ship with caveats noted |
275| **60-79%** | Proof trace partial, some links unverified | Flag to user — recommend additional investigation |
276| **<60%** | Insufficient evidence | **BLOCK** — do not proceed until evidence gathered |
277
278### Scoring Criteria
279
280Award points for each verified item:
281
282| Criterion | Points | Evidence Required |
283| ----------------------------------------- | ------- | ----------------------------- |
284| Root cause identified with file:line | +25 | Code reference |
285| Fix mechanism explained with before/after | +20 | Code diff |
286| Pattern precedent found in codebase | +15 | Working example at file:line |
287| Framework behavior confirmed | +10 | Framework source or docs |
288| Edge cases checked (per case) | +5 each | Verification result |
289| Side effects assessed | +10 | Impact analysis |
290| No regressions identified | +5 | Test results or code analysis |
291
292**Total possible: 100+** (normalize to percentage)
293
294> **[SKEPTIC GATE — applied AFTER the additive score]** The rubric measures evidence _gathered_; it does not measure whether the fix _survived attack_. Apply these caps regardless of the additive total — a high tally never overrides a failed/missing attack:
295>
296> - Refutation Pass not genuinely attempted, or any related/feeder path left un-enumerated → **cap at 79%** (flag, do not ship).
297> - Any refutation attack succeeded (counter-case reproduces, test is weak, wrong layer, open regression) → that is a **finding**: score reflects the unresolved defect (typically <60%, BLOCK) until the finding is closed.
298> - Contrarian (BLOCK) argument is stronger than the ship argument → **BLOCK**, route back to `$debug-investigate` or `$fix`.
299>
300> Confidence is what remains _after_ the attack — never the additive tally alone.
301
302---
303
304## Step 4: Cross-Verification
305
306After individual proof traces, perform cross-change verification:
307
3080. **Anti-Bias Gate (MANDATORY first)** — Complete every box of the Anti-Bias Gate (from the Adversarial Verification Mindset section) for the change set as a whole before any SHIP verdict. An unchecked box means verification is incomplete — go back, do not ship.
3091. **Interaction check** — Do the changes interact with each other? Could one change break another?
3102. **Completeness check** — Does the combined fix address ALL reported symptoms? Steel-man "the bug is still present somewhere" — what would prove it?
3113. **Regression check** — Could the combined changes introduce new bugs? Assume they did; where?
3124. **Dependency check** — Are there other code paths that depend on the changed behavior?
3135. **Performance regression check** — Does the fix introduce performance issues?
314
315> **[IMPORTANT] Database Performance Protocol (MANDATORY):**
316>
317> 1. **Paging Required** — ALL list/collection queries MUST ATTENTION use pagination. NEVER load all records into memory. Verify: no unbounded `GetAll()`, `ToList()`, or `Find()` without `Skip/Take` or cursor-based paging.
318> 2. **Index Required** — ALL query filter fields, foreign keys, and sort columns MUST ATTENTION have database indexes configured. Verify: entity expressions match index field order, database collections have index management methods, migrations include indexes for WHERE/JOIN/ORDER BY columns.
319
320---
321
322## Step 5: Final Verdict
323
324Produce a summary verdict:
325
326```
327FIX VERIFICATION VERDICT
328━━━━━━━━━━━━━━━━━━━━━━━
329
330Overall Confidence: [X%]
331
332Anti-Bias Gate: [ALL boxes checked? YES/NO — if NO, verdict CANNOT be SHIP]
333
334Changes Summary:
335 #1: [description] — [X%] ✅/⚠️/❌ — refutation: [survived / finding: ...]
336 #2: [description] — [X%] ✅/⚠️/❌ — refutation: [survived / finding: ...]
337 #N: [description] — [X%] ✅/⚠️/❌ — refutation: [survived / finding: ...]
338
339Symbols: ✅ ≥80% (ship) | ⚠️ 60-79% (flag) | ❌ <60% (block)
340
341Attacks that FAILED to break the fix (these earn the confidence):
342 - [attack]: [why it could not reproduce — file:line]
343
344Attacks that SUCCEEDED (open findings — block until closed):
345 - [attack]: [the defect it exposed — file:line] (or "none")
346
347Remaining Risks:
348 - [risk 1]: [likelihood] × [impact] — [mitigation]
349 - [risk 2]: [likelihood] × [impact] — [mitigation]
350
351Verification Method:
352 - [Manual testing required? Which scenarios?]
353 - [Automated tests cover this? Which tests?]
354 - [Additional monitoring needed post-deploy?]
355
356Recommendation: [SHIP / SHIP WITH CAVEATS / INVESTIGATE FURTHER / BLOCK]
357```
358
359**Goal Satisfaction update (MANDATORY after verdict):** resolve the active Goal Contract per `SYNC:goal-contract-satisfaction-loop` and map each proof trace to the saved success criterion it satisfies. Append proof evidence and remaining gaps to the goal file's Iteration Log and update its Goal Satisfaction matrix (PASS/FAIL/BLOCKED per criterion). A SHIP recommendation does NOT close the work while any required goal criterion remains FAIL — route the validated gap into another bounded fix loop or escalate a blocker.
360
361---
362
363## Example: Proof Trace for NgRx Effect Fix
364
365```
366PROOF TRACE — Change #1: Move catchError inside switchMap
367━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
368
369SYMPTOM:
370 → UI doesn't refresh after assigning PIC, Job Opening, or changing stage
371
372TRIGGER PATH:
373 1. candidate-quick-card-v2.component.ts:445 — User clicks "Assign PIC"
374 2. candidate-card.container.component.ts:892 — onPersonInChargeChange($event)
375 3. candidate-card.effect.ts:275 — SavePersonInCharge effect
376 4. candidate-card.effect.ts:284 — dispatches LoadCandidateDetailsAction
377 5. candidate-card.effect.ts:48 ← EFFECT IS DEAD — never processes the action
378
379ROOT CAUSE:
380 → catchError at outer pipe level (effect.ts:64) causes effect completion on ANY error
381 → Evidence: effect.ts:43-69 shows catchError OUTSIDE switchMap
382 → Evidence: ngrx-effects.js:156-165 confirms defaultEffectsErrorHandler
383 only catches errors, not completions
384
385FIX MECHANISM:
386 → Move catchError INSIDE switchMap so errors are caught per-request
387 → Before: effect.ts:64 — catchError at outer pipe → effect COMPLETES → DEAD
388 → After: effect.ts:52 — catchError inside switchMap → inner obs completes → outer SURVIVES
389
390WHY THIS FIX IS CORRECT:
391 → RxJS: catchError inside switchMap catches per-emission, outer stream continues
392 → Pattern precedent: effect.ts:120 (moveApplicationToNextState) uses same inner pattern
393 → Framework: NgRx effects auto-resubscribe on ERROR but NOT on COMPLETION
394
395RELATED PATHS TRACED:
396 → Callers of SavePersonInCharge effect: container:892 only — verified no other dispatcher
397 → Other effects sharing the dead-stream bug: grep catchError outside switchMap →
398 effect.ts:300 (SaveJobOpening), effect.ts:355 (ChangeStage) have SAME bug —
399 ⚠ NOT fixed by this change; listed as unverified/out-of-scope feeder paths
400 → Downstream consumers of LoadCandidateDetailsAction: reducer.ts:88 — unaffected (no contract change)
401
402REFUTATION ATTEMPT:
403 → Counter-case: a SECOND error after the fix → inner catchError re-catches; outer survives (verified effect.ts:52)
404 → Test attacked: spec fails on un-fixed code (effect completes, no SetCandidateDetails emitted) AND asserts
405 the effect still emits on the 2nd call — invariant, not just the one example (effect.spec.ts:140-176)
406 → Wrong-layer challenge: could fix at component? NO — effect owns the stream lifetime invariant; component patch
407 would leave SaveJobOpening/ChangeStage broken. Layer confirmed correct.
408 → New-regression hunt: broadened catch could swallow a real error → ruled out, same error branch returns
409 same action, only scope moved (effect.ts:52 vs :64)
410 → Contrarian: "BLOCK — two sibling effects still carry the bug." → Ship THIS change (correct + tested) but
411 the sibling paths are a SEPARATE finding to route back to $fix, not a reason to block this one.
412 → Survived attack? YES for this change — but surfaced 2 un-fixed sibling feeder paths as findings.
413
414EDGE CASES:
415 → 403 Forbidden: verified — returns SetCandidateDetails with isAllowDisplayed=false
416 → Network timeout: verified — returns EMPTY, effect survives
417 → Multiple rapid requests: verified — switchMap cancels previous (unchanged)
418
419SIDE EFFECTS:
420 → None for this effect — same error handling logic, only scope changed
421
422CONFIDENCE: 90% (this change), with a BLOCKING completeness finding
423 Survived attacks: counter-case, weak-test, wrong-layer, new-regression all failed to break it
424 Verified: root cause, fix mechanism, pattern precedent, framework source, all edge cases
425 Not verified / open finding: SaveJobOpening (effect.ts:300) and ChangeStage (effect.ts:355) share the
426 identical bug and are NOT fixed — the original symptom ("UI doesn't refresh after ... changing stage")
427 is only PARTIALLY resolved. Completeness check FAILS until those are fixed too.
428```
429
430> **What the skeptic stance bought here:** a confirmation-biased pass would have scored this 95% ("root cause found, test passes, ship it") and shipped a fix that leaves two-thirds of the reported symptom alive. The refutation pass + "trace all related things" caught the sibling feeder paths the reproduction never exercised.
431
432---
433
434> Run `python .claude/scripts/code_graph trace <file> --direction downstream --json` to prove fix doesn't break downstream.
435
436## Graph Intelligence (RECOMMENDED if graph.db exists)
437
438If `.code-graph/graph.db` exists, enhance analysis with structural queries:
439
440- **Verify test coverage:** `python .claude/scripts/code_graph query tests_for <function> --json`
441- **Trace affected code paths:** `python .claude/scripts/code_graph query callers_of <function> --json`
442- **Batch analysis:** `python .claude/scripts/code_graph batch-query file1 file2 --json`
443
444### Graph-Trace for Fix Verification
445
446When graph DB is available, use `trace` to PROVE the fix doesn't break downstream consumers:
447
448- `python .claude/scripts/code_graph trace <fixed-file> --direction downstream --json` — verify all downstream consumers, event handlers, and bus message listeners are unaffected
449- `python .claude/scripts/code_graph trace <fixed-file> --direction both --json` — full context: what triggered the bug (upstream) + what the fix affects (downstream)
450- Include trace results as evidence in the proof chain
451
452## Integration with Other Skills
453
454This skill is the **mandatory verification gate** between `$fix` and `$code-simplifier` in fix workflows.
455
456**Workflow position:**
457
458```
459... → $fix → $prove-fix → $code-simplifier → $changes-review → ...
460```
461
462**If proof trace reveals issues:**
463
464- Score ≥80%: proceed to next step
465- Score 60-79%: ask user whether to proceed or investigate further
466- Score <60%: BLOCK — return to `$debug-investigate` or `$fix` step
467
468---
469
470<prove-context>$ARGUMENTS</prove-context>
471
472---
473
474## Workflow Recommendation
475
476> **MANDATORY IMPORTANT MUST ATTENTION — NO EXCEPTIONS:** If you are NOT already in a workflow, you MUST ATTENTION use ask the user directly to ask the user. Do NOT judge task complexity or decide this is "simple enough to skip" — the user decides whether to use a workflow, not you:
477>
478> 1. **Activate `workflow-bugfix` workflow** (Recommended) — scout → investigate → debug → plan → fix → prove-fix → review → test
479> 2. **Execute `$prove-fix` directly** — run this skill standalone
480
481---
482
483## Next Steps
484
485**MANDATORY IMPORTANT MUST ATTENTION — NO EXCEPTIONS** after completing this skill, you MUST ATTENTION use ask the user directly to present these options. Do NOT skip because the task seems "simple" or "obvious" — the user decides:
486
487- **"$code-simplifier (Recommended)"** — Clean up fix implementation
488- **"$integration-test"** — Generate/update regression integration tests
489- **"$workflow-review-changes"** — Review all changes before commit
490- **"Skip, continue manually"** — user decides
491
492> **[IMPORTANT]** Use task tracking to break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ATTENTION ask user whether to skip.
493
494**Prerequisites:** **MUST ATTENTION READ** before executing:
495
496- `docs/project-reference/domain-entities-reference.md` — Domain entity catalog, relationships, cross-service sync (read when task involves business entities/models)
497
498> **External Memory:** For complex or lengthy work (research, analysis, scan, review), write intermediate findings and final results to a report file in `plans/reports/` — prevents context loss and serves as deliverable.
499
500> **Evidence Gate:** MANDATORY IMPORTANT MUST ATTENTION — every claim, finding, and recommendation requires `file:line` proof or traced evidence with confidence percentage (>80% to act, <80% must verify first).
501
502<!-- SYNC:end-to-start-debugger-trace -->
503
504> **End-to-Start Debugger Trace** — For non-trivial bugs, failed verification, regression fixes, behavior-changing code, or unclear code flow, start from the observed final state and walk backward before proposing a fix.
505>
506> 1. **Frame 0: observed end state** — Name the exact user-visible output, failing assertion, log line, persisted value, API response, rendered UI, or aggregate bucket. Record the reader/query/renderer that produced it with `file:line` evidence.
507> 2. **Walk backward one hop at a time** — Trace final reader -> projection/cache/storage -> writer -> consumer/handler/job -> producer/caller -> original trigger. At every hop record: input, transformation, output, owner, and evidence.
508> 3. **Enumerate all feeder paths** — Find every upstream producer/caller/event/job that can write into the final path, including retry, async, cache, background, and alternate UI/API paths. Mark each path verified, ruled out, or still unknown.
509> 4. **Build the hypothesis matrix** — For each plausible cause, list evidence for, evidence against, how to reproduce/verify, blast radius, and status (`primary`, `contributing`, `ruled out`, `latent`). Do not fix until competing causes are explicitly resolved or bounded.
510> 5. **Choose the owning fix layer** — Identify the invariant owner and the lowest shared point that protects all downstream consumers. A fix at the symptom site is rejected unless the symptom site owns the invariant.
511> 6. **Prove convergence forward** — After choosing the fix, walk start -> end again and show how the corrected state reaches the observed final output. Map each root cause to a fix part and each fix part to a test/proof.
512>
513> **BLOCKED until:** final state named · backward trace written · all feeder paths enumerated · hypothesis matrix completed · owning fix layer justified · forward convergence proof mapped to tests.
514>
515> **NEVER:** Start at the first suspicious code path. Collapse multiple producers into one "flow". Treat duplicate symptoms as duplicate records without proving the read model. Skip ruled-out hypotheses.
516
517<!-- /SYNC:end-to-start-debugger-trace -->
518
519<!-- SYNC:ui-system-context -->
520
521> **UI System Context** — For ANY task touching `.ts`, `.html`, `.scss`, or `.css` files:
522>
523> **MUST ATTENTION READ before implementing:**
524>
525> 1. `docs/project-reference/frontend-patterns-reference.md` — component base classes, stores, forms
526> 2. `docs/project-reference/scss-styling-guide.md` — BEM methodology, SCSS variables, mixins, responsive
527> 3. `docs/project-reference/design-system/README.md` — design tokens, component inventory, icons
528>
529> Reference `docs/project-config.json` for project-specific paths.
530
531<!-- /SYNC:ui-system-context -->
532
533<!-- SYNC:graph-assisted-investigation -->
534
535> **Graph-Assisted Investigation** — MANDATORY when `.code-graph/graph.db` exists.
536>
537> **HARD-GATE:** MUST ATTENTION run at least ONE graph command on key files before concluding any investigation.
538>
539> **Pattern:** Grep finds files → `trace --direction both` reveals full system flow → Grep verifies details
540>
541> | Task | Minimum Graph Action |
542> | ------------------- | -------------------------------------------- |
543> | Investigation/Scout | `trace --direction both` on 2-3 entry files |
544> | Fix/Debug | `callers_of` on buggy function + `tests_for` |
545> | Feature/Enhancement | `connections` on files to be modified |
546> | Code Review | `tests_for` on changed functions |
547> | Blast Radius | `trace --direction downstream` |
548>
549> **CLI:** `python .claude/scripts/code_graph {command} --json`. Use `--node-mode file` first (10-30x less noise), then `--node-mode function` for detail.
550
551<!-- /SYNC:graph-assisted-investigation -->
552
553<!-- SYNC:critical-thinking-mindset -->
554
555> **Critical Thinking Mindset** — Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence >80% to act.
556> **Anti-hallucination:** Never present guess as fact — cite sources for every claim, admit uncertainty freely, self-check output for errors, cross-reference independently, stay skeptical of own confidence — certainty without evidence root of all hallucination.
557
558<!-- /SYNC:critical-thinking-mindset -->
559
560<!-- SYNC:understand-code-first -->
561
562> **Understand Code First** — HARD-GATE: Do NOT write, plan, or fix until you READ existing code.
563>
564> 1. Search 3+ similar patterns (`grep`/`glob`) — cite `file:line` evidence
565> 2. Read existing files in target area — understand structure, base classes, conventions
566> 3. Run `python .claude/scripts/code_graph trace <file> --direction both --json` when `.code-graph/graph.db` exists
567> 4. Map dependencies via `connections` or `callers_of` — know what depends on your target
568> 5. Write investigation to `.ai/workspace/analysis/` for non-trivial tasks (3+ files)
569> 6. Re-read analysis file before implementing — never work from memory alone. — why: long context drifts from the file; the file is ground truth
570> 7. NEVER invent new patterns when existing ones work — match exactly or document deviation. — why: divergent patterns fragment the codebase and slow every future reader
571>
572> **BLOCKED until:** `- [ ]` Read target files `- [ ]` Grep 3+ patterns `- [ ]` Graph trace (if graph.db exists) `- [ ]` Assumptions verified with evidence
573
574<!-- /SYNC:understand-code-first -->
575
576<!-- SYNC:fix-layer-accountability -->
577
578> **Fix-Layer Accountability** — NEVER fix at the crash site. Trace the full flow, fix at the owning layer.
579>
580> AI default behavior: see error at Place A → fix Place A. This is WRONG. The crash site is a SYMPTOM, not the cause.
581>
582> **MANDATORY before ANY fix:**
583>
584> 1. **Trace full data flow** — Map the complete path from data origin to crash site across ALL layers (storage → backend → API → frontend → UI). Identify where the bad state ENTERS, not where it CRASHES.
585> 2. **Identify the invariant owner** — Which layer's contract guarantees this value is valid? That layer is responsible. Fix at the LOWEST layer that owns the invariant — not the highest layer that consumes it.
586> 3. **One fix, maximum protection** — Ask: "If I fix here, does it protect ALL downstream consumers with ONE change?" If fix requires touching 3+ files with defensive checks, you are at the wrong layer — go lower.
587> 4. **Verify no bypass paths** — Confirm all data flows t
588
589…(truncated)