一键导入
decompose
Decompose a PRD into prioritized, dependency-mapped epics and user stories. Accepts pasted text, file path, or PDF.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Decompose a PRD into prioritized, dependency-mapped epics and user stories. Accepts pasted text, file path, or PDF.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Inject managed sections into existing CLAUDE.md and AGENTS.md after a plugin update without re-bootstrapping. Preserves all project-specific content.
Generate AI tool configuration for an existing project. Explores the codebase and produces context files, path-scoped pattern rules, landmine rules, and agents for Claude Code and VS Code Copilot. Run once per project.
Autonomously improve any skill prompt using a measure-change-test loop inspired by Karpathy's autoresearch. Runs the skill repeatedly, scores output against a yes/no checklist, makes one small change per round, keeps improvements, reverts regressions. Use when the user asks to "improve a skill", "optimize a skill", "autoimprove", "run autoresearch on a skill", or similar requests about iteratively improving skill quality.
Analyze code modules and files for refactoring opportunities, code smells, and architectural pattern violations in any language or framework. Use this skill when the user asks to "analyze code smells", "find refactoring opportunities", "check for code quality issues", or "review architecture" for a specific module or file.
Generate clear, descriptive git commit messages by analyzing staged changes. Use this skill when the user asks to "generate a commit message", "write a commit message", "create a commit message", or similar requests related to git commits.
Generate a pull request description by analyzing git changes against the target branch and filling in the project's PR template. Use this skill when the user asks to "generate PR description", "write PR description", "create PR body", "fill PR template", "prepare pull request", or similar requests related to pull request documentation.
| name | decompose |
| description | Decompose a PRD into prioritized, dependency-mapped epics and user stories. Accepts pasted text, file path, or PDF. |
| argument-hint | <PRD text, file path, or PDF path> |
Break down a Product Requirements Document into structured, prioritized user stories with dependency mapping. Produces a persistent story map that feeds individual stories into the existing /invert → layoutplan pipeline.
Use this when you receive a PRD, spec, or feature brief that is too large for a single /invert analysis — typically anything with multiple workflows, feature areas, or delivery phases.
The user provides PRD content in one of three forms:
Actions:
pages parameter. Read ALL chunks before proceeding; do not start scanning until the full document is loaded. For very large PDFs (60+ pages), note the page count in the scope summary so the user knows the full document was read.Do a lightweight scan of the PRD to identify:
Present the user with a scope summary before proceeding:
PRD Scan Results:
─────────────────
Workflows detected: [count] ([list])
Priority scheme: [MoSCoW / Phases / P0-P3 / None detected]
Feature areas: [count]
Estimated epics: [range]
Estimated stories: [range]
Delivery phases: [list if present]
Technical stack: [brief summary if present]
User personas: [count] ([names and roles])
AI Project: [Yes / No]
[If AI Project = Yes:]
AI components: [list specific components: RAG pipeline, LLM generation, embeddings, etc.]
This PRD describes an AI project. The chief-ai-po agent will produce AI-augmented stories
with inverted failure modes, safety stories, and graceful degradation criteria.
[If hard deadlines detected:]
Hard deadlines:
• [date] — [what happens] (e.g., "Nov 2026 — IFR opens applications")
• [date] — [what happens] (e.g., "Feb 2027 — final submission deadline")
These deadlines will be used to sequence story priority.
[If non-development sections detected:]
Skipping non-dev sections: [list — e.g., "Go-to-Market (§5.1-5.4), Pricing (§5.2), Sales Channels (§5.3)"]
These provide context but will NOT become user stories.
[If out-of-scope items detected:]
Out of scope (per PRD): [list — e.g., "Financial fair play, UEFA licensing, player transfers"]
No stories will be created for these items.
Options:
1. chief-ai-po only — AI-augmented stories (recommended for AI-native projects)
2. storymap only — standard stories (no AI-specific analysis)
3. Both — storymap first, then chief-ai-po augments with AI layer
[If AI Project = No:]
The storymap agent will run on a separate thread to decompose this PRD.
Proceed?
Wait for user approval before continuing.
Actions:
.plans/ directory if it doesn't existifr-compliance-platform, user-onboarding-v2).plans/PRD-<name>.md with a header:# PRD: <name>
**Ingested:** <date>
**Source:** <file path or "pasted text">
**Scope:** <one-line summary>
**Priority Scheme:** <MoSCoW / Phases / P0-P3 / Derived>
**AI Project:** <Yes (components: ...) / No>
**Personas:** <list of names and roles>
**Hard Deadlines:** <list of dates and events, or "None detected">
**Non-Dev Sections:** <list of sections skipped, or "None">
---
<full PRD content>
This serves as the input file for the storymap agent and as a permanent record.
Choose the agent based on AI project detection and the user's selection from Step 3.
Context to pass to every agent prompt (append to the decomposition instruction):
Option 1 — chief-ai-po only (AI projects):
Spawn the chief-ai-po agent on a separate thread:
"Decompose
.plans/PRD-<name>.mdinto AI-augmented epics and user stories. Write output to.plans/STORIES-AI-<name>.md. [Append context above.]"
The agent will produce stories with inverted failure modes, 6 mandatory AI safety stories (SA.1-SA.6), human oversight checkpoints, and graceful degradation criteria on every AI-touching story.
Option 2 — storymap only (non-AI projects, or user choice):
Spawn the storymap agent on a separate thread:
"Decompose
.plans/PRD-<name>.mdinto epics and user stories. Write output to.plans/STORIES-<name>.md. [Append context above.]"
The agent will identify epics, decompose into user stories with acceptance criteria, map dependencies, assign priorities, estimate sizes, and flag invert candidates.
Option 3 — Both (storymap then chief-ai-po):
Spawn storymap first. After it completes and writes .plans/STORIES-<name>.md, spawn chief-ai-po:
"Augment
.plans/PRD-<name>.mdwith AI-specific analysis. The base story map is at.plans/STORIES-<name>.md. Write output to.plans/STORIES-AI-<name>.md."
The chief-ai-po agent will read both files and produce an AI-augmented version that cross-references existing stories rather than duplicating them.
IMPORTANT: This step runs on the main thread after the storymap agent returns. You MUST complete this step — do not end the conversation after the agent summary.
Once the agent completes:
.plans/STORIES-<name>.md or .plans/STORIES-AI-<name>.md) and present a summaryPresent this as a single message:
Story Map: <name>
──────────────────
Epics: [count]
Stories: [count]
MUST: [count] stories
SHOULD: [count] stories
COULD: [count] stories
Suggested starting stories (no dependencies):
• S1.1 — <title> [size] [invert candidate?]
• S2.1 — <title> [size] [invert candidate?]
Full story map: .plans/STORIES-<name>.md
If chief-ai-po was used, add these lines to the summary:
AI Analysis:
Pre-mortem risks: [count]
AI safety stories (SA.1-SA.6): 6
Human oversight checkpoints: [count]
Graceful degradation coverage: [count]/[total] stories
Full AI story map: .plans/STORIES-AI-<name>.md
Then ask:
"Would you like to create GitHub Issues for these stories?"
If the user declines, stop here.
Pre-flight checks — run these before creating issues:
# 1. Is gh CLI installed?
gh --version
# 2. Is gh authenticated?
gh auth status
# 3. Does this repo have a GitHub remote?
gh repo view --json nameWithOwner -q '.nameWithOwner'
If any check fails, tell the user what's needed:
brew install gh (macOS) or see https://cli.github.comgh auth login — needs a GitHub token with repo and project scope (issues, labels, milestones, projects)gh repo create or add a remote.If all checks pass, proceed.
Create issues directly using the Bash tool. Do NOT generate a shell script file. Run gh commands inline during the conversation. This gives the user real-time feedback and avoids an extra file they need to review and execute.
Run label and milestone creation commands via the Bash tool. Use --force and || true for idempotency. Batch independent label commands into a single Bash call:
REPO=$(gh repo view --json nameWithOwner -q '.nameWithOwner')
# Priority labels
gh label create "priority:must" --color "B60205" --description "Must have — MVP" --force 2>/dev/null || true
gh label create "priority:should" --color "D93F0B" --description "Should have — Phase 2" --force 2>/dev/null || true
gh label create "priority:could" --color "FBCA04" --description "Could have — Phase 3" --force 2>/dev/null || true
# Size labels
gh label create "size:S" --color "C5DEF5" --force 2>/dev/null || true
gh label create "size:M" --color "BFD4F2" --force 2>/dev/null || true
gh label create "size:L" --color "A2C4E0" --force 2>/dev/null || true
# Epic labels — one per epic, each with a distinct color
gh label create "epic:<epic-slug>" --color "<color>" --force 2>/dev/null || true
# ...one per epic
Create milestones for delivery phases:
gh api repos/"$REPO"/milestones -f title="<phase name>" -f description="<description>" -f due_on="<YYYY-MM-DDT00:00:00Z>" 2>/dev/null || true
Create one parent issue per epic. These serve as containers for sub-issues. After creating each epic issue, also fetch its GraphQL node ID — this is needed to link sub-issues later.
EPIC1_NUM=$(gh issue create \
--title "Epic: <epic title>" \
--label "epic:<epic-slug>" \
--milestone "<phase name>" \
--body "## Epic: <epic title>
<epic description — 2-3 sentences summarizing the epic's goal>
## Stories
_Sub-issues will be linked to this issue._
## Metadata
- **Story count:** <count>
- **Priority mix:** <N> MUST, <N> SHOULD, <N> COULD
- **Story Map:** \`.plans/STORIES-<name>.md\`
" | grep -o '[0-9]*$')
echo "Created epic #$EPIC1_NUM — <epic title>"
# Get the GraphQL node ID for the epic (needed for addSubIssue mutation)
EPIC1_ID=$(gh issue view "$EPIC1_NUM" --json id --jq '.id')
Repeat for each epic — capture both the issue number (EPIC1_NUM) and the node ID (EPIC1_ID).
Creating sub-issues is a two-step process because gh issue create has no --parent flag:
gh issue createaddSubIssue GraphQL mutationProcess stories in dependency order — stories with no dependencies first.
# --- S1.1: <title> (no dependencies, under Epic 1) ---
# Step 1: Create the issue
S1_1=$(gh issue create \
--title "[S1.1] <story title>" \
--label "priority:must,size:M,epic:<epic-slug>" \
--milestone "<phase name>" \
--body "## User Story
> As a <role>, I want <capability> so that <benefit>.
## Acceptance Criteria
- [ ] Criterion 1
- [ ] Criterion 2
## Technical Notes
<notes>
## Metadata
- **Size:** M
- **Invert Candidate:** Yes
- **Story Map:** \`.plans/STORIES-<name>.md\`
" | grep -o '[0-9]*$')
echo " Created #$S1_1 — [S1.1] <title>"
# Step 2: Link as sub-issue of Epic 1 via GraphQL
S1_1_ID=$(gh issue view "$S1_1" --json id --jq '.id')
gh api graphql -f query='
mutation($parentId: ID!, $childId: ID!) {
addSubIssue(input: {issueId: $parentId, subIssueId: $childId}) {
issue { number title }
subIssue { number title }
}
}
' -f parentId="$EPIC1_ID" -f childId="$S1_1_ID"
echo " Linked #$S1_1 as sub-issue of epic #$EPIC1_NUM"
For stories with dependencies, include the dependency reference in the body:
# --- S1.2: <title> (depends on S1.1, under Epic 1) ---
# Step 1: Create the issue
S1_2=$(gh issue create \
--title "[S1.2] <story title>" \
--label "priority:must,size:S,epic:<epic-slug>" \
--milestone "<phase name>" \
--body "## User Story
> As a <role>, I want <capability> so that <benefit>.
## Acceptance Criteria
- [ ] Criterion 1
## Dependencies
Depends on #$S1_1 (S1.1 — <title>)
## Metadata
- **Size:** S
- **Invert Candidate:** No
- **Story Map:** \`.plans/STORIES-<name>.md\`
" | grep -o '[0-9]*$')
echo " Created #$S1_2 — [S1.2] <title>"
# Step 2: Link as sub-issue of Epic 1
S1_2_ID=$(gh issue view "$S1_2" --json id --jq '.id')
gh api graphql -f query='
mutation($parentId: ID!, $childId: ID!) {
addSubIssue(input: {issueId: $parentId, subIssueId: $childId}) {
issue { number title }
subIssue { number title }
}
}
' -f parentId="$EPIC1_ID" -f childId="$S1_2_ID"
echo " Linked #$S1_2 as sub-issue of epic #$EPIC1_NUM"
Key rules for issue creation:
S1_1, S3_2) so dependent stories can reference #$S1_1 in their body.gh issue view <num> --json id --jq '.id' and link it to the epic parent using the addSubIssue GraphQL mutation. The mutation requires the parent's node ID ($EPICN_ID) and the child's node ID.addSubIssue(input: {issueId: <parent_node_id>, subIssueId: <child_node_id>}) — both IDs are GraphQL node IDs (not issue numbers).$S1_1 variables expand to the actual issue number.grep -o '[0-9]*$' on gh issue create output to capture the issue number.After all issues are created, set up a GitHub Project for visual ordering.
Ask the user:
Issues created! Would you like to:
1. Create a new GitHub Project board for this PRD
2. Add issues to an existing Project (provide project number)
3. Skip project board setup
If the user chooses option 1 or 2:
Create a new project (option 1):
# Get the repo owner (org or user)
OWNER=$(gh repo view --json owner -q '.owner.login')
# Create the project
PROJECT_NUM=$(gh project create --owner "$OWNER" --title "<PRD name> — Backlog" --format json | jq -r '.number')
echo "Created project #$PROJECT_NUM"
# Add a custom "Priority Order" number field for implementation sequencing
gh project field-create "$PROJECT_NUM" --owner "$OWNER" --name "Priority Order" --data-type NUMBER
Add issues to the project with priority ordering:
Assign each issue a Priority Order value that matches the implementation sequence (1 = first to implement, N = last). This overrides GitHub's default newest-first display.
# Get the field ID for Priority Order
FIELD_ID=$(gh project field-list "$PROJECT_NUM" --owner "$OWNER" --format json | jq -r '.fields[] | select(.name == "Priority Order") | .id')
# Add each issue to the project and set its priority order
# Epic parent issues get Priority Order = 0 so they sort to the top
ITEM_ID=$(gh project item-add "$PROJECT_NUM" --owner "$OWNER" --url "https://github.com/$REPO/issues/$EPIC1_NUM" --format json | jq -r '.id')
gh project item-edit --project-id "$PROJECT_NUM" --id "$ITEM_ID" --field-id "$FIELD_ID" --number 0
# S1.1 is the first story to implement → Priority Order = 1
ITEM_ID=$(gh project item-add "$PROJECT_NUM" --owner "$OWNER" --url "https://github.com/$REPO/issues/$S1_1" --format json | jq -r '.id')
gh project item-edit --project-id "$PROJECT_NUM" --id "$ITEM_ID" --field-id "$FIELD_ID" --number 1
# S1.2 depends on S1.1 → Priority Order = 2
ITEM_ID=$(gh project item-add "$PROJECT_NUM" --owner "$OWNER" --url "https://github.com/$REPO/issues/$S1_2" --format json | jq -r '.id')
gh project item-edit --project-id "$PROJECT_NUM" --id "$ITEM_ID" --field-id "$FIELD_ID" --number 2
# ...repeat for all issues, incrementing the priority order
For existing projects (option 2): Skip project creation, just add issues and set Priority Order using the user-provided project number.
After project setup, tell the user:
GitHub Project board ready!
• <count> issues added with Priority Order field
• Sort by "Priority Order" to see implementation sequence
• Epic parent issues are at the top
• View: gh project view <PROJECT_NUM> --owner <OWNER> --web
storymap agent runs on a separate thread to keep main context clean for large PRDsgh commands during the conversation — no intermediate shell script is generated. This provides real-time feedback and keeps the workflow within the skill.addSubIssue GraphQL mutation (gh api graphql). This is a two-step process: create the issue first, then link it. The gh issue create command has no --parent flag — sub-issue linking must be done separately via GraphQL..plans/PRD-<name>.md file preserves the original PRD for traceability — downstream artifacts reference it