task-implementation
Implement engineering tasks from task specifications using TDD in isolated git worktrees. Use when user wants to implement a task from docs/tasks/, build a feature from TASKS.md, code a specific epic/story/task, or says "implement task X", "build task X", "work on task X". Reads task specs, PRD, and architecture docs for context, creates a feature branch worktree, writes tests first, implements code, verifies coverage, updates docs, and creates a PR.
What this skill does
# Task Implementation
Implement engineering tasks in isolated git worktrees using a test-first workflow. Read the task spec, build in a clean branch, write tests, implement, verify, and open a PR.
## Workflow
```
START
│
▼
┌──────────────────────────────┐
│ 1. Load Task Specification │ ◄── docs/tasks/task-<id>.md or docs/TASKS.md
└──────────┬───────────────────┘
│
▼
┌──────────────────────────────┐
│ 2. Load Project Context │ ◄── PRD, Architecture, Brand Guidelines
└──────────┬───────────────────┘
│
▼
┌──────────────────────────────┐
│ 3. Create Worktree & Branch │ ◄── git worktree in .worktrees/
└──────────┬───────────────────┘
│
▼
┌──────────────────────────────┐
│ 4. Implement (test-first) │ ◄── Write tests → Write code → Pass tests
└──────────┬───────────────────┘
│
▼
┌──────────────────────────────┐
│ 5. Verify │ ◄── Tests pass, coverage thresholds met
└──────────┬───────────────────┘
│
▼
┌──────────────────────────────┐
│ 6. Update Documentation │ ◄── TASKS.md, README if appropriate
└──────────┬───────────────────┘
│
▼
┌──────────────────────────────┐
│ 7. Push & Create PR │ ◄── Push branch, open PR via gh
└──────────────────────────────┘
```
## Step 1: Load Task Specification
Read the task document. Identify which to load:
| Input | Source |
|-------|--------|
| User provides task ID (e.g., "task 3.1.2") | Read `docs/tasks/task-3.1.2.md` |
| User references epic/story (e.g., "story 2.1") | Read `docs/tasks/task-2.1.md`, or find matching section in `docs/TASKS.md` |
| No individual task doc exists | Fall back to `docs/TASKS.md`, locate the relevant section |
Extract from the task spec:
- **Title and ID** — for branch naming and PR title
- **Files to create/modify** — scope of changes
- **Acceptance criteria** — drives test cases
- **Testing instructions** — how to verify
- **Dependencies** — other tasks that must be complete first
If the task has unmet dependencies, warn the user before proceeding.
## Step 2: Load Project Context
Read these documents for implementation context:
| Document | When to Read |
|----------|--------------|
| `docs/PRD.md` | Always — understand product intent |
| `docs/ARCHITECTURE.md` | Always — understand tech stack, directory structure, key abstractions |
| `docs/BRAND-GUIDELINES.md` | When task involves UI components, styling, or visual elements built from scratch |
| `docs/TASKS.md` | When you need to understand ordering, dependencies, or broader scope |
Also scan the existing codebase to understand:
- Project structure and conventions (naming, patterns, file organization)
- Existing test patterns (framework, helpers, mocking approach)
- Package manager (check lock files: `pnpm-lock.yaml`, `yarn.lock`, `bun.lockb`, `package-lock.json`)
## Step 3: Create Worktree & Branch
Create an isolated worktree for the feature branch:
```bash
# Branch naming: feature/task-<id>-<short-description>
# Example: feature/task-3.1.2-login-form
BRANCH_NAME="feature/task-<id>-<short-description>"
WORKTREE_DIR=".worktrees/$BRANCH_NAME"
git worktree add -b "$BRANCH_NAME" "$WORKTREE_DIR"
```
All subsequent work happens inside the worktree directory. Change your working directory there.
Install dependencies in the worktree if needed (e.g., `npm install`, `pnpm install`).
## Step 4: Implement (Test-First)
Follow this cycle for each piece of functionality:
### 4a. Write Tests First
From the acceptance criteria, write test cases that will fail:
- One test per acceptance criterion minimum
- Include edge cases mentioned in the task spec
- Include a happy path and at least one error/boundary case
- Follow existing test conventions in the project (framework, file location, naming)
Run the tests to confirm they fail (red phase).
### 4b. Write Implementation
Implement the minimum code to pass the tests:
- Follow patterns from `docs/ARCHITECTURE.md` (directory structure, key abstractions)
- Match existing code conventions (imports, naming, error handling)
- If the task involves UI and `docs/BRAND-GUIDELINES.md` exists, follow its design tokens and patterns
- Keep changes scoped to files listed in the task spec — avoid unrelated modifications
### 4c. Pass Tests
Run the test suite. Iterate on implementation until all tests pass (green phase).
### 4d. Refactor
Clean up implementation while keeping tests green. Remove duplication, improve naming, extract constants. Do not add functionality beyond what the tests cover.
### 4e. Commit
Make atomic commits as logical units of work complete. Use conventional commit messages:
```
feat(scope): short description of what was added
test(scope): add tests for <feature>
```
## Step 5: Verify
Run full verification before considering the task done:
```bash
# Run full test suite (not just new tests)
<package-manager> test
# Check coverage thresholds pass
<package-manager> test -- --coverage
# Lint passes
<package-manager> run lint
# Type check passes (TypeScript projects)
<package-manager> run typecheck
# Build succeeds
<package-manager> run build
```
All checks must pass. If coverage thresholds are configured in the project (e.g., in `vitest.config.ts` or `jest.config.ts`), ensure they are met. If no thresholds are configured, aim for:
| Metric | Minimum |
|--------|---------|
| Statements | 80% |
| Branches | 80% |
| Functions | 80% |
| Lines | 80% |
If any check fails, fix the issue and re-run. Do not proceed with failures.
## Step 6: Update Documentation
### Mark Task Complete in TASKS.md
In `docs/TASKS.md`, mark the completed task:
- Change `- [ ]` to `- [x]` for completed acceptance criteria
- Mark the task checkbox as complete
- If all tasks in a story are done, mark the story complete too
### Update README (When Appropriate)
Update the project README if the task:
- Adds a new user-facing feature or command
- Changes setup/installation steps
- Adds new environment variables or configuration
- Changes API endpoints
Do not update README for internal refactors, test additions, or implementation details.
## Step 7: Push & Create PR
```bash
git push -u origin "$BRANCH_NAME"
```
Create a PR using `gh`:
```bash
gh pr create --title "<type>(task-<id>): <short title>" --body "$(cat <<'EOF'
## Summary
Implements task <id>: <task title>
### Changes
- <bullet points of what was done>
### Acceptance Criteria
- [x] <criterion 1>
- [x] <criterion 2>
## Test Plan
### Automated
- <commands to run, e.g. `pnpm test`, `pnpm run lint`>
### Manual QA
- [ ] <visual/interactive verification step for a human or QA agent with browser access>
- [ ] <another manual check if applicable>
## Task Reference
- Task spec: `docs/tasks/task-<id>.md`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"
```
After PR creation, report the PR URL to the user.
## Error Recovery
| Problem | Action |
|---------|--------|
| Dependency not installed | Run package manager install in worktree |
| Tests fail after implementation | Debug, fix, re-run — do not skip tests |
| Coverage below threshold | Add missing test cases for uncovered branches |
| Lint/typecheck fails | Fix issues before committing |
| Worktree already exists for branch | Ask user: reuse existing worktree or pick a new branch name |
| Task has unmet dependencies | Warn user, ask whether to proceed or implement dependency first |
## Cleanup
After the PR is merged (not before), the worktree can be removed:
```bash
git worktree remove ".worktrees/$BRANCH_NAME"
git branch -d "$BRANCH_NAME"
```
Do not clean up automatically — only when the user requests it or confirms the PR is merged.
Related in Productivity
gitea-workflow
IncludedOrchestrate agile development workflows for Gitea repositories using the tea CLI. Use when working with Gitea-hosted repos and asking to 'run the workflow', 'continue working', 'what's next', 'complete the task cycle', 'start my day', 'end the sprint', 'implement the next task', or wanting guided step-by-step development assistance. Keywords: workflow, orchestrate, agile, task cycle, sprint, daily, implement, review, PR, standup, retrospective, gitea, tea.
microsoft-graph-gateway
IncludedRoute Microsoft Graph work in this workspace. Use when users want to read or write Outlook mail, calendar events, contacts, OneDrive or SharePoint files, Teams, Planner, To Do, users, groups, directory data, or arbitrary Microsoft Graph endpoints from VS Code. Prefer WorkIQ for common read scenarios. Use Microsoft Graph for write actions and gap-read scenarios that need exact Graph properties, filters, permissions, or endpoints.
copilotkit
IncludedUse when building with CopilotKit — setup, development, integrations, debugging, upgrading, or contributing. Routes to the appropriate specialized skill based on the task.
wordly-wisdom
IncludedProvides calibrated decision analysis using Charlie Munger-style multiple mental models, inversion, incentive mapping, circle-of-competence checks, misjudgment audits, second-order effects, and forecast updates. Use when the user asks for an oracle take, a hard call, a decision memo, a premortem, an outside view, a red-team, a sanity-check, what am I missing, think this through, or wants a strategy, hire, investment, plan, product, partnership, or major life choice analysed. Avoid for simple factual lookups or time-sensitive legal, medical, or market questions without fresh evidence.
swain-session
IncludedSession management and project status dashboard. Owns the full session lifecycle (start/work/close/resume), focus lane, bookmarks, worktree detection, and tab naming. Also serves as the project status dashboard — shows active epics, progress, actionable next steps, blocked items, tasks, GitHub issues, and recommendations. Worktree creation is deferred to swain-do task dispatch (SPEC-195). Triggers on: 'session', 'status', 'what's next', 'dashboard', 'overview', 'where are we', 'what should I work on', 'show me priorities', 'bookmark', 'focus on', 'session info'.
gandi
IncludedComprehensive Gandi domain registrar integration for domain and DNS management. Register and manage domains, create/update/delete DNS records (A, AAAA, CNAME, MX, TXT, SRV, and more), configure email forwarding and aliases, check SSL certificate status, create DNS snapshots for safe rollback, bulk update zone files, and monitor domain expiration. Supports multi-domain management, zone file import/export, and automated DNS backups. Includes both read-only and destructive operations with safety controls.