Execute Skill
Execute the next incomplete task from docs/tasks.md with full protocol compliance.
Usage
| Command | Description |
|---|---|
/execute | Run the next single incomplete task |
/execute phase | Run all remaining tasks in current phase |
/execute to 1.2.3 | Run tasks up to and including task 1.2.3 |
/execute 1.2.3 | Run specific task 1.2.3 |
Examples
code
/execute # Do next task /execute phase # Complete current phase /execute to 0.3.1 # Run tasks through 0.3.1 /execute 1.1.1 # Run specific task 1.1.1
Handling Existing Code
This codebase may contain existing code from a previous project. When executing tasks:
Evaluate Existing Code
Before implementing each task, assess any existing code in the affected areas:
- •Check for existing implementations - Search for components, utilities, or patterns that may already exist
- •Compare against PRD - Determine if existing code aligns with current requirements
- •Identify reusable code - Look for well-written code that fits the current architecture
Decision Framework
For each piece of existing code encountered:
| Existing Code Status | Action |
|---|---|
| Aligns with PRD and is well-written | Keep and leverage - Adapt as needed |
| Partially useful | Refactor - Extract what's valuable, remove the rest |
| Doesn't fit current requirements | Remove - Delete cleanly, don't leave dead code |
| Uses deprecated patterns/libraries | Replace - Implement fresh following PRD stack |
Guidelines
- •Leverage first - Don't rewrite working code that fits requirements
- •Remove confidently - Old code that doesn't serve the PRD should be deleted, not commented out
- •Document decisions - Note in commit messages when removing/replacing significant existing code
- •Check dependencies - Before removing code, verify nothing else depends on it
- •Preserve tests - If existing tests are valid for the new implementation, keep them
When Removing Code
code
Removing existing code: {file/component}
Reason: {doesn't align with PRD|superseded|unused|deprecated pattern}
Replacement: {new implementation|not needed}
Workflow
Pre-Work: Branch Setup (REQUIRED)
Before starting ANY task, check and set up the working branch:
- •Check current branch: Run
git branch --show-current - •If on
mainormaster:- •Create a new feature branch:
git checkout -b task/{first-task-id}-{short-description} - •Example:
git checkout -b task/1.2.1-add-practice-session - •The branch name should reflect the first task being worked on
- •Create a new feature branch:
- •If already on a feature branch: Continue using it
- •Report branch status: State which branch you're working on
For Single Task (/execute or /execute <task-id>)
- •Read
CLAUDE.mdfor project context and conventions - •Read
docs/tasks.mdto find target task - •Run branch setup (see Pre-Work above)
- •State intent: "Working on task {N.N.N}: {description}"
- •Pause briefly for potential interrupt
- •Assess existing code in affected areas:
- •Search for existing implementations related to this task
- •Evaluate against PRD (see "Handling Existing Code" section)
- •Decide: leverage, refactor, or remove existing code
- •Report findings before proceeding
- •Research library documentation before implementing:
- •Identify libraries/frameworks involved in this task
- •Use
mcp__context7__resolve-library-idto find library IDs - •Use
mcp__context7__query-docsto fetch relevant API docs and examples - •Use
WebSearchas fallback for libraries not in Context7 - •Focus on: specific APIs needed, current syntax, recommended patterns
- •For UI tasks (tasks with a
Screens:line): readdocs/screens.md(relevant section) anddocs/design-system.mdbefore implementing. Use the frontend-dev skill guidelines. - •Implement the task following conventions and researched best practices (leveraging or removing existing code as determined)
- •Invoke code-simplifier:code-simplifier agent to clean up and refine the code:
- •Use the Task tool with
subagent_type: "code-simplifier:code-simplifier" - •Let the agent simplify, refine, and ensure code quality
- •Review and accept the agent's improvements
- •Use the Task tool with
- •Run
npm run testandnpm run typecheck - •If tests fail, fix before proceeding
- •Mark task complete in docs/tasks.md
- •Update Task Log with date
- •Commit with message:
type(scope): description (task-id) - •Push to remote:
git push -u origin {branch-name} - •Report completion summary
- •Ask user: "Continue to next task or create PR from current work?"
- •If continue: Proceed to next task
- •If create PR: Run PR creation workflow (see Post-Work below)
For Phase (/execute phase)
- •Read
CLAUDE.mdanddocs/tasks.md - •Run branch setup (see Pre-Work above)
- •Identify all incomplete tasks in current phase
- •For each task:
- •State intent
- •Assess existing code (same as single task workflow step 6)
- •Research library documentation (same as single task workflow step 7)
- •Implement (leveraging or removing existing code as determined)
- •Invoke code-simplifier:code-simplifier agent (same as single task workflow step 9)
- •Test
- •Mark complete
- •Commit
- •Push to remote
- •Stop at phase checkpoint
- •Verify all checkpoint criteria
- •Report phase completion summary
- •Ask user: "Create PR for this phase or continue to next phase?"
For Range (/execute to <task-id>)
- •Read
CLAUDE.mdanddocs/tasks.md - •Run branch setup (see Pre-Work above)
- •Identify tasks from current to target
- •Execute each task sequentially (same as single task flow, including existing code assessment, documentation research, and code simplification)
- •Push all commits to remote
- •Stop after target task
- •Report summary
- •Ask user: "Continue to next task or create PR from current work?"
Post-Work: PR Creation
When user requests PR creation, use GitHub CLI:
bash
gh pr create --title "type(scope): description" --body "$(cat <<'EOF'
## Summary
- Task {N.N.N}: {description}
- Task {N.N.M}: {description}
...
## Changes
- {bullet points of key changes}
## Testing
- [ ] All tests pass (`npm run test`)
- [ ] TypeScript checks pass (`npm run typecheck`)
- [ ] Lint checks pass (`npm run lint`)
---
Generated with Claude Code
EOF
)"
PR Title Format: Same as commit message - type(scope): description
After PR creation:
- •Report the PR URL to the user
- •Ask: "PR created! Switch back to main, or continue on this branch?"
- •If switch to main:
git checkout main && git pull - •If continue: Stay on current branch for additional work
- •If switch to main:
Safeguards
- •Never proceed past a phase checkpoint without explicit approval
- •Stop immediately on any test failure - fix before continuing
- •Stop immediately on any TypeScript error - fix before continuing
- •Maximum 5 tasks per
/execute phase- prevents runaway execution - •Always commit after each successful task
- •Never work directly on main/master - always create a feature branch first
- •Always push after commits - keeps remote in sync
- •Never force push - use regular push only
- •Clean up obsolete code - remove existing code that doesn't fit PRD rather than leaving it unused
- •Don't preserve dead code - no commenting out, no backwards-compatibility shims for removed features
Task Completion Criteria
A task is complete when:
- •Code changes are implemented
- •Tests are written for new/changed code — minimum 80% code coverage on affected files
- •Code has been reviewed and simplified by code-simplifier:code-simplifier agent
- •
npm run testpasses (all tests) - •
npm run typecheckpasses (no TS errors) - •
npm run lintpasses (no lint errors) - •Task checkbox is marked
[x]in docs/tasks.md - •Task Log is updated
- •Changes are committed
- •Changes are pushed to remote
Handling Failures
Test Failure
code
Test failed for task {N.N.N}.
Error: {error details}
Attempting fix...
{Fix attempt}
Re-running tests...
{Result}
If fix succeeds, continue. If not, stop and report.
TypeScript Error
code
TypeScript error in task {N.N.N}.
Error: {error details}
Fixing type error...
{Fix}
Re-running typecheck...
{Result}
Blocked Task
code
Task {N.N.N} is blocked.
Reason: {from task notes}
Skipping to next unblocked task...
Or stop if no unblocked tasks remain.
Commit Message Format
code
type(scope): description (task-id) - Detail 1 - Detail 2 Co-Authored-By: Claude <noreply@anthropic.com>
Types:
- •
feat- New feature - •
fix- Bug fix - •
refactor- Code restructuring - •
test- Adding tests - •
docs- Documentation - •
chore- Maintenance
Reporting
After each task:
code
Task {N.N.N} complete: {description}
Branch: {branch-name}
Files: {changed files}
Tests: {pass count} passing
Commit: {short hash}
Pushed: yes
Continue to next task or create PR?
After phase:
code
Phase {N} complete!
Branch: {branch-name}
Tasks: {completed}/{total}
Commits: {count}
All pushed: yes
Checkpoint verification:
{criterion 1}
{criterion 2}
Create PR for this phase or continue to next phase?
After PR creation:
code
PR created: {PR-URL}
Title: {pr-title}
Branch: {branch-name} -> main
Switch back to main or continue on this branch?
Session Handoff
If stopping mid-phase:
code
Session paused at task {N.N.N}.
Progress:
Branch: {branch-name}
Phase {N}: {X}/{Y} tasks complete
All changes pushed: yes
Next task: {N.N.M}: {description}
To resume: `/execute` or `/execute to {target}`
To create PR now: Ask "create PR"
Key Files
| File | Purpose |
|---|---|
CLAUDE.md | Project context and conventions |
docs/tasks.md | Task list with checkboxes |
docs/plan.md | Phase context and verification criteria |
docs/prd.md | Requirements for evaluating code |
docs/screens.md | UI specifications and screen flows |
docs/design-system.md | Design tokens, colors, typography for UI tasks |