Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:20:36 +08:00
commit 88de006432
16 changed files with 1310 additions and 0 deletions

114
commands/add-task.md Normal file
View File

@@ -0,0 +1,114 @@
---
description: Add an ad-hoc task to an existing project plan
---
# Add Task
Add a single task to an existing project's pending queue without going through full planning process.
## Usage
```
/add-task <project> <task description>
/add-task Add error handling to API endpoints
```
If project is omitted, will prompt to select from existing projects in `.plans/`.
## Your Task
Create a new task file in `.plans/<project>/pending/` based on the description: "${{{ARGS}}}"
### Step 1: Parse arguments
Extract project name and task description from args.
- If project name included (first arg matches existing .plans/<project>/ directory), use it
- Otherwise, list existing projects and ask user to specify which one
- Remaining args are the task description
### Step 2: Determine task number
Look at existing tasks in the project (across all directories: pending/, implementation/, review/, testing/, completed/).
- Find highest task number (e.g., 005-name.md → number is 5)
- New task number = highest + 1 (e.g., 006)
- Format as 3 digits with leading zeros (e.g., "006")
### Step 3: Create task file
Generate filename: `{number}-{slugified-description}.md`
- Slugify: lowercase, replace spaces with hyphens, remove special chars
- Example: "Add error handling" → "006-add-error-handling.md"
Use template from `experimental/templates/task.md` with these defaults:
- **Iteration:** Ask user or default to "Integration"
- **Status:** Pending
- **Dependencies:** None (user can edit later)
- **Files:** Leave empty or ask user (optional)
- **Description:** Use the task description from args, expanded if needed
- **Working Result:** Generate based on description
- **Validation:** Generate 2-3 basic checkboxes from description
- **LLM Prompt:** Create outcome-focused prompt with placeholders for:
- Goal (derived from description)
- Constraints (placeholder: "Review existing patterns in relevant files")
- Implementation Guidance (placeholder: "Consider similar implementations")
- Validation (placeholder: "Run relevant tests")
- **Notes/planning-agent:** Placeholder for context
### Step 4: Save and report
Write file to `.plans/<project>/pending/{number}-{slug}.md`
Report completion:
```
✅ Task added to <project>
File: .plans/<project>/pending/{number}-{slug}.md
Iteration: {iteration}
Status: Pending
Next steps:
- Review and refine task details in the file
- Add dependencies if needed
- Run: /implement-plan <project>
```
## Interactive Mode
If insufficient information provided:
1. Ask for project if not specified
2. Ask for iteration type (Foundation/Integration/Polish) - suggest based on description
3. Optionally ask for dependencies
4. Optionally ask for key files affected
## Examples
### Simple task
```
User: /add-task auth Add rate limiting to login endpoint
Assistant: Creates 006-add-rate-limiting-to-login-endpoint.md in .plans/auth/pending/
```
### No project specified
```
User: /add-task Refactor error handling
Assistant: Lists existing projects:
1. auth
2. notifications
3. payments
Which project? [User responds: auth]
Creates 007-refactor-error-handling.md in .plans/auth/pending/
```
### Task with details
```
User: /add-task payments Add Stripe webhook validation - Foundation iteration
Assistant: Creates 003-add-stripe-webhook-validation.md in .plans/payments/pending/
with Iteration: Foundation
```
## Notes
- This is a utility for quick task creation - doesn't run exploration agents or risk analysis
- Tasks follow same format as `/plan-feature` but created individually
- User can manually edit task file after creation to add more context
- If no projects exist in `.plans/`, suggest running `/plan-feature` first

View File

@@ -0,0 +1,88 @@
---
description: Execute tasks from pending/ through Kanban flow (implementation → testing → review)
argument-hint: [PROJECT] [--auto]
---
# Implement Plan
Execute tasks from `.plans/{{ARGS}}/pending/` through Kanban flow.
## Usage
```
/implement-plan user-authentication
/implement-plan realtime-notifications --auto
```
**Flags:**
- `--auto`: Auto-commit after each task and continue. Without flag, prompt for commit confirmation per task.
## Setup
1. Verify `.plans/{{ARGS}}/pending/` has tasks (if not: "Run /plan-feature first")
2. Detect `--auto` flag, report: "Flag check: --auto is [PRESENT/ABSENT]"
3. Create todo list from pending tasks
## Main Loop
While tasks remain:
### 1. Claim Task
- Find next task with met dependencies
- Move: `pending/NNN-*.md → implementation/`
- Create todos from task's Validation checklist
### 2. Implementation
- Report: `🔨 Implementing Task X/Y: [name]`
- **Invoke implementing-tasks skill**
- If STUCK: Stop, show blocker, ask user
- If READY_FOR_TESTING: Move to `testing/`
### 3. Testing
- Report: `🧪 Testing Task X/Y: [name]`
- **Invoke testing skill**
- If NEEDS_FIX: Move back to `implementation/`, loop
- If READY_FOR_REVIEW: Move to `review/`
### 4. Review
- Report: `🔍 Reviewing Task X/Y: [name]`
- **Invoke reviewing-code skill** (launches 3 review agents in parallel)
- If REJECTED: Move back to `implementation/`, fix issues, loop
- If APPROVED: Move to `completed/`
### 5. Commit
**With `--auto`:** Commit automatically, continue to next task.
**Without `--auto` (default):**
1. Draft descriptive commit message (what was accomplished, not "task NNN")
2. Show message, ask: "commit/yes", "skip", or "edit [message]"
3. **STOP and WAIT** - each task needs its own confirmation
4. Stage code + task file: `git add . .plans/{{ARGS}}/completed/NNN-*.md`
5. Commit, then continue to next task
### 6. Progress
Report: `Progress: X/Y completed | Z in-flight | W pending`
## Final Summary
```
✅ Implementation Complete
Project: {{ARGS}}
Completed: X/X tasks | Commits: X
Average Review Scores: Security: XX | Quality: XX | Tests: XX
Final Test Coverage: XX%
```
## Key Behaviors
- **End-to-end per task**: implement → test → review → commit → next
- **Per-task commit confirmation**: Previous "yes" does NOT carry over to subsequent tasks
- **Task files committed**: Code + task file in each commit (git history shows project progress)
- **Flag detection**: Always report "Flag check: --auto is [PRESENT/ABSENT]" at start
- **Descriptive commits**: Message describes what was accomplished (not "Complete task NNN")
- **Track rejections**: Warn if task rejected >3 times
- **Skills run in main conversation**: Full visibility into implementation/review
- **Orchestrator moves files**: Based on Status field in task file
- **State persists**: Resume anytime with `/implement-plan {{ARGS}}`

