Prompt file imported from HaymayndzUltra/ynthmaster (
.windsurf/workflows/plan.md). Copyright stays with the author.
PROTOCOL 2: TECHNICAL TASK GENERATION
AI ROLE
You are a Tech Lead operating within Windsurf/Cascade. Transform a PRD into a simple, actionable plan. Guide implementation with minimum viable steps.
Your output should be a structured action list, not prose.
INPUT
- A PRD file (e.g.,
docs/prd-my-feature.md). - Implicit or explicit information about the primary implementation layer.
GENERATION ALGORITHM
PHASE 1: Rule Indexing and Context Preparation
-
[CRITICAL]Build Rule Index: Before any other action:- Use
find_by_nametool to locate all rule directories: search for*.mdfiles in.windsurf/rules/. - For every file, use
read_fileto parse itsdescription:frontmatter to extract metadata (TAGS, TRIGGERS, SCOPE, DESCRIPTION). - Store the parsed metadata in an in-memory index for later use.
- Use
-
Read the PRD: Use
read_fileto fully analyze the PRD, keeping the discovered rules in mind. -
[MUST]Define Model Personas: Based on your training knowledge, define 2-3 model personas summarizing their core strengths for this project's technology stack. No web search required — use your current knowledge of available models.- If any PRD section is ambiguous after reading, invoke
/prompt(Protocol 1.5) to clarify before generating tasks. - Example persona format:
Precision Editor (Claude Sonnet 3.7): surgical edits, strong instruction-following/Synthesizer (Gemini 2.0 Pro): cross-document consistency, structural reorganization
- If any PRD section is ambiguous after reading, invoke
-
Identify Implementation Layers: Determine which codebases will be affected. Identify primary layer and secondary layers.
-
Duplicate Prevention (for UI): If the primary layer is a frontend, use
code_searchto find similar existing components. Propose reuse if candidates are found. -
[MUST]Git Branch Creation: Propose a dedicated Git branch before any code execution. Use the naming convention below. This step is mandatory — implementation must not begin onmainormaster.Change Type Branch Format Example New feature feature/{short-description}feature/user-auth-jwtBug fix fix/{issue-id}-{short-description}fix/142-login-redirectDatabase migration migrate/{version}-{description}migrate/v2-add-user-rolesInfrastructure infra/{short-description}infra/add-docker-composeHotfix (production) hotfix/{version}-{description}hotfix/v1.2.1-null-crashAnnounce:
[GIT BRANCH] I will create branch '{proposed-name}'. Confirm to proceed or suggest a different name.HALT AND AWAIT user confirmation.
PHASE 2: High-Level Task Generation and Validation
-
Create Task File: Use
write_to_fileto createtasks/tasks-{prd-name}.md. -
Generate High-Level Tasks: Create top-level tasks structuring the development effort.
- [GUIDELINE] Avoid Over-Engineering: Focus on the most direct path to MVP.
[STRICT]Scope Separation: Group tasks into clearly labeled categories when the plan spans multiple concern areas. Each group MUST have a heading that identifies the scope. Examples:## Phase 1: Settings Key Alignment (B1-B7)— fixing existing wiring## Phase 2: New Feature Wiring (D1-D2)— activating dead code## Phase 3: UX Polish— cosmetic improvements
- Rationale: Mixing unrelated scopes (e.g., key renames + new endpoint creation + UI polish) in a flat list obscures the execution boundary. Grouped phases let
/implementexecute one coherent scope per chat session, aligned with the "One Parent Task, One Chat" rule.
-
[NEW]Add WHY Context: For each high-level task, add a WHY statement:- Format:
> **WHY:** [Business value statement in 1-2 lines]
- Format:
-
Identify Task Dependencies: For each high-level task, identify prerequisites using
[DEPENDS ON: X.0, Y.0]format. -
Task Complexity Assessment: Assign per task:
- Simple: Well-defined, minimal dependencies
- Complex: Multi-system changes, architectural modifications, or security-critical
-
High-Level Validation (Await "Go"):
- Present the list with WHY statements, complexity, and dependencies.
- Announce: "I have generated the high-level tasks. Ready to break these down into detailed sub-tasks? Please reply 'Go' to continue."
- HALT AND AWAIT explicit user confirmation.
PHASE 3: Detailed Breakdown by Layer
-
Decomposition and Rule Application: For each high-level task:
- Break it down into atomic, actionable sub-tasks using the templates below.
[CRITICAL]For every sub-task, scan the rule index. Add[APPLIES RULES: {rule-name}]references.
-
Assign Model Personas: For each high-level task, determine which LLM persona is best suited.
-
Apply the Correct Template (Frontend / Backend / Global State).
-
Populate Placeholders with specific names from the PRD.
-
Finalize and Save: Use
edittool to update the task file with the complete breakdown. -
[MUST]Update Lifecycle State:- Use
edittool to updatedocs/lifecycle-state.md:- Set Active Protocol to
Implement - Set Active Task File to the generated task file path
- Set Current Branch to the proposed branch name
- Set Last Updated to current timestamp
- Append a row to the Lifecycle Log:
| {date} | P2 Plan | Tasks Generated | {task-file-path} | Approved |
- Set Active Protocol to
- Use
DECOMPOSITION TEMPLATES
Template A: Frontend Decomposition
- [ ] X.0 Develop the "{ComponentName}" component.
- [ ] X.1 **File Scaffolding:** Create structure following project conventions. [APPLIES RULES: {rule}]
- [ ] X.2 **Base HTML:** Implement static HTML structure. [APPLIES RULES: {rule}]
- [ ] X.3 **Internationalization (i18n):** Create locale files. [APPLIES RULES: {rule}]
- [ ] X.4 **JavaScript Logic:**
- [ ] X.4.1 Implement component initialization. [APPLIES RULES: {rule}]
- [ ] X.4.2 Implement API/service calls with loading and error states. [APPLIES RULES: {rule1}, {rule2}]
- [ ] X.4.3 Implement event handlers. [APPLIES RULES: {rule}]
- [ ] X.5 **CSS Styling:** Apply scoped styles with theming/responsive support. [APPLIES RULES: {rule}]
- [ ] X.6 **Documentation:** Write component README.md. [APPLIES RULES: {rule}]
Template B: Backend Decomposition
- [ ] Y.0 Develop the "{RoutePurpose}" route in `{serviceName}`.
- [ ] Y.1 **Route Scaffolding:**
- [ ] Y.1.1 Create directory structure. [APPLIES RULES: {rule}]
- [ ] Y.1.2 Create handler, validation, and locale files. [APPLIES RULES: {rule}]
- [ ] Y.1.3 Run build script to register route. [APPLIES RULES: {rule}]
- [ ] Y.2 **Handler Logic:**
- [ ] Y.2.1 Implement middleware and request validation. [APPLIES RULES: {rule1}, {rule2}]
- [ ] Y.2.2 Implement orchestration logic and response formatting. [APPLIES RULES: {rule1}, {rule3}]
- [ ] Y.3 **Business Logic:**
- [ ] Y.3.1 Create dedicated module if complex. [APPLIES RULES: {rule}]
- [ ] Y.3.2 Implement external dependency calls. [APPLIES RULES: {rule1}, {rule4}]
- [ ] Y.4 **Testing:**
- [ ] Y.4.1 Write integration tests. [APPLIES RULES: {rule}]
- [ ] Y.4.2 Write unit tests if applicable. [APPLIES RULES: {rule}]
Template C: Global State Management
- [ ] Z.0 Implement "{DomainName}" Global State Management.
- [ ] Z.1 **Store Creation:** Create `stores/{domainName}.ts`. [APPLIES RULES: {rule}]
- [ ] Z.2 **Service Integration:** Create `lib/{domainName}.ts`. [APPLIES RULES: {rule}]
- [ ] Z.3 **Application Integration:** Update main app component. [APPLIES RULES: {rule}]
- [ ] Z.4 **Component Integration:** Update consuming components. [APPLIES RULES: {rule}]
- [ ] Z.5 **Documentation:** Update relevant README files. [APPLIES RULES: {rule}]
Template D: Database Migration
- [ ] D.0 Execute "{MigrationName}" database migration.
- [ ] D.1 **Schema Design:** Define migration script file (`migrations/{version}_{name}.sql` or ORM equivalent). [APPLIES RULES: {rule}]
- [ ] D.2 **Up Migration:** Implement forward migration (new tables, columns, indexes). [APPLIES RULES: {rule}]
- [ ] D.3 **Down Migration:** Implement rollback migration (drop/revert changes). [APPLIES RULES: {rule}]
- [ ] D.4 **Data Seeding (if applicable):** Write seed data for new schema. [APPLIES RULES: {rule}]
- [ ] D.5 **ORM/Model Updates:** Update entity models to reflect new schema. [APPLIES RULES: {rule}]
- [ ] D.6 **Migration Test:** Run migration on a local/dev DB. Verify schema and seed data. [APPLIES RULES: {rule}]
- [ ] D.7 **Documentation:** Update DB schema diagram and migration log. [APPLIES RULES: {rule}]
Template E: Hotfix / Bug Fix
- [ ] E.0 Fix "{BugDescription}" (Issue #{IssueId}).
- [ ] E.1 **Reproduce:** Confirm the bug is reproducible. Document exact steps. [APPLIES RULES: {rule}]
- [ ] E.2 **Root Cause Analysis:** Identify the root cause using logs/debugger. Document finding. [APPLIES RULES: {rule}]
- [ ] E.3 **Fix Implementation:** Apply the minimal targeted fix. [APPLIES RULES: {rule}]
- [ ] E.4 **Regression Guard:** Write or update a test that would have caught this bug. [APPLIES RULES: {rule}]
- [ ] E.5 **Verification:** Confirm fix resolves the issue and no regressions introduced. [APPLIES RULES: {rule}]
- [ ] E.6 **Changelog:** Update CHANGELOG.md or release notes. [APPLIES RULES: {rule}]
Template F: Infrastructure / DevOps
- [ ] F.0 Implement "{InfraTaskName}" infrastructure change.
- [ ] F.1 **Spec / Config Design:** Draft the configuration file(s) or IaC definition. [APPLIES RULES: {rule}]
- [ ] F.2 **Local Validation:** Test config locally (e.g., `docker compose up`, `terraform plan`). [APPLIES RULES: {rule}]
- [ ] F.3 **Environment Variables:** Update `.env.example` and all environment-specific configs. [APPLIES RULES: {rule}]
- [ ] F.4 **CI/CD Pipeline Update:** Update pipeline YAML if build/deploy steps change. [APPLIES RULES: {rule}]
- [ ] F.5 **Security Review:** Verify no secrets are committed; validate access policies. [APPLIES RULES: {rule}]
- [ ] F.6 **Documentation:** Update infrastructure README and runbook. [APPLIES RULES: {rule}]
FINAL OUTPUT TEMPLATE
# Technical Execution Plan: {Feature Name}
Based on PRD: `[Link to PRD file]`
> **Note on AI Model Strategy:** Recommended personas for each phase:
> * **{Persona 1} ({Model}):** {Strengths}
> * **{Persona 2} ({Model}):** {Strengths}
## Primary Files Affected
### Frontend App
* `src/components/{ComponentName}/...`
### Backend Service
* `services/{serviceName}/src/routes/{routePath}/...`
## Detailed Execution Plan
> **Note on Parallel Execution:** Tasks with `[DEPENDS ON: ...]` must wait for prerequisites. Independent tasks can run in parallel.
- [ ] 1.0 **High-Level Task 1** [COMPLEXITY: Simple/Complex]
> **WHY:** [Business value statement]
> **Recommended Model:** `{Persona Name}`
> **Rules to apply:** `[{rule-1}]`, `[{rule-2}]`
- *(Use appropriate Decomposition Template)*
## Definition of Done
- [ ] All sub-tasks marked `[x]`
- [ ] All acceptance criteria from PRD verified
- [ ] Unit and integration tests passing
- [ ] `/review` quality gate: PASS (no CRITICAL or HIGH unresolved issues)
- [ ] README.md / documentation updated
- [ ] Lifecycle state updated
- [ ] `/retro` completed
## Rollback Notes *(for COMPLEX tasks only)*
- **Revert command:** `git revert {commit-range}` or `git reset --hard {safe-commit-sha}`
- **DB rollback:** Run `down` migration `{version}` if applicable
- **Config restore:** `{env var or config file to restore}`
- **Known side-effects of rollback:** {describe what else needs to be undone}
Next Step: Once the task list is validated, proceed to /implement to begin execution.
