implement
Scope execution pipeline and implementation methodology. Use for executing scopes (TDD three-phase pipeline), verifying completion, debugging, or building features from requirements.
What this skill does
## Pre-loaded Context
Active scopes:
!`find scopes -maxdepth 3 -name scope.md 2>/dev/null`
Checkpoints:
!`find scopes -name checkpoint.yaml -maxdepth 3 2>/dev/null`
Git status:
!`git status --short 2>/dev/null`
Current branch:
!`git branch --show-current 2>/dev/null`
# Implementation & Scope Execution
Executes scopes and tasks via three-phase TDD pipeline (tester → implementer → reviewer).
**INVARIANT: The orchestrator NEVER writes code or tests.** All code authoring — including test code — MUST be delegated to fresh subagents. This applies to ALL routes: scope execution, single tasks, file paths, and task descriptions. No exceptions.
---
## Auto-Detect Rules
**Pre-parse:** Extract these directives from `$ARGUMENTS` before pattern matching:
- `--reviewers <aliases>` — comma-separated list from `{opus, sonnet, gpt, gemini, gemini-pro, gemini-flash}`. Resolution and alias table: `/review` SKILL.md "Reviewer Selection". Resolved list is passed to Phase A.5 + Phase C dispatch. If absent and `validation.yaml.review_config` is also absent, fall back to the interactive AskUserQuestion prompt (same as `/review`).
- `--worktree` (or bare `worktree`) — checkout the determined branch as a `git worktree add ...` instead of in-place `git switch`. See "Git Workflow" → "Procedure" step 4.
- `--base <branch>` — base branch for new-branch creation. If absent and the branch doesn't exist, AskUserQuestion. See "Git Workflow" → "Procedure" step 3.
- `--state <draft|open>` — PR state when auto-creating a pull request at the end of execution (default: `draft`). Only used when `$ARGUMENTS` contains an issue reference.
- `gh:<n>`, `#<n>`, or a GitHub issue URL — flags GitHub-issue branch naming AND enables auto-PR creation after final review. See "Git Workflow" → "Branch Determination" and `operations/execute.md` Step 10.
Apply these rules to remaining `$ARGUMENTS` in order:
| Pattern | Route | Action |
|---|---|---|
| "verify" or "done" | Verify | Read and follow `operations/verify.md` |
| "debug" or "trace" | Debug | Read and follow `operations/debug.md` |
| Matches `./scopes/*/*/` path | Execute | Read and follow `operations/execute.md` |
| Exactly one active scope | Execute | Read and follow `operations/execute.md` |
| File path or task description | Direct | Use methodology below |
| No argument | Menu | See fallback |
---
## Menu Fallback
When no argument or ambiguous, use **AskUserQuestion**:
```
Header: Implement
Question: What would you like to do?
multiSelect: false
Options:
- Scope execution: Execute active scope with TDD pipeline (tester → implementer → reviewer)
- Verify: Evidence-based verification before claiming done
- Debug: Root cause tracing for a bug or failure
- Implement: Single implementation task with methodology below
```
**Routing by selection:**
| Selection | Action |
|---|---|
| Scope execution | Read and follow `operations/execute.md` |
| Verify | Read and follow `operations/verify.md` |
| Debug | Read and follow `operations/debug.md` |
| Implement | Use methodology below |
---
## When to Use
- Executing a scope's tasks via three-phase pipeline
- Building features from requirements
- Writing code or creating artifacts
- Deciding on structure, patterns, or approach
- Designing domain models or data structures
- Verifying completion or debugging failures
---
## Git Workflow
**MANDATORY:** The dispatcher MUST ensure a dedicated branch is checked out before dispatching any phase. Never run implementation phases on `main`/`master` or on an unrelated branch.
### Branch Determination
Detect the branch source from `$ARGUMENTS` and apply the matching naming convention:
| Source | Detection | Branch Name | Example |
|---|---|---|---|
| GitHub issue | `gh:<n>`, `#<n>`, or `github.com/<owner>/<repo>/issues/<n>` | `<issue#>-<issue-title-in-kebab-case>` | `142-add-user-auth` |
| Scope | `./scopes/<state>/<name>/` path or active scope | `feat/<scope-name>` | `feat/user-auth` |
| Direct task | File path or task description, no scope/issue | **AskUserQuestion** (see below) | — |
**For GitHub issues:** Fetch the title with `gh issue view <n> --json title -q .title`, kebab-case it (lowercase, spaces/punctuation → `-`, collapse repeats, trim), then prefix with the issue number. Do NOT add a `feat/` prefix — match GitHub's own branch convention.
### Procedure
1. **Determine branch name** per the table above.
2. **If source is unclear or ambiguous** (no scope, no issue ref, multiple candidates) → **AskUserQuestion**:
```
Header: Branch
Question: No branch detected for this work. How should I proceed?
multiSelect: false
Options:
- Use current branch: <current-branch>
- Create new branch: provide name
- GitHub issue: provide issue number
```
3. **Resolve base branch** (only needed when creating a new branch):
- Skip if branch already exists locally or on remote.
- If `--base <branch>` was passed in `$ARGUMENTS` → use it.
- Else → **AskUserQuestion**:
```
Header: Base branch
Question: New branch <name> needs a base. Which branch should it fork from?
multiSelect: false
Options:
- main (default trunk)
- <current-branch> (current — pick if cascading)
- Other: provide branch name
```
- Verify the base exists (`git rev-parse --verify <base>`) before proceeding.
4. **Checkout mode** — pre-parse `--worktree` (or `worktree`) from `$ARGUMENTS`:
- **Worktree directive present** → follow `skills/git/reference/worktree.md` end-to-end with `BRANCH_NAME=<branch>` from step 1 and the resolved base from step 3. All subsequent phases run from the reported worktree path.
- **No worktree directive** → in-place checkout:
- Branch exists locally → `git switch <name>` and pull latest
- Branch exists on remote → `git switch <name>` (tracks remote)
- Otherwise → `git switch -c <name> <base>` using the resolved base from step 3
5. **Verify** current working tree is on the determined branch before dispatching Phase A.
**Never** dispatch testers/implementers/reviewers while still on `main`, `master`, or a stale unrelated branch.
---
## Process (Single-Task Pipeline)
**The orchestrator NEVER writes code or tests.** All code authoring is delegated to subagents.
Even for a single task, the four-phase pipeline applies:
### Phase A: Dispatch Tester Subagent
Dispatch a **fresh tester subagent** (`subagent_type: "general"`) to write failing tests.
- Tester reads task requirements and discovers expected behavior independently
- Tester writes tests and verifies RED state
- Orchestrator verifies RED (see Quality Gates in `operations/execute.md`)
**Why a separate subagent?** The orchestrator's understanding of the task leaks into hand-written tests, causing oracle mirroring (tests that mirror implementation logic) and mock tautologies (mocks that assume the answer). A fresh subagent discovers behavior from code and specs independently.
### Phase A.5: Test Review Gate
Dispatch **all configured reviewers in parallel** (Claude `Task` + Pi `Bash` × N per `/review` config) on the test files from Phase A. Same cartesian dispatch pattern as Phase C — Pi shell-outs are mandatory whenever Pi is installed.
- Reviewers check for oracle mirroring, mock tautologies, framework tests, trivial assertions
- Synthesize findings: a test is flagged if any harness reports `issues_found`
- If issues found → re-dispatch tester with specific feedback; repeat until clean
- **Gate:** Implementer NEVER receives tests that failed this review
See dispatch template in `reference/subagent-workflow.md` — Test Review Dispatch Template.
### Phase B: Dispatch Implementer Subagent
Dispatch a **fresh implementer subagent** (`subagent_type: "general"`) with the test-review-cleared tester report.
- Implementer makes tests pass (GREEN)
- Implementer refactors while staying green
### Phase C: Review
For single tasks, review can be done inline or via reviewer subagent(s) depending on scope.
###Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.