Forces a full step-back re-analysis when a fix or refactor is not working: traces the whole execution path end-to-end — entry point to exit, every block, every contract boundary, and the full data flow — instead of patching in isolation. Three modes: `fix` (default) for bugs and broken behavior, `refactor` for restructuring, and `review` for PR validation (returns intent-match and system-fit findings for the `pr-reviewer` agent to consume — never run standalone for routine review work). Trigger ONLY once at least one isolated fix attempt has already failed, or on an explicit request for a full execution-path analysis: "step back", "think holistically", "analyze the whole thing", "zoom out", "look at the bigger picture", and "rethink this" qualify in that context only. Never for trivial one-line fixes or first-attempt debugging. Also triggers on "/holistic", "/step-back", "/rethink", "/zoom-out".
67
84%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
When this skill activates, STOP all incremental patching. Do not attempt another narrow change. Instead, execute the full analysis protocol below before writing any code.
fix (default), refactor, or review (rule file)/confidence analysis or /confidence plan/confidence code gateCheck $ARGUMENTS for mode:
| Mode | Default | Use case |
|---|---|---|
fix | yes | Bug, broken behavior, failing test — something is wrong and needs root cause analysis |
refactor | Restructuring, cleanup, improvement — the code works but needs to be better | |
review | PR validation — does this diff implement what its description claims, and does the change make sense given how the changed code is used in the wider system? Returns structured findings for the pr-reviewer agent to consume — not root-cause analysis. Streamlined three-phase flow that skips Phases 2–8; full procedure lives in rules/review-mode.md. |
The mode determines how certain phases are framed (noted inline below). fix and refactor walk the full eight-phase protocol in this file. review is a structurally different flow — see the rule file linked above.
Before analyzing, gather all relevant context:
git log -10 --oneline -- <file> and git diff HEAD~5 -- <file> to see what changed recentlyrules/call-graph-map.md, then read each step's body; fall back to the manual Explore + grep trace when it is not.Do NOT skip any of these. The point is to build a complete mental model before reasoning.
After gathering context, walk through the execution path sequentially from entry to exit.
Create a numbered list of every step in the execution path.
If you seeded a call map via rules/call-graph-map.md, use it as the skeleton here — it already resolves the cross-file callers and callees, so your job is to order the steps and read each body.
## Execution Path: [name of the flow, e.g., "POST /api/v1/ingest"]
1. [file:line] Route registration / middleware entry
2. [file:line] Authentication middleware
3. [file:line] Request validation
4. [file:line] Business logic - step A
5. [file:line] Business logic - step B
6. [file:line] Database interaction
7. [file:line] Response construction
8. [file:line] Error handler / response sendFor each step in the execution map, answer:
| Question | Answer |
|---|---|
| What does this block expect? | Input shape, preconditions, assumptions about prior state |
| What does this block guarantee? | Output shape, postconditions, side effects |
| Does the previous block's guarantee match this block's expectation? | YES / NO / PARTIALLY — explain any gaps |
| Are there implicit assumptions? | Types that aren't validated, null checks that are missing, ordering that isn't enforced |
| What happens on the unhappy path? | Error handling, edge cases, timeouts, empty inputs |
| Is there a "hole in the cheese" here? | A subtle issue that only matters in combination with other blocks |
After analyzing each block individually, check every boundary between blocks:
string that's supposed to be a UUID but nothing validates that)Produce a Walkthrough Summary before continuing:
## Execution Path Summary
### Health
- Total blocks analyzed: X
- Blocks with no issues: X
- Blocks with potential issues: X
- Contract boundary mismatches found: X
### Issues Found (ordered by severity)
#### Critical
- [block N → block N+1]: Description of the issue
#### Warning
- [block N]: Description of the concern
#### Info
- [block N]: Observation worth noting
### The Full Picture
[2-3 paragraphs explaining what the end-to-end analysis reveals that isolated
analysis would miss. Connect the dots across the entire chain.]Based on step-back prompting research (Zheng et al., 2023 — up to 36% improvement over chain-of-thought).
Answer these questions explicitly in your thinking:
Based on rubber duck debugging protocol — forces externalization of hidden assumptions.
Before any analysis, state clearly:
Write this out explicitly. Do not skip to hypotheses.
Based on structured RCA frameworks and the 5 Whys technique.
Generate at least 3 distinct hypotheses for the root cause:
| # | Hypothesis | Supporting Evidence | Contradicting Evidence | Confidence |
|---|---|---|---|---|
| 1 | ... | ... | ... | low/med/high |
| 2 | ... | ... | ... | low/med/high |
| 3 | ... | ... | ... | low/med/high |
Then ask:
Generate at least 3 distinct refactoring approaches:
| # | Approach | Pros | Cons | Risk level |
|---|---|---|---|---|
| 1 | ... | ... | ... | low/med/high |
| 2 | ... | ... | ... | low/med/high |
| 3 | ... | ... | ... | low/med/high |
Then ask:
Based on metacognitive prompting research (Wang & Zhao, 2023 — up to 26.9% improvement).
Answer honestly:
Run the appropriate /confidence mode based on the analysis type:
/confidence analysisScores:
/confidence planScores:
Thresholds (both modes):
No code until this phase is complete.
Only now write code. After implementing:
/confidence code to validate the implementation:
/confidence code fix to auto-fix mechanical issues and re-assess.Present the analysis using this structure:
## Holistic Analysis
### Context Gathered
[List files read and key findings from each]
### Execution Path Walkthrough
[Full execution map from Phase 1]
[Per-block analysis table]
[Contract boundary findings]
[Walkthrough Summary with severity-ordered issues]
### Step Back: The Principle
[What general concept governs this code and what invariants must hold]
### The Situation (Scene Set)
[Fix mode: Expected / Actual / Gap / Prior attempts]
[Refactor mode: Current state / Desired state / Gap / Prior attempts]
### Hypotheses / Approaches
[Fix mode: Root cause hypothesis table from Phase 4]
[Refactor mode: Approach comparison table from Phase 4]
### Meta-Cognitive Check
[Key assumptions challenged, strongest counter-argument]
### Root Cause / Chosen Approach
[Fix mode: The identified root cause]
[Refactor mode: The selected approach and rationale]
### Analysis Confidence
[Fix mode: /confidence analysis score and breakdown]
[Refactor mode: /confidence plan score and breakdown]
### Change Plan
[Plain-language description, impact analysis, verification plan]
### Implementation Confidence (/confidence code)
[Score and dimension breakdown from Phase 8]This skill is the engine that confirms the why — an invariant a symbol upholds
(Step 1c), a consumer count swept in Context Gathering, a root-cause defect pinned at
a SHA (Phase 4 → Phase 6). Those confirmed facts are the scarcest, most reusable
entries in the shared codebase-knowledge bucket. When a run has genuinely
verified such a fact against the code, contribute it back so the next code-changer
(aw, fix-bug, implement-suggestion, ci-auto-fix, and
optimize-approach) plans with it in hand.
This is a writer-primary, best-effort step: it never blocks or reshapes the
analysis above, writes only what THIS run verified, and follows the multi-writer
contract. Full procedure and the gate on real verification:
rules/codebase-knowledge-write.md.
39b3f44
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.