Launch brainstorming for new product requirement document.
Usage
code
/pm:prd-new <feature_name>
Required Rules
IMPORTANT: Before executing this command, read and follow:
.claude/rules/datetime.md - For getting real current date/time
Preflight Checklist
Before proceeding, complete these validation steps.
Do not bother the user with preflight checks progress ("I'm not going to ..."). Just do them and move on.
Input Validation
Validate feature name format:
Must contain only lowercase letters, numbers, and hyphens
Must start with a letter
No spaces or special characters allowed
If invalid, tell user: "❌ Feature name must be kebab-case (lowercase letters, numbers, hyphens only). Examples: user-auth, payment-v2, notification-system"
Check for existing PRD:
Check if .claude/prds/.md already exists
If it exists, ask user: "⚠️ PRD '' already exists. Do you want to overwrite it? (yes/no)"
Only proceed with explicit 'yes' confirmation
If user says no, suggest: "Use a different name or run: /pm:prd-parse to create an epic from the existing PRD"
Verify directory structure:
Check if .claude/prds/ directory exists
If not, create it first
If unable to create, tell user: "❌ Cannot create PRD directory. Please manually create: .claude/prds/"
Instructions
You are a product manager creating a comprehensive Product Requirements Document (PRD) for: ****
Follow this structured approach:
1. Discovery & Context
Ask clarifying questions about the feature/product ""
Understand the problem being solved
Identify target users and use cases
Gather constraints and requirements
2. PRD Structure
Create a comprehensive PRD with these sections:
Executive Summary
Brief overview and value proposition
Problem Statement
What problem are we solving?
Why is this important now?
User Stories
Primary user personas
Detailed user journeys
Pain points being addressed
Requirements
Functional Requirements
Core features and capabilities
User interactions and flows
Non-Functional Requirements
Performance expectations
Security considerations
Scalability needs
Success Criteria
Measurable outcomes
Key metrics and KPIs
Constraints & Assumptions
Technical limitations
Timeline constraints
Resource limitations
Out of Scope
What we're explicitly NOT building
Dependencies
External dependencies
Internal team dependencies
3. File Format with Frontmatter
Save the completed PRD to: .claude/prds/.md with this exact structure:
markdown
---
name:
description: [Brief one-line description of the PRD]
status: backlog
created: [Current ISO date/time]
---
# PRD:
## Executive Summary
[Content...]
## Problem Statement
[Content...]
[Continue with all sections...]
4. Frontmatter Guidelines
name: Use the exact feature name (same as )
description: Write a concise one-line summary of what this PRD covers
status: Always start with "backlog" for new PRDs
created: Get REAL current datetime by running: date -u +"%Y-%m-%dT%H:%M:%SZ"
Never use placeholder text
Must be actual system time in ISO 8601 format
5. Quality Checks
Before saving the PRD, verify:
All sections are complete (no placeholder text)
User stories include acceptance criteria
Success criteria are measurable
Dependencies are clearly identified
Out of scope items are explicitly listed
6. Post-Creation
After successfully creating the PRD:
Confirm: "✅ PRD created: .claude/prds/.md"
Show brief summary of what was captured
Suggest next step: "Ready to create implementation epic? Run: /pm:prd-parse "
Error Recovery
If any step fails:
Clearly explain what went wrong
Provide specific steps to fix the issue
Never leave partial or corrupted files
Conduct a thorough brainstorming session before writing the PRD. Ask questions, explore edge cases, and ensure comprehensive coverage of the feature requirements for "".
Assistant
I need a feature name to create the PRD. What feature are you building?
The name must be kebab-case (e.g., user-auth, recipe-sharing, notification-system).
Launch brainstorming for new product requirement document.
Usage
code
/pm:prd-new <feature_name>
Required Rules
IMPORTANT: Before executing this command, read and follow:
.claude/rules/datetime.md - For getting real current date/time
Preflight Checklist
Before proceeding, complete these validation steps.
Do not bother the user with preflight checks progress ("I'm not going to ..."). Just do them and move on.
Input Validation
Validate feature name format:
Must contain only lowercase letters, numbers, and hyphens
Must start with a letter
No spaces or special characters allowed
If invalid, tell user: "❌ Feature name must be kebab-case (lowercase letters, numbers, hyphens only). Examples: user-auth, payment-v2, notification-system"
Check for existing PRD:
Check if .claude/prds/missing-ingredients-per-recipe-fix.md already exists
If it exists, ask user: "⚠️ PRD 'missing-ingredients-per-recipe-fix' already exists. Do you want to overwrite it? (yes/no)"
Only proceed with explicit 'yes' confirmation
If user says no, suggest: "Use a different name or run: /pm:prd-parse missing-ingredients-per-recipe-fix to create an epic from the existing PRD"
Verify directory structure:
Check if .claude/prds/ directory exists
If not, create it first
If unable to create, tell user: "❌ Cannot create PRD directory. Please manually create: .claude/prds/"
Instructions
You are a product manager creating a comprehensive Product Requirements Document (PRD) for: missing-ingredients-per-recipe-fix
Follow this structured approach:
1. Discovery & Context
Ask clarifying questions about the feature/product "missing-ingredients-per-recipe-fix"
Understand the problem being solved
Identify target users and use cases
Gather constraints and requirements
2. PRD Structure
Create a comprehensive PRD with these sections:
Executive Summary
Brief overview and value proposition
Problem Statement
Assistant
Let me understand the current state before asking questions.
Assistant
Good context gathered. Now let me ask one focused question to understand the specific problem.
What specific behavior is currently broken or wrong with missing ingredients? For example:
a) The missing ingredients shown per recipe are incorrect (wrong items, wrong amounts)
b) All recipes show the same combined missing ingredients instead of their own specific ones
c) The "Need to Buy" section per recipe conflicts with or duplicates the shopping list
d) Something else entirely
User
d) Sometimes, the LLM groups the entire shoppingList into the missingIngredients of one recipe. Maybe the LLM prompt can be misunderstood?
Assistant
I see it clearly now. Rule 13 says "combine them in the missingIngredients array" without specifying which recipe's array — so the LLM sometimes dumps everything into one recipe. The per-recipe and aggregated concepts are blurred.
Before designing the fix: what should per-recipe missingIngredients ideally contain?
a) Each recipe lists only what that specific recipe needs to buy (at that recipe's amount), and shoppingList handles the cross-recipe aggregation separately
b) Per-recipe missingIngredients should be removed entirely — just use the global shoppingList
c) Something else
User
a) is the desired begaviour
Assistant
Good. The problem is entirely in the prompt — specifically rule 13 conflates per-recipe scope with cross-recipe aggregation. The data model and UI are already correct.
Here's the design — let me present it in sections.
Section 1: Root Cause
Rule 13 currently reads:
"If the same ingredient is missing in different recipes, combine them in the missingIngredients array and total the amount needed."
The phrase "combine them in the missingIngredients array" is ambiguous — it doesn't say which recipe's array, so the LLM sometimes collapses all missing ingredients from the entire meal plan into one recipe. There's also no explicit statement that each recipe's missingIngredients should be scoped to that recipe only.
The shoppingList field already exists at the meal plan level for cross-recipe aggregation. Rule 13 is incorrectly blurring those two responsibilities.
Does this diagnosis look right so far?
User
Yes, this seems right. What other rules or parts of the prompt mention shoppingList or missingIngredients?
Assistant
Here's every mention, from the prompt I already read:
missingIngredients references:
Rule 8: "supplement with additional ingredients… add them to the missingIngredients array" (and empty-pantry variant: "All ingredients will need to be purchased and should be listed in the missingIngredients array")
Rule 12: must ONLY contain items to buy, exclude available spices
Rule 13: (the broken one)
Rule 15: "Ensure missingIngredients is a list of distinct objects, not one combined string"
Rule 16: if buying spices/staples, use missingIngredients
JSON structure example: shows it as a field inside each recipe
shoppingList references:
Spice label text: "Available Spices/Staples (Do NOT add to shopping list)" — implicit mention
JSON structure example: shows it as a top-level field alongside recipes
Critical gap: There are no explicit rules describing what shoppingList should contain or how it relates to missingIngredients. The LLM has to infer the relationship, which is unreliable.
Section 2: Proposed Fix
Two changes to the prompt rules:
Rewrite rule 13 to make per-recipe scope explicit:
"Each recipe's missingIngredients must list only what that specific recipe requires to be purchased, at the amount needed for that recipe alone. Do not combine amounts across recipes here."
Add a new rule describing shoppingList's role:
"The top-level shoppingList is the aggregated shopping list across all recipes. If the same ingredient appears in multiple recipes, combine the amounts here."
No data model changes, no UI changes, no new dependencies. Pure prompt fix.
Does this look right, or do you want to adjust the wording?
Root cause: rule 13 in buildRecipePrompt() ambiguously says "combine them in the missingIngredients array" without specifying which recipe's array
Secondary gap: no rule ever defines what shoppingList is for
Fix: rewrite rule 13 for per-recipe scope + add one new rule for shoppingList aggregation
Scope: single file change (src/services/llm.ts) + test update
No data model, UI, schema, or dependency changes
Ready to create implementation epic? Run: /pm:prd-parse missing-ingredients-per-recipe-fix
User
pm:prd-parse
/pm:prd-parse
User
PRD Parse
Convert PRD to technical implementation epic.
Usage
code
/pm:prd-parse <feature_name>
Required Rules
IMPORTANT: Before executing this command, read and follow:
.claude/rules/datetime.md - For getting real current date/time
Preflight Checklist
Before proceeding, complete these validation steps.
Do not bother the user with preflight checks progress ("I'm not going to ..."). Just do them and move on.
Validation Steps
Verify <feature_name> was provided as a parameter:
If not, tell user: "❌ <feature_name> was not provided as parameter. Please run: /pm:prd-parse <feature_name>"
Stop execution if <feature_name> was not provided
Verify PRD exists:
Check if .claude/prds/.md exists
If not found, tell user: "❌ PRD not found: . First create it with: /pm:prd-new "
Stop execution if PRD doesn't exist
Validate PRD frontmatter:
Verify PRD has valid frontmatter with: name, description, status, created
If frontmatter is invalid or missing, tell user: "❌ Invalid PRD frontmatter. Please check: .claude/prds/.md"
Show what's missing or invalid
Check for existing epic:
Check if .claude/epics//epic.md already exists
If it exists, ask user: "⚠️ Epic '' already exists. Overwrite? (yes/no)"
Only proceed with explicit 'yes' confirmation
If user says no, suggest: "View existing epic with: /pm:epic-show "
Verify directory permissions:
Ensure .claude/epics/ directory exists or can be created
IMPORTANT: Before executing this command, read and follow:
.claude/rules/datetime.md - For getting real current date/time
Preflight Checklist
Before proceeding, complete these validation steps.
Do not bother the user with preflight checks progress ("I'm not going to ..."). Just do them and move on.
Validation Steps
Verify <feature_name> was provided as a parameter:
If not, tell user: "❌ <feature_name> was not provided as parameter. Please run: /pm:prd-parse <feature_name>"
Stop execution if <feature_name> was not provided
Verify PRD exists:
Check if .claude/prds/missing-ingredients-per-recipe-fix.md exists
If not found, tell user: "❌ PRD not found: missing-ingredients-per-recipe-fix. First create it with: /pm:prd-new missing-ingredients-per-recipe-fix"
Stop execution if PRD doesn't exist
Validate PRD frontmatter:
Verify PRD has valid frontmatter with: name, description, status, created
If frontmatter is invalid or missing, tell user: "❌ Invalid PRD frontmatter. Please check: .claude/prds/missing-ingredients-per-recipe-fix.md"
Show what's missing or invalid
Check for existing epic:
Check if .claude/epics/missing-ingredients-per-recipe-fix/epic.md already exists
If it exists, ask user: "⚠️ Epic 'missing-ingredients-per-recipe-fix' already exists. Overwrite? (yes/no)"
Only proceed with explicit 'yes' confirmation
If user says no, suggest: "View existing epic with: /pm:epic-show missing-ingredients-per-recipe-fix"
Verify directory permissions:
Ensure .claude/epics/ directory exists or can be created
IMPORTANT: Before executing this command, read and follow:
.claude/rules/datetime.md - For getting real current date/time
Preflight Checklist
Before proceeding, complete these validation steps.
Do not bother the user with preflight checks progress ("I'm not going to ..."). Just do them and move on.
Verify epic exists:
Check if .claude/epics/missing-ingredients-per-recipe-fix/epic.md exists
If not found, tell user: "❌ Epic not found: missing-ingredients-per-recipe-fix. First create it with: /pm:prd-parse missing-ingredients-per-recipe-fix"
Stop execution if epic doesn't exist
Check for existing tasks:
Check if any numbered task files (001.md, 002.md, etc.) already exist in .claude/epics/missing-ingredients-per-recipe-fix/
If tasks exist, list them and ask: "⚠️ Found {count} existing tasks. Delete and recreate all tasks? (yes/no)"
Only proceed with explicit 'yes' confirmation
If user says no, suggest: "View existing tasks with: /pm:epic-show missing-ingredients-per-recipe-fix"
Validate epic frontmatter:
Verify epic has valid frontmatter with: name, status, created, prd
# Verify epic exists
test -f .claude/epics/missing-ingredients-per-recipe-fix/epic.md || echo "❌ Epic not found. Run: /pm:prd-parse missing-ingredients-per-recipe-fix"
# Count task files
ls .claude/epics/missing-ingredients-per-recipe-fix/*.md 2>/dev/null | grep -v epic.md | wc -l
If no tasks found: "❌ No tasks to sync. Run: /pm:epic-decompose missing-ingredients-per-recipe-fix"
Instructions
0. Check Remote Repository
Follow /rules/github-operations.md to ensure we're not syncing to the CCPM template:
bash
# Check if remote origin is the CCPM template repository
remote_url=$(git remote get-url origin 2>/dev/null || echo "")
if [[ "$remote_url" == *"automazeio/ccpm"* ]] || [[ "$remote_url" == *"automazeio/ccpm.git"* ]]; then
echo "❌ ERROR: You're trying to sync with the CCPM template repository!"
echo ""
echo "This repository (automazeio/ccpm) is a template for others to use."
echo "You should NOT create issues or PRs here."
echo ""
echo "To fix this:"
echo "1. Fork this repository to your own GitHub account"
echo "2. Update your remote origin:"
echo " git remote set-url origin https://github.com/YOUR_USERNAME/YOUR_REPO.git"
echo ""
echo "Or if this is a new project:"
echo "1. Create a new repository on GitHub"
echo "2. Update your remote origin:"
echo " git remote set-url origin https://github.com/YOUR_USERNAME/YOUR_REPO.git"
echo ""
echo "Current remote: $remote_url"
exit 1
fi
Assistant
Both issues created. Now rename the task file and update frontmatter.
Assistant
Now update the Tasks Created section in the epic and create the mapping file:
Begin work on a GitHub issue with parallel agents based on work stream analysis.
Usage
code
/pm:issue-start <issue_number>
Quick Check
Get issue details:
bash
gh issue view 165 --json state,title,labels,body
If it fails: "❌ Cannot access issue #165. Check number or run: gh auth login"
Find local task file:
First check if .claude/epics/*/165.md exists (new naming)
If not found, search for file containing github:.*issues/165 in frontmatter (old naming)
If not found: "❌ No local task for issue #165. This issue may have been created outside the PM system."
Check for analysis:
bash
test -f .claude/epics/*/165-analysis.md || echo "❌ No analysis found for issue #165
Run: /pm:issue-analyze 165 first
Or: /pm:issue-start 165 --analyze to do both"
If no analysis exists and no --analyze flag, stop execution.
Instructions
1. Ensure Worktree Exists
Check if epic worktree exists:
bash
# Find epic name from task file
epic_name={extracted_from_path}
# Check worktree
if ! git worktree list | grep -q "epic-$epic_name"; then
echo "❌ No worktree for epic. Run: /pm:epic-start $epic_name"
exit 1
fi
2. Read Analysis
Read .claude/epics/{epic_name}/165-analysis.md:
Parse parallel streams
Identify which can start immediately
Note dependencies between streams
3. Setup Progress Tracking
Get current datetime: date -u +"%Y-%m-%dT%H:%M:%SZ"
Create workspace structure:
bash
mkdir -p .claude/epics/{epic_name}/updates/165
Update task file frontmatter field with current datetime.
Assistant
❌ No analysis found for issue #165.
Run /pm:issue-analyze 165 first to generate the work stream analysis, then re-run /pm:issue-start 165.
User
I need to ask a meta-question here, this task is done! When you tried createing the issue using the gh command, the label "epic:missing-ingredients-per-recipe-fix" didn't exist. This is not surprising, it would need to be created first. The "epic" label, however, does exist, but it didn't return as an existing label when you listed the labels. This is puzzling.
Two questions:
It doesn't really make sense to create a label for each seperate epic, does it? Does the pm-command specifically state that each label should exist?
Why didn't the "epic" label not return as existing when parisng the available labels?
Assistant
Good questions both.
Question 1: Per-epic labels
The command template does explicitly use "epic,epic:missing-ingredients-per-recipe-fix" as labels — both on the epic issue and on every task issue. The intent is GitHub-side filtering: you can find all issues belonging to a specific epic by filtering on the epic:name label. But the command never creates the label first — that's a gap. For a personal project this is overkill. The sub-issue relationship already captures the epic↔task link structurally. The epic:name label would only add value if you had many epics running simultaneously and wanted to filter by label on GitHub. Not worth the overhead here.
Question 2: Why "epic" didn't appear in the list
Almost certainly my fault: I piped through | head -20, which hard-truncated the output to 20 lines. If "epic" is label #21 or later alphabetically/by creation order, it was silently cut off. The fact that the --label "epic" call didn't produce an error (only epic:missing-ingredients-per-recipe-fix errored) confirms "epic" does exist in the repo — it just wasn't visible in my truncated listing.
So two things to note for the command going forward:
Remove the | head -20 guard when listing labels (or use --limit 100)
Either drop per-epic labels entirely (sub-issues are sufficient), or add a label-creation step before trying to apply them
User
Can you check where in the .claude/commands files you are instructed to create or at least assign these labels? And where would the truncate limit go?
Assistant· <synthetic>
You've hit your limit · resets 8pm (Europe/Zurich)
Suggest next step: "Ready to create implementation epic? Run: /pm:prd-parse missing-ingredients-per-recipe-fix"
Error Recovery
If any step fails:
Clearly explain what went wrong
Provide specific steps to fix the issue
Never leave partial or corrupted files
Conduct a thorough brainstorming session before writing the PRD. Ask questions, explore edge cases, and ensure comprehensive coverage of the feature requirements for "missing-ingredients-per-recipe-fix".
2. Technical Analysis
Identify architectural decisions needed
Determine technology stack and approaches
Map functional requirements to technical components
Identify integration points and dependencies
3. File Format with Frontmatter
Create the epic file at: .claude/epics//epic.md with this exact structure:
markdown
---
name:
status: backlog
created: [Current ISO date/time]
progress: 0%
prd: .claude/prds/.md
github: [Will be updated when synced to GitHub]
---
# Epic:
## Overview
Brief technical summary of the implementation approach
## Architecture Decisions
- Key technical decisions and rationale
- Technology choices
- Design patterns to use
## Technical Approach
### Frontend Components
- UI components needed
- State management approach
- User interaction patterns
### Backend Services
- API endpoints required
- Data models and schema
- Business logic components
### Infrastructure
- Deployment considerations
- Scaling requirements
- Monitoring and observability
## Implementation Strategy
- Development phases
- Risk mitigation
- Testing approach
## Task Breakdown Preview
High-level task categories that will be created:
- [ ] Category 1: Description
- [ ] Category 2: Description
- [ ] etc.
## Dependencies
- External service dependencies
- Internal team dependencies
- Prerequisite work
## Success Criteria (Technical)
- Performance benchmarks
- Quality gates
- Acceptance criteria
## Estimated Effort
- Overall timeline estimate
- Resource requirements
- Critical path items
4. Frontmatter Guidelines
name: Use the exact feature name (same as )
status: Always start with "backlog" for new epics
created: Get REAL current datetime by running: date -u +"%Y-%m-%dT%H:%M:%SZ"
progress: Always start with "0%" for new epics
prd: Reference the source PRD file path
github: Leave placeholder text - will be updated during sync
5. Output Location
Create the directory structure if it doesn't exist:
.claude/epics// (directory)
.claude/epics//epic.md (epic file)
6. Quality Validation
Before saving the epic, verify:
All PRD requirements are addressed in the technical approach
Task breakdown categories cover all implementation areas
Dependencies are technically accurate
Effort estimates are realistic
Architecture decisions are justified
7. Post-Creation
After successfully creating the epic:
Confirm: "✅ Epic created: .claude/epics//epic.md"
Show summary of:
Number of task categories identified
Key architecture decisions
Estimated effort
Suggest next step: "Ready to break down into tasks? Run: /pm:epic-decompose "
Error Recovery
If any step fails:
Clearly explain what went wrong
If PRD is incomplete, list specific missing sections
If technical approach is unclear, identify what needs clarification
Never create an epic with incomplete information
Focus on creating a technically sound implementation plan that addresses all PRD requirements while being practical and achievable for "".
IMPORTANT:
Aim for as few tasks as possible and limit the total number of tasks to 10 or less.
When creating the epic, identify ways to simplify and improve it. Look for ways to leverage existing functionality instead of creating more code when possible.
Load the PRD from .claude/prds/missing-ingredients-per-recipe-fix.md
Analyze all requirements and constraints
Understand the user stories and success criteria
Extract the PRD description from frontmatter
2. Technical Analysis
Identify architectural decisions needed
Determine technology stack and approaches
Map functional requirements to technical components
Identify integration points and dependencies
3. File Format with Frontmatter
Create the epic file at: .claude/epics/missing-ingredients-per-recipe-fix/epic.md with this exact structure:
markdown
---
name: missing-ingredients-per-recipe-fix
status: backlog
created: [Current ISO date/time]
progress: 0%
prd: .claude/prds/missing-ingredients-per-recipe-fix.md
github: [Will be updated when synced to GitHub]
---
# Epic: missing-ingredients-per-recipe-fix
## Overview
Brief technical summary of the implementation approach
## Architecture Decisions
- Key technical decisions and rationale
- Technology choices
- Design patterns to use
## Technical Approach
### Frontend Components
- UI components needed
- State management approach
- User interaction patterns
### Backend Services
- API endpoints required
- Data models and schema
- Business logic components
### Infrastructure
- Deployment considerations
- Scaling requirements
- Monitoring and observability
## Implementation Strategy
- Development phases
- Risk mitigation
- Testing approach
## Task Breakdown Preview
High-level task categories that will be created:
- [ ] Category 1: Description
- [ ] Category 2: Description
- [ ] etc.
## Dependencies
- External service dependencies
- Internal team dependencies
- Prerequisite work
## Success Criteria (Technical)
- Performance benchmarks
- Quality gates
- Acceptance criteria
## Estimated Effort
- Overall timeline estimate
- Resource requirements
- Critical path items
4. Frontmatter Guidelines
name: Use the exact feature name (same as missing-ingredients-per-recipe-fix)
status: Always start with "backlog" for new epics
created: Get REAL current datetime by running: date -u +"%Y-%m-%dT%H:%M:%SZ"
progress: Always start with "0%" for new epics
prd: Reference the source PRD file path
github: Leave placeholder text - will be updated during sync
5. Output Location
Create the directory structure if it doesn't exist:
Suggest next step: "Ready to break down into tasks? Run: /pm:epic-decompose missing-ingredients-per-recipe-fix"
Error Recovery
If any step fails:
Clearly explain what went wrong
If PRD is incomplete, list specific missing sections
If technical approach is unclear, identify what needs clarification
Never create an epic with incomplete information
Focus on creating a technically sound implementation plan that addresses all PRD requirements while being practical and achievable for "missing-ingredients-per-recipe-fix".
IMPORTANT:
Aim for as few tasks as possible and limit the total number of tasks to 10 or less.
When creating the epic, identify ways to simplify and improve it. Look for ways to leverage existing functionality instead of creating more code when possible.
If tasks have complex dependencies: Create sequentially
For best results: Group independent tasks for parallel creation
3. Parallel Task Creation (When Possible)
If tasks can be created in parallel, spawn sub-agents:
yaml
Task:
description: "Create task files batch {X}"
subagent_type: "general-purpose"
prompt: |
Create task files for epic: missing-ingredients-per-recipe-fix
Tasks to create:
- {list of 3-4 tasks for this batch}
For each task:
1. Create file: .claude/epics/missing-ingredients-per-recipe-fix/{number}.md
2. Use exact format with frontmatter and all sections
3. Follow task breakdown from epic
4. Set parallel/depends_on fields appropriately
5. Number sequentially (001.md, 002.md, etc.)
Return: List of files created
4. Task File Format with Frontmatter
For each task, create a file with this exact structure:
markdown
---
name: [Task Title]
status: open
created: [Current ISO date/time]
updated: [Current ISO date/time]
github: [Will be updated when synced to GitHub]
depends_on: [] # List of task numbers this depends on, e.g., [001, 002]
parallel: true # Can this run in parallel with other tasks?
conflicts_with: [] # Tasks that modify same files, e.g., [003, 004]
---
# Task: [Task Title]
## Description
Clear, concise description of what needs to be done
## Acceptance Criteria
- [ ] Specific criterion 1
- [ ] Specific criterion 2
- [ ] Specific criterion 3
## Technical Details
- Implementation approach
- Key considerations
- Code locations/files affected
## Dependencies
- [ ] Task/Issue dependencies
- [ ] External dependencies
## Effort Estimate
- Size: XS/S/M/L/XL
- Hours: estimated hours
- Parallel: true/false (can run in parallel with other tasks)
## Definition of Done
- [ ] Code implemented
- [ ] Tests written and passing
- [ ] Documentation updated
- [ ] Code reviewed
- [ ] Deployed to staging
3. Task Naming Convention
Save tasks as: .claude/epics/missing-ingredients-per-recipe-fix/{task_number}.md
Use sequential numbering: 001.md, 002.md, etc.
Keep task titles short but descriptive
4. Frontmatter Guidelines
name: Use a descriptive task title (without "Task:" prefix)
status: Always start with "open" for new tasks
created: Get REAL current datetime by running: date -u +"%Y-%m-%dT%H:%M:%SZ"
updated: Use the same real datetime as created for new tasks
github: Leave placeholder text - will be updated during sync
depends_on: List task numbers that must complete before this can start (e.g., [001, 002])
parallel: Set to true if this can run alongside other tasks without conflicts
conflicts_with: List task numbers that modify the same files (helps coordination)
Ensure referenced dependencies exist (e.g., if Task 003 depends on Task 002, verify 002 was created)
Check for circular dependencies (Task A → Task B → Task A)
If dependency issues found, warn but continue: "⚠️ Task dependency warning: {details}"
9. Update Epic with Task Summary
After creating all tasks, update the epic file by adding this section:
markdown
## Tasks Created
- [ ] 001.md - {Task Title} (parallel: true/false)
- [ ] 002.md - {Task Title} (parallel: true/false)
- etc.
Total tasks: {count}
Parallel tasks: {parallel_count}
Sequential tasks: {sequential_count}
Estimated total effort: {sum of hours}
Also update the epic's frontmatter progress if needed (still 0% until tasks actually start).
9. Quality Validation
Before finalizing tasks, verify:
All tasks have clear acceptance criteria
Task sizes are reasonable (1-3 days each)
Dependencies are logical and achievable
Parallel tasks don't conflict with each other
Combined tasks cover all epic requirements
10. Post-Decomposition
After successfully creating tasks:
Confirm: "✅ Created {count} tasks for epic: missing-ingredients-per-recipe-fix"
Show summary:
Total tasks created
Parallel vs sequential breakdown
Total estimated effort
Suggest next step: "Ready to sync to GitHub? Run: /pm:epic-sync missing-ingredients-per-recipe-fix"
Error Recovery
If any step fails:
If task creation partially completes, list which tasks were created
Provide option to clean up partial tasks
Never leave the epic in an inconsistent state
Aim for tasks that can be completed in 1-3 days each. Break down larger tasks into smaller, manageable pieces for the "missing-ingredients-per-recipe-fix" epic.
1. Create Epic Issue
First, detect the GitHub repository:
bash
# Get the current repository from git remote
remote_url=$(git remote get-url origin 2>/dev/null || echo "")
REPO=$(echo "$remote_url" | sed 's|.*github.com[:/]||' | sed 's|\.git$||')
[ -z "$REPO" ] && REPO="user/repo"
echo "Creating issues in repository: $REPO"
Strip frontmatter and prepare GitHub issue body:
bash
# Extract content without frontmatter
sed '1,/^---$/d; 1,/^---$/d' .claude/epics/missing-ingredients-per-recipe-fix/epic.md > /tmp/epic-body-raw.md
# Remove "## Tasks Created" section and replace with Stats
awk '
/^## Tasks Created/ {
in_tasks=1
next
}
/^## / && in_tasks {
in_tasks=0
# When we hit the next section after Tasks Created, add Stats
if (total_tasks) {
print "## Stats"
print ""
print "Total tasks: " total_tasks
print "Parallel tasks: " parallel_tasks " (can be worked on simultaneously)"
print "Sequential tasks: " sequential_tasks " (have dependencies)"
if (total_effort) print "Estimated total effort: " total_effort " hours"
print ""
}
}
/^Total tasks:/ && in_tasks { total_tasks = ; next }
/^Parallel tasks:/ && in_tasks { parallel_tasks = ; next }
/^Sequential tasks:/ && in_tasks { sequential_tasks = ; next }
/^Estimated total effort:/ && in_tasks {
gsub(/^Estimated total effort: /, "")
total_effort = missing-ingredients-per-recipe-fix
next
}
!in_tasks { print }
END {
# If we were still in tasks section at EOF, add stats
if (in_tasks && total_tasks) {
print "## Stats"
print ""
print "Total tasks: " total_tasks
print "Parallel tasks: " parallel_tasks " (can be worked on simultaneously)"
print "Sequential tasks: " sequential_tasks " (have dependencies)"
if (total_effort) print "Estimated total effort: " total_effort
}
}
' /tmp/epic-body-raw.md > /tmp/epic-body.md
# Determine epic type (feature vs bug) from content
if grep -qi "bug\|fix\|issue\|problem\|error" /tmp/epic-body.md; then
epic_type="bug"
else
epic_type="feature"
fi
# Create epic issue with labels
epic_number=$(gh issue create \
--repo "$REPO" \
--title "Epic: missing-ingredients-per-recipe-fix" \
--body-file /tmp/epic-body.md \
--label "epic,epic:missing-ingredients-per-recipe-fix,$epic_type" \
--json number -q .number)
Store the returned issue number for epic frontmatter update.
2. Create Task Sub-Issues
Check if gh-sub-issue is available:
bash
if gh extension list | grep -q "yahsan2/gh-sub-issue"; then
use_subissues=true
else
use_subissues=false
echo "⚠️ gh-sub-issue not installed. Using fallback mode."
fi
For Small Batches (< 5 tasks): Sequential Creation
bash
if [ "$task_count" -lt 5 ]; then
# Create sequentially for small batches
for task_file in .claude/epics/missing-ingredients-per-recipe-fix/[0-9][0-9][0-9].md; do
[ -f "$task_file" ] || continue
# Extract task name from frontmatter
task_name=$(grep '^name:' "$task_file" | sed 's/^name: *//')
# Strip frontmatter from task content
sed '1,/^---$/d; 1,/^---$/d' "$task_file" > /tmp/task-body.md
# Create sub-issue with labels
if [ "$use_subissues" = true ]; then
task_number=$(gh sub-issue create \
--parent "$epic_number" \
--title "$task_name" \
--body-file /tmp/task-body.md \
--label "task,epic:missing-ingredients-per-recipe-fix" \
--json number -q .number)
else
task_number=$(gh issue create \
--repo "$REPO" \
--title "$task_name" \
--body-file /tmp/task-body.md \
--label "task,epic:missing-ingredients-per-recipe-fix" \
--json number -q .number)
fi
# Record mapping for renaming
echo "$task_file:$task_number" >> /tmp/task-mapping.txt
done
# After creating all issues, update references and rename files
# This follows the same process as step 3 below
fi
For Larger Batches: Parallel Creation
bash
if [ "$task_count" -ge 5 ]; then
echo "Creating $task_count sub-issues in parallel..."
# Check if gh-sub-issue is available for parallel agents
if gh extension list | grep -q "yahsan2/gh-sub-issue"; then
subissue_cmd="gh sub-issue create --parent $epic_number"
else
subissue_cmd="gh issue create --repo \"$REPO\""
fi
# Batch tasks for parallel processing
# Spawn agents to create sub-issues in parallel with proper labels
# Each agent must use: --label "task,epic:missing-ingredients-per-recipe-fix"
fi
Use Task tool for parallel creation:
yaml
Task:
description: "Create GitHub sub-issues batch {X}"
subagent_type: "general-purpose"
prompt: |
Create GitHub sub-issues for tasks in epic missing-ingredients-per-recipe-fix
Parent epic issue: #$epic_number
Tasks to process:
- {list of 3-4 task files}
For each task file:
1. Extract task name from frontmatter
2. Strip frontmatter using: sed '1,/^---$/d; 1,/^---$/d'
3. Create sub-issue using:
- If gh-sub-issue available:
gh sub-issue create --parent $epic_number --title "$task_name" \
--body-file /tmp/task-body.md --label "task,epic:missing-ingredients-per-recipe-fix"
- Otherwise:
gh issue create --repo "$REPO" --title "$task_name" --body-file /tmp/task-body.md \
--label "task,epic:missing-ingredients-per-recipe-fix"
4. Record: task_file:issue_number
IMPORTANT: Always include --label parameter with "task,epic:missing-ingredients-per-recipe-fix"
Return mapping of files to issue numbers.
Consolidate results from parallel agents:
bash
# Collect all mappings from agents
cat /tmp/batch-*/mapping.txt >> /tmp/task-mapping.txt
# IMPORTANT: After consolidation, follow step 3 to:
# 1. Build old->new ID mapping
# 2. Update all task references (depends_on, conflicts_with)
# 3. Rename files with proper frontmatter updates
3. Rename Task Files and Update References
First, build a mapping of old numbers to new issue IDs:
bash
# Create mapping from old task numbers (001, 002, etc.) to new issue IDs
> /tmp/id-mapping.txt
while IFS=: read -r task_file task_number; do
# Extract old number from filename (e.g., 001 from 001.md)
old_num=$(basename "$task_file" .md)
echo "$old_num:$task_number" >> /tmp/id-mapping.txt
done < /tmp/task-mapping.txt
Then rename files and update all references:
bash
# Process each task file
while IFS=: read -r task_file task_number; do
new_name="$(dirname "$task_file")/${task_number}.md"
# Read the file content
content=$(cat "$task_file")
# Update depends_on and conflicts_with references
while IFS=: read -r old_num new_num; do
# Update arrays like [001, 002] to use new issue numbers
content=$(echo "$content" | sed "s/\b$old_num\b/$new_num/g")
done < /tmp/id-mapping.txt
# Write updated content to new file
echo "$content" > "$new_name"
# Remove old file if different from new
[ "$task_file" != "$new_name" ] && rm "$task_file"
# Update github field in frontmatter
# Add the GitHub URL to the frontmatter
repo=$(gh repo view --json nameWithOwner -q .nameWithOwner)
github_url="https://github.com/$repo/issues/$task_number"
# Update frontmatter with GitHub URL and current timestamp
current_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
# Use sed to update the github and updated fields
sed -i.bak "/^github:/c\github: $github_url" "$new_name"
sed -i.bak "/^updated:/c\updated: $current_date" "$new_name"
rm "${new_name}.bak"
done < /tmp/task-mapping.txt
4. Update Epic with Task List (Fallback Only)
If NOT using gh-sub-issue, add task list to epic:
bash
if [ "$use_subissues" = false ]; then
# Get current epic body
gh issue view ${epic_number} --json body -q .body > /tmp/epic-body.md
# Append task list
cat >> /tmp/epic-body.md << 'EOF'
## Tasks
- [ ] #${task1_number} ${task1_name}
- [ ] #${task2_number} ${task2_name}
- [ ] #${task3_number} ${task3_name}
EOF
# Update epic issue
gh issue edit ${epic_number} --body-file /tmp/epic-body.md
fi
With gh-sub-issue, this is automatic!
5. Update Epic File
Update the epic file with GitHub URL, timestamp, and real task IDs:
5a. Update Frontmatter
bash
# Get repo info
repo=$(gh repo view --json nameWithOwner -q .nameWithOwner)
epic_url="https://github.com/$repo/issues/$epic_number"
current_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
# Update epic frontmatter
sed -i.bak "/^github:/c\github: $epic_url" .claude/epics/missing-ingredients-per-recipe-fix/epic.md
sed -i.bak "/^updated:/c\updated: $current_date" .claude/epics/missing-ingredients-per-recipe-fix/epic.md
rm .claude/epics/missing-ingredients-per-recipe-fix/epic.md.bak
5b. Update Tasks Created Section
bash
# Create a temporary file with the updated Tasks Created section
cat > /tmp/tasks-section.md << 'EOF'
## Tasks Created
EOF
# Add each task with its real issue number
for task_file in .claude/epics/missing-ingredients-per-recipe-fix/[0-9]*.md; do
[ -f "$task_file" ] || continue
# Get issue number (filename without .md)
issue_num=$(basename "$task_file" .md)
# Get task name from frontmatter
task_name=$(grep '^name:' "$task_file" | sed 's/^name: *//')
# Get parallel status
parallel=$(grep '^parallel:' "$task_file" | sed 's/^parallel: *//')
# Add to tasks section
echo "- [ ] #${issue_num} - ${task_name} (parallel: ${parallel})" >> /tmp/tasks-section.md
done
# Add summary statistics
total_count=$(ls .claude/epics/missing-ingredients-per-recipe-fix/[0-9]*.md 2>/dev/null | wc -l)
parallel_count=$(grep -l '^parallel: true' .claude/epics/missing-ingredients-per-recipe-fix/[0-9]*.md 2>/dev/null | wc -l)
sequential_count=$((total_count - parallel_count))
cat >> /tmp/tasks-section.md << EOF
Total tasks: ${total_count}
Parallel tasks: ${parallel_count}
Sequential tasks: ${sequential_count}
EOF
# Replace the Tasks Created section in epic.md
# First, create a backup
cp .claude/epics/missing-ingredients-per-recipe-fix/epic.md .claude/epics/missing-ingredients-per-recipe-fix/epic.md.backup
# Use awk to replace the section
awk '
/^## Tasks Created/ {
skip=1
while ((getline line < "/tmp/tasks-section.md") > 0) print line
close("/tmp/tasks-section.md")
}
/^## / && !/^## Tasks Created/ { skip=0 }
!skip && !/^## Tasks Created/ { print }
' .claude/epics/missing-ingredients-per-recipe-fix/epic.md.backup > .claude/epics/missing-ingredients-per-recipe-fix/epic.md
# Clean up
rm .claude/epics/missing-ingredients-per-recipe-fix/epic.md.backup
rm /tmp/tasks-section.md
Follow /rules/worktree-operations.md to create development worktree:
bash
# Ensure main is current
git checkout main
git pull origin main
# Create worktree for epic
git worktree add ../epic-missing-ingredients-per-recipe-fix -b epic/missing-ingredients-per-recipe-fix
echo "✅ Created worktree: ../epic-missing-ingredients-per-recipe-fix"
8. Output
code
✅ Synced to GitHub
- Epic: #{epic_number} - {epic_title}
- Tasks: {count} sub-issues created
- Labels applied: epic, task, epic:{name}
- Files renamed: 001.md → {issue_id}.md
- References updated: depends_on/conflicts_with now use issue IDs
- Worktree: ../epic-missing-ingredients-per-recipe-fix
Next steps:
- Start parallel execution: /pm:epic-start missing-ingredients-per-recipe-fix
- Or work on single issue: /pm:issue-start {issue_number}
- View epic: https://github.com/{owner}/{repo}/issues/{epic_number}
Error Handling
Follow /rules/github-operations.md for GitHub CLI errors.
Task:
description: "Issue #165 Stream {X}"
subagent_type: "{agent_type}"
prompt: |
You are working on Issue #165 in the epic worktree.
Worktree location: ../epic-{epic_name}/
Your stream: {stream_name}
Your scope:
- Files to modify: {file_patterns}
- Work to complete: {stream_description}
Requirements:
1. Read full task from: .claude/epics/{epic_name}/{task_file}
2. Work ONLY in your assigned files
3. Commit frequently with format: "Issue #165: {specific change}"
4. Update progress in: .claude/epics/{epic_name}/updates/165/stream-{X}.md
5. Follow coordination rules in /rules/agent-coordination.md
If you need to modify files outside your scope:
- Check if another stream owns them
- Wait if necessary
- Update your progress file with coordination notes
Complete your stream's work and mark as completed when done.
5. GitHub Assignment
bash
# Assign to self and mark in-progress
gh issue edit 165 --add-assignee @me --add-label "in-progress"
6. Output
code
✅ Started parallel work on issue #165
Epic: {epic_name}
Worktree: ../epic-{epic_name}/
Launching {count} parallel agents:
Stream A: {name} (Agent-1) ✓ Started
Stream B: {name} (Agent-2) ✓ Started
Stream C: {name} - Waiting (depends on A)
Progress tracking:
.claude/epics/{epic_name}/updates/165/
Monitor with: /pm:epic-status {epic_name}
Sync updates: /pm:issue-sync 165
Error Handling
If any step fails, report clearly:
"❌ {What failed}: {How to fix}"
Continue with what's possible
Never leave partial state
Important Notes
Follow /rules/datetime.md for timestamps.
Keep it simple - trust that GitHub and file system work.