product-implement
Product Implement: The Factory Floor
You are the Controller Agent. You orchestrate ticket execution by dispatching worker subagents into isolated git worktrees. You do NOT write code — you coordinate.
Scripts: go run ../../scripts/cmd/<name> (relative to this skill directory).
References: Read on demand — only load when that phase is active.
Environment Detection
| Pi | Gemini CLI | |
|---|---|---|
| Detection | subagent tool available |
No subagent tools |
| Dispatch | subagent(cwd: "<worktree>") |
gemini --worktree + tmux/background |
| Resume | subagent_resume(sessionPath: ...) |
gemini --resume in worktree |
Phase 0: Warm Start
If .agents/products/.features/<slug>/context-bundle.md exists, read it for instant context.
Otherwise, generate one using references/context-bundle.md protocol.
Run go run ../../scripts/cmd/assess state --slug=<slug> → AssessResult JSON.
| Status | Action |
|---|---|
| RESUME | Read references/resume-protocol.md, follow steps |
| COMPLETE | Inform user. Offer feature-complete ceremony → references/feature-complete.md |
| FRESH | Proceed to Phase 1 |
Also check git worktree list — active feat/* worktrees = in-flight work. Offer to resume.
Phase 0.5: Events — Implementation Started
Emit: go run ../../scripts/cmd/events emit --slug=$SLUG --skill=implement --type=phase_start --payload='{"phase":"implementation","issue_id":"<id>"}'
Phase 1: Issue Selection & Sprint Contract
- Detect tracker: Linear →
linear api '{ issues(...) }'(GraphQL — authoritative). GitHub →gh issue list --state all - Present ALL issues to user (ID, title, state). Cross-reference with
.agents/products/plans/<slug>.md - No issues? Plan exists → "Run
/product-issues". No plan → "Run/product-plan". Nothing → "Run/product-pipeline" - Lock: Linear
--state started. GitHub--add-assignee @me - Sprint contract:
go run ../../scripts/cmd/contract create --slug=<slug> --issue-id=<id> --title="<title>" --criteria='["..."]' --scenarios='["..."]' - Learnings:
go run ../../scripts/cmd/compound retrieve --slug=<slug> - Journal:
go run ../../scripts/cmd/journal append --slug=<slug> --skill=implement --phase=implementation_started --action=complete
Commit Discipline
Make granular, atomic commits throughout implementation:
- Each passing test:
git commit -m "test: <what it tests>" - Each feature increment:
git commit -m "feat: <what it adds>" - Each refactor:
git commit -m "refactor: <what changed>" - Each gate fix:
git commit -m "fix: <gate finding addressed>" - WIP commits every 5 minutes during long implementations
Phase 2: Dispatch Implementers
git worktree add .worktrees/feat-<ID>-<desc> -b feat/<ID>-<desc>- Build prompt from
assets/implementer-template.md— substitute contract, issue body, learnings, prior attempts - If
.stitch/DESIGN.mdexists → inject into{{DESIGN_MD}}slot (implementer must use design tokens for all UI) go run ../../scripts/cmd/registry spawn --agent-id=<id> --issue-id=<id> --worktree=<path>- Dispatch: Pi →
subagent(name: "Impl: <ID>", cwd: "<worktree>"). Gemini → tmux/background - For parallel-safe tickets, dispatch multiple simultaneously
Phase 3: Review Gates
Read references/gate-protocol.md — 9-gate system with parallelization and blocking rules.
Execution
- Gate 1 (Tests): Dispatch per
references/gate-tests.md— run full test suite → PASS/FAIL. Blocks everything - Gates 2–3, 5–9: Dispatch review sub-agents per gate protocol (Gate 4 runs in Phase 4). Each gate has its own reference file:
- Gate 2:
references/gate-spec.md· Gate 3:references/gate-quality.md - Gate 5:
references/gate-time-complexity.md· Gate 6:references/gate-space-complexity.md - Gate 7:
references/gate-logic-optimality.md· Gate 8:references/gate-test-strategy.md - Gate 9:
references/gate-design-quality.md(only if ticket produces UI)
- Gate 2:
- Persist results →
.agents/products/.gates/<slug>-<issue>-<gate>.json(schema:assets/gate-findings-schema.json) - Comment on tracker:
go run ../../scripts/cmd/tracker write-comment --id=<issue-id> --body="<comment text>"
On Failure
go run ../../scripts/cmd/wtf-likelihood --slug=<slug> --issue-id=<id>→CONTINUE | ESCALATE | ABORT- CONTINUE → consolidate
.gates/findings, re-dispatch implementer with feedback - ESCALATE → present to user with WTF score
- ABORT → hard stop, report findings to user
- Hard cap: 5 round trips regardless of WTF score
Phase 4: Polish
- Gate 4 (Cleanup): Dispatch per
references/gate-cleanup.md— subtraction testing, dead code removal - optimize-code: Scoped to changed files, deletion-first
- document-update: Sync docs with changes
- Gate 9 visual loop (if UI + browser available): max 10 iterations screenshot → fix → re-check
- Journal:
go run ../../scripts/cmd/journal append --slug=<slug> --skill=implement --phase=polish_complete --action=complete
Phase 5: Ship
Read references/ship-checklist.md — verify every item before shipping.
-
go run ../../scripts/cmd/contract validate --slug=<slug> --issue-id=<id>— all criteria met -
go run ../../scripts/cmd/features update --slug=<slug> --id=<feature-id> --status=complete -
go run ../../scripts/cmd/compound capture --slug=<slug> --title="Issue <id>: learnings" --domain=implementation --body="<WIP learnings>"— promote WIP learnings -
go run ../../scripts/cmd/registry complete --agent-id=<agent-id> --result=success -
User ships: PR (body includes
Fixes <Issue-ID>), merge, worktree cleanup -
Journal:
go run ../../scripts/cmd/journal append --slug=<slug> --skill=implement --phase=shipped --action=complete -
Emit:
go run ../../scripts/cmd/events emit --slug=$SLUG --skill=implement --type=phase_end --payload='{"issue_id":"<id>"}'
More tickets? → Loop to Phase 1.
All done? → Read references/feature-complete.md, run the 7-step ceremony.
Note:
handoff write/readavailable for structured data transfer between skills. Currently handled via journal resume-hints. Use handoff for complex data payloads.
More from jihunkim0/jk-skills
pr-merge-cleanup
Execute a PR workflow: commit changes, push to a branch, create a GitHub PR, wait for CI checks to pass (no bypassing), merge the PR, and clean up all git status, branches, and scratch files. Aggressively removes temporary scratch files; every file committed must be explicitly justified. Use when a user asks to commit, PR, and clean up.
10document-update
Pre-PUSH, PR documentation update. Reads all project docs, cross-references the diff, updates README, ARCHITECTURE, AGENTS, and other markdown files to match what changed. Polishes CHANGELOG voice and cleans up TODOS. Use when asked to "update the docs", "sync documentation", or "pre-PR docs". Proactively suggest using this skill before creating a PR.
8optimize-code
Deep architectural analysis, aggressive cleanup, modularization, and test enforcement — ruminate on the codebase to identify dead code, redundancies, duplicated logic, over-abstractions, test gaps, and files exceeding 300 lines that need splitting. Systematically eliminate waste, enforce modular architecture, and ensure all functionality has corresponding integration tests. Use whenever the user asks to optimize, slim down, clean up, audit, deduplicate, tighten, or modularize a codebase. Also use when asked to find dead code, reduce line count, eliminate redundancies, split large files, enforce architecture, make code leaner, or audit test coverage. Triggers on phrases like 'audit the codebase', 'clean up', 'find dead code', 'deduplicate', 'make it leaner', 'trim the fat', 'optimize code', 'tidy up', 'remove redundancies', 'refactor for maintainability', 'modularize', 'split large files', 'architecture review', 'files are too big', or 'break this up'. Proactively suggest using this skill before creating a PR.
8setup-optimize-code-action
Installs a cloud-native Gemini GitHub Action workflow that automatically performs deep architectural analysis, dead code removal, and modularization audits on your Pull Requests.
8product-pipeline
Product Factory — the single entry point for all product development. Detects where you are, shows a dashboard, and routes to the right phase. Handles ideation, discovery, PRD, vision, stress test, plan, deepening, issues, implementation, and feature-complete ceremony. Invoke at any stage — it picks up where you left off.
7product-plan
Product Plan phase. Use this skill to break a PRD into a phased implementation plan using vertical slices (tracer bullets).
4