# /plan

{% code title="plan.md" overflow="wrap" lineNumbers="true" fullWidth="false" %}

````markdown
---
allowed-tools: Bash(cat:*), Bash(ls:*), Bash(find:*), Bash(git log:*), Bash(git diff:*), Bash(git status:*)
---

Create an implementation plan for: $ARGUMENTS

# PLANNING PROTOCOL

## STEP 1: UNDERSTAND

Read CLAUDE.md + current project structure. Check git status + recent changes.
Identify: stack, patterns, conventions, current state.

If vague, ask 1-2 clarifying questions. If clear, proceed.

## STEP 2: IMPACT ANALYSIS

Before writing the plan:
- Which existing files change? (list exact paths)
- What new files needed? (list)
- Dependencies between changes? (order)
- What could break? (risks)
- Does the matched framework reference file flag relevant pitfalls?

## STEP 3: OUTPUT PLAN

Save to `Plan-${feat}.md`, output to chat:

```
## Plan: [short title]

### Summary
[1-2 sentences — what this achieves]

### Impact
- Modify: [file list]
- Create: [file list]
- Risks: [what could break]

### Phases
Phase 1: [name] — files: [list] — est. diffs: [lines]
  - [specific change 1]
  - [specific change 2]

Phase 2: [name] — files: [list] — est. diffs: [lines]
  - [specific change 1]
  - [specific change 2]

### Testing Strategy
- Per phase: [what to verify]
- Final: [end-to-end verification]

### Assumptions
- [ASSUMPTION: x]
```

## PLAN RULES
- Each phase independently testable
- Max 5 files per phase
- 2-5 phases for features, 1-2 for bug fixes
- Phase diffs under 200 lines
- Exact file paths, not vague descriptions
- Reference existing patterns: "Follow pattern in [file]"
- Always include testing strategy

## ERROR RECOVERY
If a phase fails after 2 fix attempts:
1. STOP — state root cause explicitly
2. Offer: **A)** rollback + different approach **B)** user decides
3. Never loop: fix → break → fix → break

## AFTER APPROVAL
Per phase:
1. Execute changes
2. Build + lint + test
3. `git add [files] && git commit -m "[phase description]"`
4. Update Plan.md with ✅
5. Next phase

If context grows long, suggest `/clear` with: `Read CLAUDE.md and Plan.md. Continue with next unchecked phase.`

## AFTER COMPLETION
Suggest relevant next commands:
- /test — add test coverage for new code
- /review — verify code quality
- /doc — update documentation
- /secure — check for security issues
````

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sumontas-organization.gitbook.io/claude-code-handbook-sumonta056/basics/interactive-blocks/claude-templates/plan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
