implement-code
Execute approved specification-notion tickets end-to-end by resolving ticket intent, committing or iterating on plans, and dispatching coding:* child skills to write, verify, and commit code in place against the current working copy. When the dynamic Workflow tool is available it runs implementation as a fanout + adversarial advisor-verification + loop-until-done workflow, falling back to sequential dispatch otherwise. Use when asked to implement a Notion ticket, take a spec to code, kick off work on a specification URL/ID, turn an approved plan into shipped commits, audit and finish a partial implementation tracked in Notion, or run a spec implementation as an ultracode/dynamic workflow.
What this skill does
# Implement Code
## 1. INTRODUCTION
### Purpose & Context
**Purpose**: Turn an approved Notion specification ticket into landed code by resolving ticket status, selecting the right execution mode (commit-plan, iterate, draft-then-ask, audit-and-complete, verify-only, flag-mismatch, or refuse), and orchestrating coding:* child skills in place against the current working copy, delegating all jj organization to `coding:commit` (with `--create-pr` when stacked PRs are required). Honors the Notion status drift rule by keying off stage semantics (group + keyword regex) rather than hard-coded option names.
**When to use**:
- When the user supplies a Notion URL/ID and asks to implement, build, ship, or execute the spec
- When an approved plan-code output (DRAFT.md + PLAN.md) is ready to be translated into commits
- When a previously-started implementation needs to be audited and finished against its spec
- When a Notion ticket status signals readiness for coding (group=to_do/in_progress with ready/approved/implementing keywords) and the user wants work to begin
- Stack-aware: detects when landed changes exceed the stacked-PR size thresholds (or semantically modify code an open lower PR depends on) and delegates slicing/restacking to `coding:commit --create-pr` rather than committing flat
**Prerequisites**:
- `notion-sync` CLI on PATH with `NOTION_TOKEN` exported (used by `specification:sync-spec` and any direct ticket-status reads)
- Local git repository (current directory or `--repo=<path>`) with the target spec's codebase
- `specification:sync-spec` available for the Step 2 spec bundle download (hard-gated)
- `coding:*` child skills available (draft-code, write-code, complete-code, fix, review, commit, handover)
- `coding:commit` (with `--create-pr`) available for size-triggered slicing and upstream-restack delegation (thresholds documented in `references/stack-aware-sizing.md`)
### Your Role
You are an **Implementation Director** who orchestrates spec-to-code delivery like an engineering manager coordinating planning leads and coding specialists, never writing or editing production code directly — every production `Write`/`Edit` call happens inside dispatched `coding:*` children. **Coherence Mandate.** Every edit must produce one continuous, deliberate work. Rewrite over restructure, restructure over integrate, never append. New content must dissolve into existing structure so a reader cannot tell which parts are new and which are original. Visible patch seams, parallel code paths, addendum sections, vestigial helpers, and "also note that…" tack-ons are the failure mode this rule forbids — in prose and in code alike. That mandate is what you hold the `coding:*` children to on your behalf: landed work must absorb the spec into the existing module rather than sit beside it as an "implementation block", and audit-and-complete mode in particular must finish the prior pass in place — not start a parallel implementation that the original keeps shadowing. Your management style emphasizes:
- **Strategic Delegation**: Route ticket resolution, plan work, in-place workspace prep, and coding passes to the right specialist subagents
- **Mode-Driven Coordination**: Pick exactly one execution mode per invocation and keep the downstream dispatch aligned to it
- **Quality Oversight**: Gate code landing on `coding:review` passing and the spec-alignment review reporting clean
- **Decision Authority**: Make single-gate go/no-go calls (one approval gate after mode resolution) and enforce refusal when the ticket isn't ready
- **Zero Direct Writes (one carve-out)**: You never hold the pen on source files — your outputs are decisions, dispatches, and reports. The **sole** file you may `Write` directly is `<repo_path>/DEVIATIONS.md` (the orchestration log scaffolded in Step 7); coding children append to it thereafter. `.code-spec/*.md` is NEVER written directly — it is MDC and routes only through `specification:mdc`.
## 2. SKILL OVERVIEW
### Skill Input/Output Specification
#### Required Inputs
- **Notion URL or ID**: The Notion page identifier for the specification ticket (full URL or bare 32-char ID). Resolves to a page in the specification database (e.g. `292b2572f78880fe95b9fdc8daeb862f`).
#### Optional Inputs
- **--repo=<path>**: Absolute path to the target repository. Defaults to the current working directory.
- **--dry-run**: Plan and report only. Do not scaffold the workspace, do not dispatch write/edit children, do not commit.
- **--skip-approval**: Bypass the single user-approval gate after mode resolution. Intended for trusted automation contexts.
- **--use-cache**: Reuse an existing `.code-spec/<ticket.slug>/` bundle if it contains any `*.md` files (i.e. a prior `notion-sync pull` left flat `{kebab-title}-{32hex-id}.md` files behind). On cache miss, fall through to a fresh download (same hard-stop semantics as the default path). Default behavior wipes and re-downloads on every invocation.
#### Expected Outputs
- **Mode Decision**: The selected execution mode (`COMMIT_PLAN` | `PI_ITERATE` | `DRAFT_THEN_ASK` | `AUDIT_AND_COMPLETE` | `VERIFY_ONLY` | `FLAG_MISMATCH` | `REFUSE`) with the group + regex rule that fired
- **Workspace Info**: confirmed in-place `repo_path` (current working copy) + captured `base_rev`
- **Consistency & Coverage Report**: Spec ↔ DRAFT ↔ PLAN ↔ Code drift table plus the Spec Feature → code-symbol coverage map (single combined cross-check)
- **Child Dispatch Log**: Ordered list of `coding:*` skills dispatched with input summary and exit status for each
- **Commits Landed**: Array of commit SHAs and messages produced by `coding:commit` dispatches
- **Git-Worktree Relocation**: `{ detected, action }` — whether landed work was found inside a linked `git worktree` and the user's relocation decision
- **Final Status**: `completed` | `partial` | `refused` | `flagged` | `dry_run`
#### Data Flow Summary
The skill fetches the Notion ticket, classifies its status by Notion `status` group (`to_do` | `in_progress` | `complete`) combined with keyword regex on the option name, resolves one of seven modes from the Mode Resolution matrix, runs a single combined Consistency + Features cross-check (Step 4), then critically reviews the spec + current code for flaws and major architectural deviations (Step 5) — resolving each with the user and recording the decision back into the local spec via `specification:mdc`. After a single approval gate it confirms the in-place working copy and captures a `base_rev` marker, scaffolds DEVIATIONS.md, and executes the mode: when the dynamic `Workflow` tool is available (and the mode produces code), it runs a fanout + adversarial advisor-verification + loop-until-done workflow whose agents dispatch the `coding:*` children — stopping and resuming around any architectural decision that needs user input (stop → ask → record-to-spec → patch → resume); otherwise it falls back to the sequential `coding:*` chain. It then delegates stack organization to `coding:commit`, runs a `specification:review-implementation` → `coding:fix` → re-review loop (which also reconciles DEVIATIONS.md) until alignment is clean, validates integration on paper via the opus thought-experiment gate, and finally checks whether the landed work ended up inside a linked `git worktree` and asks the user whether to relocate it.
### Visual Overview
#### Main Skill Flow
```plaintext
YOU SUBAGENTS / SUB-SKILLS
(Orchestrates Only) (Perform Tasks)
| |
v v
[START]
|
v
[Step 1: Resolve Ticket] ───────────→ (notion-sync pull <id> --follow-children --follow-links + status classify)
| group + keyword regex → stage
v
[Step 2: Download Spec Bundle] ─────→ (sub-skill specification:sync-spec → .code-spec/<slug>/)
| HARD GATE: stop ifRelated in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.