From kraftwork
Execute implementation from specs. Reviews and applies pending changes before showing tasks. Use after kraft-plan.
How this skill is triggered — by the user, by Claude, or both
Slash command
/kraftwork:kraft-implementThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Execute implementation based on the spec and task list, with all code changes confined to the worktree.
Execute implementation based on the spec and task list, with all code changes confined to the worktree.
[WORKSPACE]/trees/TICKET-123/ - Where code changes happen[WORKSPACE]/docs/specs/TICKET-123/ - Read-only planning artifacts[WORKSPACE]/modules/ - Reference only, no modifications| Script | Purpose |
|---|---|
find-workspace.sh | Locate workspace root |
IMPORTANT: Derive the scripts directory from this skill file's location:
kraftwork/skills/kraft-implement/SKILL.md<workspace-root>/scripts/When you load this skill, note its file path and compute the scripts directory. For example, if this skill is at /path/to/kraftwork/skills/kraft-implement/SKILL.md, then scripts are at /path/to/kraftwork/scripts/.
WORKTREE_PATH=$(git rev-parse --show-toplevel 2>/dev/null)
# Check if in a trees directory
case "$WORKTREE_PATH" in
*/trees/*)
;;
*)
echo "Not in a worktree. Run /kraft-work first."
exit 1
;;
esac
# Extract context
TICKET_ID=$(basename "$WORKTREE_PATH" | grep -oE '^[A-Z]+-[0-9]+' || basename "$WORKTREE_PATH")
WORKSPACE=$(<scripts-dir>/find-workspace.sh)
SPEC_DIR="$WORKSPACE/docs/specs/$TICKET_ID"
echo "Ticket: $TICKET_ID"
echo "Worktree: $WORKTREE_PATH"
echo "Spec directory: $SPEC_DIR"
TASKS_FILE="$SPEC_DIR/tasks.md"
if [ ! -f "$TASKS_FILE" ]; then
echo "No tasks.md found at $TASKS_FILE"
echo "Run /kraft-plan first to create the implementation plan."
exit 1
fi
echo "Found tasks at: $TASKS_FILE"
CHANGES_DIR="$SPEC_DIR/changes"
INDEX_FILE="$CHANGES_DIR/index.md"
if [ -f "$INDEX_FILE" ]; then
PENDING_COUNT=$(grep -c '| pending |' "$INDEX_FILE" || echo 0)
else
PENDING_COUNT=0
fi
if [ "$PENDING_COUNT" -gt 0 ]; then
echo "$PENDING_COUNT pending change(s) found. Review required before implementation."
HAS_PENDING=true
else
HAS_PENDING=false
fi
If HAS_PENDING=true, proceed to Step 2b (interactive review) before showing tasks.
If HAS_PENDING=true, review each pending change:
PENDING_CHANGES=$(grep '| pending |' "$INDEX_FILE" | awk -F'|' '{print $2}' | tr -d ' ')
For each pending change:
Read the change file:
CHANGE_NUM="001" # Current change being reviewed
CHANGE_FILE=$(ls "$CHANGES_DIR" | grep "^${CHANGE_NUM}-" | head -1)
cat "$CHANGES_DIR/$CHANGE_FILE"
Present to user:
--- Change $CHANGE_NUM: $CHANGE_TITLE ---
Impact: $IMPACT_TYPE
Reason: $REASON
Spec Delta:
$SPEC_DELTA
Task Impact:
$TASK_IMPACT
Ask for action: Use AskUserQuestion with options:
Handle response:
Continue until all pending changes are reviewed.
When user selects "Apply" for a change:
1. Update spec.md with the delta:
Read the Spec Delta from the change file and apply it to spec.md using the Edit tool.
2. Append to changelog:
SPEC_FILE="$SPEC_DIR/spec.md"
# Check if Change History section exists
if ! grep -q "^## Change History" "$SPEC_FILE"; then
echo "" >> "$SPEC_FILE"
echo "## Change History" >> "$SPEC_FILE"
echo "" >> "$SPEC_FILE"
fi
# Append change entry
echo "- $(date +%Y-%m-%d): Applied \"$CHANGE_TITLE\" ($IMPACT_TYPE)" >> "$SPEC_FILE"
3. Add new tasks to tasks.md:
Read Task Impact from the change file and append new tasks.
4. Update change status:
Update the change file and index.md to mark the change as "applied".
5. Confirm:
Applied change $CHANGE_NUM: $CHANGE_TITLE
- Spec updated
- $NEW_TASK_COUNT task(s) added
- Changelog updated
Continue to next pending change or proceed to task display.
Read and display the task list:
cat "$TASKS_FILE"
Parse tasks to show status:
Implementation Tasks for $TICKET_ID:
[ ] 1. Create new module structure
[ ] 2. Add dependencies
[x] 3. Implement core logic (completed)
[ ] 4. Add API endpoints
[ ] 5. Create UI components
[ ] 6. Write unit tests
Ask user which tasks to work on using AskUserQuestion:
Which tasks would you like to implement?
Options:
1. All remaining tasks
2. Specific task numbers (e.g., "4, 5")
3. Next incomplete task only
For each selected task:
Implementation loop:
For task: "Add API endpoints"
1. Reading spec for API requirements...
2. Checking modules/messaging/src/api/ for patterns...
3. Creating $WORKTREE_PATH/src/api/newEndpoint.ts
4. Updating $SPEC_DIR/tasks.md - marking task complete
After completing a task, update tasks.md using the Edit tool to change the checkbox from [ ] to [x].
TOTAL=$(grep -c '^\- \[' "$TASKS_FILE" || echo 0)
COMPLETE=$(grep -c '^\- \[x\]' "$TASKS_FILE" || echo 0)
REMAINING=$((TOTAL - COMPLETE))
echo "Progress: $COMPLETE/$TOTAL tasks complete ($REMAINING remaining)"
When all tasks are done, run verification:
if [ "$REMAINING" -eq 0 ]; then
echo "All tasks complete! Running verification..."
# Run tests
npm test # or appropriate test command
# Run linting
npm run lint
# Type checking
npm run typecheck
fi
After each implementation session:
Implementation Progress for $TICKET_ID
─────────────────────────────────────────
Tasks: $COMPLETE/$TOTAL complete
Completed this session:
- Add API endpoints
- Create UI components
Remaining:
- Write unit tests
- Manual QA
Files modified:
- src/api/newEndpoint.ts (created)
- src/components/NewFeature.tsx (created)
- src/index.ts (modified)
Next steps:
1. Review changes: git diff
2. Continue implementation: /kraft-implement
3. When done: git add . && git commit
modules/Use modules/ to find patterns:
# Find similar implementations
grep -r "similar_pattern" "$WORKSPACE/modules/" --include="*.ts" -l
# Read existing examples
cat "$WORKSPACE/modules/frontend/src/components/Example.tsx"
Apply discovered patterns to the implementation in the worktree.
/kraft-plannpx claudepluginhub filipeestacio/kraftwork --plugin kraftworkExecutes approved implementation plans with checkpoint validation, progress tracking, and stakes-based enforcement. Locates plans, verifies approval, and runs verification criteria before proceeding.
Executes approved implementation tasks from a plan.json file created by spec-plan. Tracks progress via beads or harness todos, enforces TDD, and reports between batches. Invoke when ready to start coding from an approved plan.
Executes implementation plans by processing tasks from tasks.md, with vault logging, branch-based workflow tracking, and prerequisites validation.