···11+---
22+name: software-dev
33+description: Use when the agent is performing any direct software development implementation or planning tasks. Provides the principles and values that must be followed.
44+---
15# Software Development Philosophy
2637This skill defines how I approach software development. Apply these principles whenever working on code.
+328
agents/skills/task-execution/SKILL.md
···11+---
22+name: task
33+description: Start and track work on a task. Use when the user says "lets work on...", "start task", or invokes /task. Creates TASK.md and PLAN.md for requirements and implementation tracking, handles branch setup, creates worktrees, and pushes incremental progress to draft MRs.
44+allowed-tools:
55+ - Read(TASK.md)
66+ - Read(PLAN.md)
77+ - Read(.worktree.yml)
88+ - Read(.claude/worktree.yml)
99+ - Write(TASK.md)
1010+ - Write(PLAN.md)
1111+ - Edit(TASK.md)
1212+ - Edit(PLAN.md)
1313+ - Bash(git:*)
1414+ - Bash(~/.claude/skills/task-execution/worktree-setup.sh)
1515+ - Bash(mkdir -p:*)
1616+ - AskUserQuestion
1717+ - TodoWrite
1818+---
1919+2020+# Task Execution
2121+2222+Manage task lifecycle from start to completion using two files:
2323+- **TASK.md**: Requirements, context, questions, decisions
2424+- **PLAN.md**: Implementation steps with progress tracking
2525+2626+---
2727+2828+## Input
2929+3030+Accept any combination of:
3131+- **Jira ticket** (e.g., `ADE-123`)
3232+- **Task description** (e.g., "add logout button")
3333+- **Both**
3434+3535+---
3636+3737+## Mode Detection
3838+3939+Determine mode based on current directory:
4040+4141+**Single-repo mode**: `git rev-parse --show-toplevel` succeeds
4242+- Working on one repository
4343+- `.tasks/` folder created in repo root
4444+- Worktree source is the repo itself
4545+4646+**Multi-repo mode**: Not inside a git repo
4747+- Working across multiple repositories
4848+- `.tasks/` folder created in current directory
4949+- CLAUDE.md should specify repos location (e.g., `Repos: ./zapier/`)
5050+- Repos are listed in TASK.md during planning
5151+5252+---
5353+5454+## Phase 1: Task Setup
5555+5656+### 1. Detect Mode
5757+5858+```bash
5959+git rev-parse --show-toplevel # Success = single-repo, failure = multi-repo
6060+```
6161+6262+### 2. Gather Context
6363+6464+- If Jira ticket provided: fetch it for context
6565+- Check for uncommitted changes in current directory
6666+- If uncommitted changes exist: STOP and ask how to handle them
6767+6868+### 3. Create Task Folder
6969+7070+Generate task name: `{ticket-lower}-{short-description}` (e.g., `ade-123-add-logout`)
7171+7272+```bash
7373+mkdir -p .tasks/{task-name}
7474+```
7575+7676+### 4. Create TASK.md
7777+7878+```markdown
7979+# {Task Title}
8080+8181+**Ticket**: {TICKET-NUM or N/A}
8282+**Branch**: {branch-name}
8383+8484+## Goal
8585+8686+{What are we trying to achieve?}
8787+8888+## Requirements
8989+9090+- {From ticket, discussion, or inferred}
9191+9292+## Repos
9393+9494+{For multi-repo: list repos and what changes in each}
9595+{For single-repo: omit this section}
9696+9797+## Constraints
9898+9999+- {Technical constraints, deadlines, scope limits}
100100+101101+## Open Questions
102102+103103+- {Anything unclear that needs resolution}
104104+105105+## Decisions
106106+107107+- {Decisions made during planning/implementation}
108108+```
109109+110110+---
111111+112112+## Phase 2: Planning
113113+114114+Iterate on TASK.md until requirements are clear, then create PLAN.md.
115115+116116+### 1. Understand the Work
117117+118118+- Explore relevant code
119119+- Identify affected areas and dependencies
120120+- Resolve open questions through discussion
121121+- For multi-repo: identify which repos are involved, update `## Repos` section
122122+123123+### 2. Create PLAN.md
124124+125125+```markdown
126126+# Implementation Plan
127127+128128+## Approach
129129+130130+{High-level approach and key decisions}
131131+132132+## Steps
133133+134134+- [ ] Step 1: {description}
135135+- [ ] Step 2: {description}
136136+- [ ] Step 3: {description}
137137+138138+## Testing
139139+140140+- {How we'll verify the implementation}
141141+142142+## Files to Modify
143143+144144+- `path/to/file.py` - {what changes}
145145+```
146146+147147+### 3. Get Approval
148148+149149+For non-trivial tasks, confirm the plan before proceeding.
150150+151151+---
152152+153153+## Phase 3: Implementation
154154+155155+### 1. Create Worktrees
156156+157157+For each repo involved (or the single repo in single-repo mode):
158158+159159+**Find the source repo**:
160160+- Single-repo: `git rev-parse --show-toplevel` from task folder parent
161161+- Multi-repo: Use repos location from CLAUDE.md
162162+163163+**Create worktree**:
164164+```bash
165165+# Fetch latest
166166+git -C {source-repo} fetch origin
167167+168168+# Create worktree with new branch
169169+git -C {source-repo} worktree add .tasks/{task-name}/{repo-name} -b {branch-name} origin/main
170170+```
171171+172172+Branch name: `{ticket-lower}-{short-description}` (same as task folder)
173173+174174+**Run setup**:
175175+```bash
176176+cd .tasks/{task-name}/{repo-name}
177177+~/.claude/skills/task-execution/worktree-setup.sh
178178+```
179179+180180+This copies files and runs setup commands per `.worktree.yml` in the source repo.
181181+182182+### 2. Create Draft MR
183183+184184+Push each branch and create draft merge requests:
185185+```bash
186186+git -C .tasks/{task-name}/{repo-name} push -u origin {branch-name}
187187+# Create draft MR via glab
188188+```
189189+190190+### 3. Track Progress
191191+192192+- Use TodoWrite for real-time tracking
193193+- Update PLAN.md checkboxes as steps complete
194194+- Update TASK.md with decisions and resolved questions
195195+196196+### 4. Commit Incrementally
197197+198198+Make small, focused commits as you complete logical units:
199199+- Commit code changes as they're done
200200+- Push to draft MR regularly for CI feedback
201201+- Update and commit PLAN.md progress periodically
202202+203203+### 5. Follow TDD
204204+205205+1. Write failing test
206206+2. Confirm failure
207207+3. Implement minimum to pass
208208+4. Confirm success
209209+5. Refactor if needed
210210+211211+---
212212+213213+## Phase 4: Completion
214214+215215+### 1. Final Updates
216216+217217+- Mark all PLAN.md steps complete
218218+- Update TASK.md with any final decisions
219219+- Ensure all tests pass
220220+221221+### 2. Ready for Review
222222+223223+- Push final commits
224224+- Mark MR(s) as ready (no longer draft)
225225+- Ask if any follow-up tasks should be created
226226+227227+### 3. Cleanup
228228+229229+After merge, task folder can be removed:
230230+```bash
231231+# Remove worktrees
232232+git worktree remove .tasks/{task-name}/{repo-name}
233233+234234+# Remove task folder
235235+rm -rf .tasks/{task-name}
236236+```
237237+238238+---
239239+240240+## File Maintenance
241241+242242+**TASK.md**: Living document for collaboration
243243+- Add decisions as they're made
244244+- Resolve and remove open questions
245245+- Keep requirements updated if scope changes
246246+247247+**PLAN.md**: Implementation checklist
248248+- Check off steps as completed
249249+- Add steps if scope expands
250250+- Note blockers or changes to approach
251251+252252+**Prune aggressively**: Remove obsolete information. These files should stay useful, not become history logs.
253253+254254+---
255255+256256+## Resuming Work
257257+258258+When returning to an existing task:
259259+260260+1. Read TASK.md and PLAN.md to restore context
261261+2. Check git status in worktrees for uncommitted work
262262+3. Review where we left off in PLAN.md
263263+4. Continue from there
264264+265265+---
266266+267267+## Worktree Setup Script
268268+269269+The script `~/.claude/skills/task-execution/worktree-setup.sh` runs in a new worktree to:
270270+271271+1. Find the main worktree (source repo)
272272+2. Read `.worktree.yml` or `.claude/worktree.yml` from source
273273+3. Copy files listed in `copy:` section
274274+4. Run commands listed in `setup:` section
275275+276276+**Example .worktree.yml**:
277277+```yaml
278278+copy:
279279+ - .env
280280+ - .env.local
281281+ - .envrc
282282+ - .tool-versions
283283+284284+setup:
285285+ - npm install
286286+ - direnv allow
287287+```
288288+289289+---
290290+291291+## Directory Structure Examples
292292+293293+**Single-repo**:
294294+```
295295+some-repo/
296296+├── .tasks/
297297+│ └── ade-123-fix-bug/
298298+│ ├── TASK.md
299299+│ ├── PLAN.md
300300+│ └── some-repo/ # worktree
301301+├── .worktree.yml
302302+└── src/
303303+```
304304+305305+**Multi-repo** (CLAUDE.md specifies `Repos: ./zapier/`):
306306+```
307307+~/projects/zapier/
308308+├── .tasks/
309309+│ └── ade-123-add-logout/
310310+│ ├── TASK.md
311311+│ ├── PLAN.md
312312+│ ├── zapier-web/ # worktree
313313+│ └── zapier-api/ # worktree
314314+└── zapier/
315315+ ├── zapier-web/
316316+ └── zapier-api/
317317+```
318318+319319+---
320320+321321+## Subagent Coordination
322322+323323+When using subagents for implementation:
324324+325325+- Each subagent works in a specific worktree: `.tasks/{task-name}/{repo-name}/`
326326+- Subagents reference shared context: `../TASK.md` and `../PLAN.md`
327327+- Main agent tracks overall progress in PLAN.md
328328+- Each repo gets its own commits and draft MR
+96
agents/skills/task-execution/worktree-setup.sh
···11+#!/bin/bash
22+#
33+# worktree-setup.sh
44+#
55+# Run from within a new git worktree to copy files and run setup commands
66+# based on .worktree.yml configuration from the main worktree.
77+#
88+# Usage: worktree-setup.sh
99+#
1010+# Configuration (.worktree.yml or .claude/worktree.yml in main worktree):
1111+# copy:
1212+# - .env
1313+# - .envrc
1414+# setup:
1515+# - npm install
1616+# - direnv allow
1717+1818+set -e
1919+2020+# Find main worktree
2121+main_git_dir=$(git rev-parse --git-common-dir 2>/dev/null)
2222+if [[ -z "$main_git_dir" ]]; then
2323+ echo "Error: Not in a git repository"
2424+ exit 1
2525+fi
2626+2727+main_worktree=$(dirname "$main_git_dir")
2828+current_worktree=$(pwd)
2929+3030+# Check if we're actually in a worktree (not the main repo)
3131+if [[ "$main_worktree" == "$current_worktree" ]]; then
3232+ echo "Error: Already in main worktree, nothing to set up"
3333+ exit 1
3434+fi
3535+3636+# Find config file
3737+config=""
3838+for path in ".worktree.yml" ".claude/worktree.yml"; do
3939+ if [[ -f "$main_worktree/$path" ]]; then
4040+ config="$main_worktree/$path"
4141+ break
4242+ fi
4343+done
4444+4545+if [[ -z "$config" ]]; then
4646+ echo "No .worktree.yml found in main worktree, skipping setup"
4747+ exit 0
4848+fi
4949+5050+echo "Using config: $config"
5151+echo "Source: $main_worktree"
5252+echo "Target: $current_worktree"
5353+echo ""
5454+5555+# Copy files
5656+echo "Copying files..."
5757+copied=0
5858+skipped=0
5959+while IFS= read -r file; do
6060+ # Skip empty lines
6161+ [[ -z "$file" ]] && continue
6262+6363+ src="$main_worktree/$file"
6464+ dest="$current_worktree/$file"
6565+6666+ if [[ -f "$src" ]]; then
6767+ # Create parent directory if needed
6868+ mkdir -p "$(dirname "$dest")"
6969+ cp "$src" "$dest"
7070+ echo " Copied: $file"
7171+ ((copied++))
7272+ else
7373+ echo " Skipped (not found): $file"
7474+ ((skipped++))
7575+ fi
7676+done < <(yq -r '.copy[]?' "$config" 2>/dev/null)
7777+7878+echo "Copied $copied file(s), skipped $skipped"
7979+echo ""
8080+8181+# Run setup commands
8282+echo "Running setup commands..."
8383+while IFS= read -r cmd; do
8484+ # Skip empty lines
8585+ [[ -z "$cmd" ]] && continue
8686+8787+ echo " Running: $cmd"
8888+ if eval "$cmd"; then
8989+ echo " Done"
9090+ else
9191+ echo " Warning: Command failed (continuing)"
9292+ fi
9393+done < <(yq -r '.setup[]?' "$config" 2>/dev/null)
9494+9595+echo ""
9696+echo "Worktree setup complete"