with one click
plan-feature
// Plan a new feature end-to-end — explore patterns, write user stories with acceptance criteria and TDD specs, adversarial backlog refinement, and auto-execute via parallel subagents
// Plan a new feature end-to-end — explore patterns, write user stories with acceptance criteria and TDD specs, adversarial backlog refinement, and auto-execute via parallel subagents
Build the project for testing
Build an individual Swift package for testing
Build an individual Swift package
Build the project
Format code with swiftlint and swiftformat
Lint code with swiftlint and swiftformat
| name | plan-feature |
| description | Plan a new feature end-to-end — explore patterns, write user stories with acceptance criteria and TDD specs, adversarial backlog refinement, and auto-execute via parallel subagents |
| skills | ["swift-concurrency","swiftui-expert-skill","tca-expert","swift-testing-expert"] |
Orchestrates the full feature planning workflow: explore codebase patterns, ask clarifying questions, design user stories with acceptance criteria and TDD specs, run adversarial backlog refinement, and auto-execute stories via parallel subagents.
Ask the user for:
Before starting, assess the feature's complexity to choose the right workflow mode:
| Mode | Criteria | Skips |
|---|---|---|
| Full | 4+ stories expected, cross-layer changes, new data sources, factory chain updates | Nothing — runs all phases |
| Lightweight | 3 or fewer stories, single context/feature, no new data pipelines | Phase 4 (PRD review), Phase 5f (story review) — goes straight from exploration → stories → plan |
If unsure, start with Phase 1 exploration. Once the scope is clear, choose the mode before Phase 3. When in doubt, prefer lightweight — the user can always ask for a full review.
Create a feature branch from latest main before doing anything else:
git fetch origin maingit checkout -b feature/<feature-name> origin/mainThen verify which project resources exist:
docs/ARCHITECTURE.md — if missing, skip architecture-specific exploration and rely on codebase patterns directlydocs/TMDB_MAPPING.md — if missing or the feature doesn't involve TMDb data, skip all TMDb-specific steps (TMDb type exploration, adapter layer stories, TMDb service wiring)docs/TCA.md — if missing, skip TCA-specific guidance and infer patterns from existing featuresprds/ directory — if missing, write the PRD to the plan file insteadThis ensures the skill works for non-TMDb features and projects with different documentation structures.
Launch up to 3 Explore agents in parallel to understand:
Key files to check (if they exist — see Phase 0):
docs/ARCHITECTURE.md — layer structure and workflowsdocs/TMDB_MAPPING.md — TMDb type reference (only if feature involves TMDb data)Package.swift, factory protocol, live factoryAppDependencies/ wiring for the relevant contextAsk the user targeted questions about:
Present options with recommendations and reasons. Use AskUserQuestion with 2-4 options per question.
Write the high-level PRD sections to prds/{feature-name}.md. Read references/prd-template.md for the full format. At this stage, write only the foundation sections — user stories come later in Phase 5.
Sections to write now:
Leave the User Stories, Story Dependency Graph, and Verification sections empty — these are filled in after the PRD is reviewed and stories are designed.
Lightweight mode: Skip this phase entirely. Proceed directly to Phase 5.
Spawn 2 adversarial Product Manager subagents in parallel (using the plan-reviewer agent type) to independently review the draft PRD. Read references/prd-reviewers.md for the full reviewer prompts.
Provide each reviewer with:
Each PM reviews independently and returns findings classified as CRITICAL, IMPORTANT, or SUGGESTION.
After both PMs return, compare their findings:
Revise the draft PRD based on the agreed findings.
If the reconciliation resulted in significant PRD changes (e.g., new goals added, design decisions changed, data flow restructured, stories reorganised to fix compilation-order issues), re-run Phase 4 from the start — spawn 2 fresh PM reviewers against the updated PRD. Minor wording tweaks or adding clarifications do not require a re-review.
Continue re-reviewing until a round produces no CRITICAL findings and only minor IMPORTANT/SUGGESTION findings. The PMs must converge — do not proceed to story design until the PRD foundation (Goals, Non-Goals, Design Decisions, Data Flow) is stable.
Decompose the reviewed PRD into user stories. This is the most critical phase — poor story design leads to blocked subagents, missing wiring, and broken builds.
Walk through the data flow from API to screen and identify which layers need work:
Also identify cross-cutting work that doesn't fit neatly into one layer (e.g., adding a new DesignSystem component, adding URL support to ImagesConfiguration).
Create one story per logical unit of work. Follow these rules:
swift build and swift test must pass in the relevant package. If the story only changes internal code within a single module (no public interface changes), package-level verification is sufficient. If it changes public interfaces or spans multiple packages, verify with a full-app build.| Size | Scope | Files | Example |
|---|---|---|---|
| S | Single-layer, few files | 1-3 | Domain entity, TCA wiring, DesignSystem component |
| M | Multi-file within one layer | 3-5 | Use case + models + mapper, adapter + data source + mock |
| L | Cross-layer, significant logic | 5-10 | Full persistence layer, complete feature UI + coordinator |
| XL | NOT ALLOWED | 10+ | Must be broken into smaller stories |
Map which stories block which. Follow the natural architecture flow:
Domain → Infrastructure → Application → Composition → Adapters → AppDependencies → Feature → Coordinators
Identify parallel tracks (stories with no shared dependencies) and merge points (stories that need multiple tracks to complete).
For every story, fill in ALL of these sections — no exceptions:
BackdropImage pattern"), key implementation detailsreferences/patterns.md § Required Test Coverage Per Layer.Lightweight mode: Skip this phase. Proceed directly to Phase 5h (Finalize PRD).
After drafting all stories, spawn 3 reviewer subagents in parallel (using the plan-reviewer agent type) to critique the stories from different perspectives. Read references/story-reviewers.md for the full reviewer prompts.
Provide each reviewer with:
| Reviewer | Persona | Focus |
|---|---|---|
| Reviewer 1 | Product Manager | Story clarity, acceptance criteria completeness, user value, scope creep, missing requirements, story independence |
| Reviewer 2 | Staff iOS Engineer & Architect | Architecture alignment, pattern compliance, dependency correctness, factory chain integrity, sizing accuracy, breaking changes |
| Reviewer 3 | Staff Software Engineer in Test | Test coverage gaps, missing edge cases, testability of acceptance criteria, mock/helper needs, test file organisation |
Each reviewer returns findings classified as CRITICAL, IMPORTANT, or SUGGESTION.
Process findings from all 3 reviewers:
Update stories, acceptance criteria, Tech Elab, Test Elab, and the dependency graph based on findings. Break down any stories reviewers flag as too large.
Add the refined stories, story dependency graph, and verification sections to the PRD file (prds/{feature-name}.md). The PRD is now complete.
Final checklist:
PopcornUnitTests.xctestplan registrationState: Equatable notedWrite the technical implementation plan to the plan file (if in plan mode). The plan should contain:
After the user approves the plan, auto-execute stories using subagents. Read references/execution.md for the full subagent orchestration strategy, prompt template, and failure handling.
After story execution, create Statsig gates for any new feature flags added in code:
mcp__statsig__Get_Gate_Details_by_ID to match the config patternmcp__statsig__Create_Gate — enabled, with a "Development only" rule (passPercentage: 100, condition type: "public", environments: ["development"])mcp__statsig__Update_Gate_Entirely: "Controls access to <feature name>"The gate ID must match the FeatureFlag.id in code (snake_case).
After all stories are implemented:
/format, /lint, /build, /testSkip this phase if using
/prto create the pull request —/pralready spawns thecode-revieweragent. Running it here too is redundant.
After the pre-PR checklist passes:
Spawn the code-reviewer agent with:
git diff main...HEADgit diff --name-only main...HEADThe code reviewer performs an initial review, then an adversarial re-evaluation, and returns only the findings both passes agree on.
Address findings:
Final summary: Present the agreed-upon review to the user with:
references/prd-template.md — PRD format, user story template, persona guidelines, sizing, quality rulesreferences/prd-reviewers.md — Adversarial PRD reviewer prompt for the 2 PM subagents (Phase 4)references/story-reviewers.md — Adversarial story reviewer prompts for the 3 personas (PM, Architect, SEiT)references/patterns.md — Domain entity, mapper, test, view, and localisation patternsreferences/execution.md — Subagent orchestration, prompt template, failure handling| Document | Path | Use For |
|---|---|---|
| Architecture | docs/ARCHITECTURE.md | Layer structure, patterns |
| TMDb Mapping | docs/TMDB_MAPPING.md | TMDb types, mapping pipeline |
| TCA Guide | docs/TCA.md | Reducer, navigation, testing |
| Swift Style | docs/SWIFT.md | Code conventions |
| SwiftUI Guide | docs/SWIFTUI.md | View patterns |
| Git Guide | docs/GIT.md | Commit/PR conventions |
| Existing PRDs | prds/ | PRD format reference |
$ARGUMENTS