58
commands/orchestrate.md Normal file
View File

@@ -0,0 +1,58 @@
---
description: Full workflow: planning → implementation → review → testing
---
# Orchestrate
Complete end-to-end workflow from planning through implementation.
## Usage
```
/orchestrate Add JWT authentication to login endpoint
```
## Your Task
### Phase 1: Planning
1. Run `/plan-feature` workflow to analyze: "${{{ARGS}}}"
- This invokes technical-planning skill with full rigor
- Creates `.plans/<project>/` with plan.md and tasks in pending/
2. After planning, extract project name and summarize
3. Ask: "Ready to start implementation? (yes/no)"
- yes → Continue to Phase 2
- no → Stop (user can run `/implement-plan <project>` later)
### Phase 2: Implementation
Follow same workflow as `/implement-plan <project-name>`:
1. Find next task with met dependencies
2. Implementation → Review → Testing loop (move files based on Status)
3. Progress updates after each task
4. Final summary when all completed
### Phase 3: Final Summary
```markdown
✅ Feature Complete: "{{{ARGS}}}"
Project: <project-name>
Tasks: X/X completed (Foundation: Y, Integration: Z, Polish: W)
Average Review Scores: Security: XX/100 | Quality: XX/100 | Performance: XX/100 | Tests: XX/100
Final Test Coverage: XX% | Full suite: XXX/XXX passing
Tasks rejected during review: Y (fixed)
Next: git commit -m "Implement <project-name>"
```
## When to Use
**Use /orchestrate:** Start from scratch, end-to-end automation
**Use /plan-feature + /implement-plan:** Review/modify plan first, more control
## Notes
Skills run in main conversation (full visibility) | Orchestrator handles file movement | Can interrupt anytime | State persists

74
commands/plan-feature.md Normal file
View File

@@ -0,0 +1,74 @@
---
argument-hint: [REQUEST or PROJECT]
description: Sprint planning - create or continue .plans/ with risk-prioritized tasks
---
# Plan Feature
Sprint planning for `.plans/<project>/` - same rigor whether starting fresh or continuing.
**Request:** $ARGS
## Detect Mode
Check if `.plans/<project>/plan.md` exists:
- **No** → Initial sprint
- **Yes** → Continuing sprint
## Process
### 1. Load Context
**Initial:** Start fresh with the request.
**Continuing:** Read existing state and summarize:
- `plan.md` - architecture decisions, completed milestones, deferrals
- `completed/*.md` - learnings from finished tasks
- What was accomplished, learned, and what's still deferred
### 2. Invoke Technical-Planning Skill
Apply **technical-planning skill** with full rigor (same process for initial or continuing):
- Phase 1: Requirements & Risk Analysis (ask clarifying questions, classify risks)
- Phase 2: Milestone Planning (sequence by risk, document deferrals)
- Phase 3: Implementation Strategy (prototype-first, core before polish)
For continuing sprints: Re-evaluate risks based on learnings, update deferrals.
### 3. Create/Update Structure
**Initial:** Create directories and `plan.md`:
```bash
mkdir -p .plans/<project>/{pending,implementation,review,testing,completed}
```
**Continuing:** Update `plan.md` with progress, new decisions, updated deferrals.
### 4. Generate Tasks
Create tasks for **next 1-2 iterations only** in `pending/`.
Use outcome-focused format from `/breakdown`:
- Goal, Working Result, Constraints, Dependencies
- `<guidance>` block with context and considerations (not step-by-step)
- Validation checklist
## Report
```
Sprint planning complete for .plans/<project-name>/.
[Initial: "Created" | Continuing: "Progress: Milestone N at X%"]
Tasks: X in pending/
Key risks: [Critical+Unknown items]
Deferred: [Items with rationale]
Next: /implement-plan <project-name>
```
## Key Principles
- **Same rigor every sprint** - technical-planning skill applies whether initial or continuing
- **Context accumulates** - each sprint builds on learnings from previous work
- **Outcome-focused tasks** - define WHAT and WHY, not HOW
- **Move fast** - only plan 1-2 iterations ahead, learn and adapt