pwrl-plan-generate — Plan Generation
Purpose: Final output step in the planning workflow. Accepts scoped context, research findings, and implementation units from upstream skills (S2→S3→S4). Selects the appropriate tier (Fast/Standard/Deep), renders the plan from the templates reference file, embeds related learnings, and saves it to docs/plans/.
Interaction Method
- Use the platform's
ask_user_question extension for confirmations and overrides.
- Present tier selection and plan preview before saving.
- Ask one question at a time. Use multiple-choice for tier override.
Input
This skill expects three inputs:
- Scoped context from
pwrl-plan-scope (S2) — problem, criteria, domain, learnings
- Research findings from
pwrl-plan-research (S3) — patterns, risk, constraints
- Implementation units from
pwrl-plan-design (S4) — U-IDs, files, approach, criteria
If inputs are missing, search for recent scope/research/design files or prompt the user to run prerequisite skills first.
Output: Plan File
After completing the workflow, a plan file is saved to docs/plans/YYYY-MM-DD-NNN-<kebab-case-name>.md. The function returns: { file_path: "docs/plans/...md", tier: "Fast", summary: "..." }. For detailed schema documentation, file structure, frontmatter specification, content requirements per tier, storage conventions, and versioning rules, see state-schema.md.
Workflow
Step 1: Tier Selection
Read the complexity hint from S4's output and the research findings.
Apply the heuristic to determine initial tier:
| Unit Count |
Risk Level |
Initial Tier |
| 1-3 |
LOW |
Fast |
| 1-3 |
MEDIUM or HIGH |
Standard |
| 4-8 |
any |
Standard |
| 9+ |
any |
Deep |
| any |
2+ high-risk areas |
Deep |
Present to user: "Based on [N] units and [risk] risk level, the recommended tier is [Tier]. Would you like to use this tier or choose a different one?"
- Options: Accept [Tier], Select Fast, Select Standard, Select Deep
Apply user's choice.
Document the tier selection rationale in the plan.
Step 2: Load Template
- Read the appropriate template from
pwrl-plan/references/plan-templates.md.
- Select the template section matching the chosen tier (Fast, Standard, or Deep).
- If the template cannot be loaded, fall back to the inline template definitions in this skill.
Step 3: Render Plan Sections
Use the loaded template to populate each section based on the chosen tier. For detailed rendering logic, section requirements per tier (Fast/Standard/Deep), template structure, and examples, see render-workflow.md.
Step 4: Embed Learnings
From S2's Related Learnings list, add to the plan:
## Related Learnings
- **[Learning Title]** — `docs/learnings/XXX.md` — [1-line applicability note]
From S2's Learning Gaps list, add to the plan:
## Learning Gaps
- **[Gap Name]** — *Action:* Document via `/pwrl-learnings` after implementation
If no learnings or gaps exist, still include the sections:
- "No relevant learnings found"
- "No learning gaps identified at this time"
Step 5: Generate Filename
- Format:
docs/plans/YYYY-MM-DD-NNN-<kebab-case-name>.md
- Components:
- Date: Today's date in YYYY-MM-DD format
- NNN: Sequential 3-digit number (001, 002, 003...)
- Name: Kebab-case slug from the plan title
- Avoid collisions:
- Read
docs/plans/ directory
- Find the highest existing NNN for today's date
- Increment: new NNN = max NNN + 1
- Example: if
2026-06-05-001-... exists, next is 2026-06-05-002-...
Step 6: Validate Plan
Before saving, validate:
Step 7: Confirm and Save
- Present the plan preview to the user via
ask_user_question:
- Show: tier selected, filename, first 500 characters of the plan
- Ask: "Shall I save this plan to
[filename]?"
- Options: Yes, Edit (iterate on sections), Cancel
- If Yes: Write the file and confirm.
- If Edit: Iterate on specific sections the user wants changed.
- If Cancel: Discard and exit.
- Return the file path and a brief summary.
Edge Cases
Seven edge cases commonly encountered during generation: template loading failure, filename collisions, tier override after preview, minimal research findings, unit count/complexity mismatch, empty complex sections, and multiple plans with same date/title. For handling strategies, decision trees, and examples, see edge-cases.md.
References
- Templates:
pwrl-plan/references/plan-templates.md (created by S1)
- Tier Heuristic:
pwrl-plan-generate/references/tier-heuristic.md
- Input: Scoped context (S2) + Research findings (S3) + Units (S4)
- Output:
docs/plans/YYYY-MM-DD-NNN-<name>.md
- Learnings:
docs/learnings/INDEX.md for embedding
1---2name: pwrl-plan-generate3description: Choose tier, render plan from templates, embed learnings, and save to docs/plans/.4---56# pwrl-plan-generate — Plan Generation78**Purpose:** Final output step in the planning workflow. Accepts scoped context, research findings, and implementation units from upstream skills (S2→S3→S4). Selects the appropriate tier (Fast/Standard/Deep), renders the plan from the templates reference file, embeds related learnings, and saves it to `docs/plans/`.910## Interaction Method1112- Use the platform's `ask_user_question` extension for confirmations and overrides.13- Present tier selection and plan preview before saving.14- Ask one question at a time. Use multiple-choice for tier override.1516## Input1718This skill expects three inputs:19201. **Scoped context** from `pwrl-plan-scope` (S2) — problem, criteria, domain, learnings212. **Research findings** from `pwrl-plan-research` (S3) — patterns, risk, constraints223. **Implementation units** from `pwrl-plan-design` (S4) — U-IDs, files, approach, criteria2324If inputs are missing, search for recent scope/research/design files or prompt the user to run prerequisite skills first.2526## Output: Plan File2728After completing the workflow, a plan file is saved to `docs/plans/YYYY-MM-DD-NNN-<kebab-case-name>.md`. The function returns: `{ file_path: "docs/plans/...md", tier: "Fast", summary: "..." }`. For detailed schema documentation, file structure, frontmatter specification, content requirements per tier, storage conventions, and versioning rules, see **[state-schema.md](references/state-schema.md)**.2930## Workflow3132### Step 1: Tier Selection33341. Read the complexity hint from S4's output and the research findings.352. Apply the heuristic to determine initial tier:3637 | Unit Count | Risk Level | Initial Tier |38 | ---------- | ------------------ | ------------ |39 | 1-3 | LOW | Fast |40 | 1-3 | MEDIUM or HIGH | Standard |41 | 4-8 | any | Standard |42 | 9+ | any | Deep |43 | any | 2+ high-risk areas | Deep |44453. Present to user: "Based on [N] units and [risk] risk level, the recommended tier is **[Tier]**. Would you like to use this tier or choose a different one?"46 - Options: Accept [Tier], Select Fast, Select Standard, Select Deep474. Apply user's choice.485. Document the tier selection rationale in the plan.4950### Step 2: Load Template51521. Read the appropriate template from `pwrl-plan/references/plan-templates.md`.532. Select the template section matching the chosen tier (Fast, Standard, or Deep).543. If the template cannot be loaded, fall back to the inline template definitions in this skill.5556### Step 3: Render Plan Sections5758Use the loaded template to populate each section based on the chosen tier. For detailed rendering logic, section requirements per tier (Fast/Standard/Deep), template structure, and examples, see **[render-workflow.md](references/render-workflow.md)**.5960### Step 4: Embed Learnings61621. From S2's `Related Learnings` list, add to the plan:6364 ```65 ## Related Learnings6667 - **[Learning Title]** — `docs/learnings/XXX.md` — [1-line applicability note]68 ```69702. From S2's `Learning Gaps` list, add to the plan:7172 ```73 ## Learning Gaps7475 - **[Gap Name]** — *Action:* Document via `/pwrl-learnings` after implementation76 ```77783. If no learnings or gaps exist, still include the sections:79 - "No relevant learnings found"80 - "No learning gaps identified at this time"8182### Step 5: Generate Filename83841. Format: `docs/plans/YYYY-MM-DD-NNN-<kebab-case-name>.md`852. Components:86 - **Date:** Today's date in YYYY-MM-DD format87 - **NNN:** Sequential 3-digit number (001, 002, 003...)88 - **Name:** Kebab-case slug from the plan title893. Avoid collisions:90 - Read `docs/plans/` directory91 - Find the highest existing NNN for today's date92 - Increment: new NNN = max NNN + 193 - Example: if `2026-06-05-001-...` exists, next is `2026-06-05-002-...`9495### Step 6: Validate Plan9697Before saving, validate:9899- [ ] Frontmatter: id, status, tier, created, updated are present and valid100- [ ] All required sections present for the chosen tier (see Required Sections Per Tier in plan-templates.md)101- [ ] All file paths are repository-relative (no /home/user/... paths)102- [ ] Related Learnings section exists (even if empty)103- [ ] Learning Gaps section exists (even if empty)104- [ ] No empty placeholders remain (e.g., `{{GOAL}}` or `[placeholder]`)105- [ ] Plan is valid markdown (can be read without parse errors)106107### Step 7: Confirm and Save1081091. Present the plan preview to the user via `ask_user_question`:110 - Show: tier selected, filename, first 500 characters of the plan1112. Ask: "Shall I save this plan to `[filename]`?"112 - Options: Yes, Edit (iterate on sections), Cancel1133. If Yes: Write the file and confirm.1144. If Edit: Iterate on specific sections the user wants changed.1155. If Cancel: Discard and exit.1166. Return the file path and a brief summary.117118## Edge Cases119120Seven edge cases commonly encountered during generation: template loading failure, filename collisions, tier override after preview, minimal research findings, unit count/complexity mismatch, empty complex sections, and multiple plans with same date/title. For handling strategies, decision trees, and examples, see **[edge-cases.md](references/edge-cases.md)**.121122## References123124- **Templates:** `pwrl-plan/references/plan-templates.md` (created by S1)125- **Tier Heuristic:** `pwrl-plan-generate/references/tier-heuristic.md`126- **Input:** Scoped context (S2) + Research findings (S3) + Units (S4)127- **Output:** `docs/plans/YYYY-MM-DD-NNN-<name>.md`128- **Learnings:** `docs/learnings/INDEX.md` for embedding129130```131132```