ai-code
$
npx mdskill add arcasilesgroup/ai-engineering/ai-codeCode implementation skill. Writes code that satisfies loaded context standards on the first pass. Lightweight self-review at build-time; full validation deferred to /ai-review.
SKILL.md
.github/skills/ai-codeView on GitHub ↗
--- name: ai-code description: "Writes production code that satisfies stack-context standards on the first pass: interface-first design, backward-compatibility checks, lightweight self-review. Trigger for 'implement this', 'write the code for', 'add X to Y', 'build this function', 'make this work'. Not for tests; use /ai-test instead. Not for debugging; use /ai-debug instead. Not for refactoring; use /ai-simplify instead. Not for executing an approved plan end-to-end; use /ai-build (the gateway)." effort: mid argument-hint: "[task description or file:target]" mode: agent model_tier: sonnet mirror_family: copilot-skills generated_by: ai-eng sync canonical_source: .claude/skills/ai-code/SKILL.md edit_policy: generated-do-not-edit --- # Code ## Purpose Code implementation skill. Writes code that satisfies loaded context standards on the first pass. Lightweight self-review at build-time; full validation deferred to /ai-review. ## When to Use - New features and implementing approved plans - Adding functionality to existing modules - Writing utility/helper code NOT for: tests (use /ai-test), debugging (use /ai-debug), refactoring (dispatch `ai-simplify`), schema work (use /ai-schema). ## Process Step 0 (load contexts): read `.ai-engineering/manifest.yml` `providers.stacks`; load `.ai-engineering/overrides/<stack>/conventions.md` for each stack and `.ai-engineering/overrides/_shared/conventions.md`; load `.ai-engineering/team/*.md` for team conventions. ### Step 1: Pre-Coding Checklist Before writing any code: 1. **Restate the task** in one sentence -- confirm understanding 2. **Identify target files** -- existing files to modify or new files to create 3. **Search for existing patterns** -- grep for similar implementations in the codebase to match conventions 4. **Check decision-store.json** -- read `.ai-engineering/state/decision-store.json` for relevant architectural decisions ### Step 2: File Placement Protocol 1. New files go in the directory matching existing project structure -- follow the pattern, do not invent new paths 2. Test files mirror source structure (e.g., `src/foo/bar.py` -> `tests/foo/test_bar.py`) 3. Never create top-level files without explicit user instruction 4. If unsure about placement, check 3 similar files in the codebase and follow their pattern ### Step 3: Interface-First Design 1. Define public interfaces (protocols, abstract classes, type signatures) before writing implementation 2. Document the contract: inputs, outputs, errors, side effects 3. If the interface touches other modules, check those modules' existing contracts first 4. Skip for trivial changes (single-function additions, config updates) ### Step 4: Write Code Implement following all loaded context standards. Apply stack-specific conventions from Step 0 and `.ai-engineering/reference/operational-principles.md`. Write the minimal code that satisfies the requirement. ### Step 5: Backward Compatibility Check 1. If changing a public function signature: add deprecation path or confirm breaking change is intentional 2. If modifying config format: ensure backward-compatible parsing 3. If renaming exports: grep for all callers and update them 4. Skip for internal/private code ### Step 6: Self-Review Follow `.ai-engineering/overrides/_shared/compliance-trace.md` for the compliance trace protocol. ## Common Mistakes - Writing code before loading contexts (standards drift) - Inventing new file paths instead of following existing project structure - Skipping interface definition for non-trivial features - Not checking for callers when changing public signatures - Ignoring anti-patterns listed in context files - Self-reviewing against general knowledge instead of loaded context rules ## Examples ### Example 1 — implement a feature from a plan task User: "implement T-1.2: add the JWT validator function in src/auth/jwt.py" ``` /ai-code "T-1.2 JWT validator in src/auth/jwt.py" ``` Loads stack context, places file by mirroring existing structure, defines the interface, writes minimal compliant implementation, runs the compliance trace. ### Example 2 — extend an existing module with backward compatibility User: "add a new `--strict` flag to the validate command without breaking existing callers" ``` /ai-code "add --strict flag to validate command, preserve existing behavior" ``` Greps for callers, defines additive flag with default that matches current behavior, runs backward-compatibility check before commit. ## Integration Called by: `ai-build` agent, `/ai-build`, user directly. Calls: stack-specific linters (post-edit validation via `ai-build` Step 4). Transitions to: `/ai-test` (GREEN), `/ai-verify` (quality), `/ai-review` (review). See also: `/ai-test`, `/ai-debug`, `/ai-simplify`. $ARGUMENTS
More from arcasilesgroup/ai-engineering
- ai-adviseProactive governance advisor — checks standards, decisions, and quality trends during development. Always advisory, NEVER blocks. Three modes: `advise` (post-edit), `gate` (pre-dispatch), `drift` (on-demand decision audit). Trigger for 'governance check', 'advise on this change', 'check for drift', 'is this aligned with active decisions', 'shift-left advisory'. Not for blocking gates — use /ai-verify. Not for narrative code review — use /ai-review.
- ai-analyze-permissionsUse when Claude Code keeps asking to approve commands you have already approved, when settings.local.json has grown large, or when you want to consolidate permission grants into wildcard patterns. Trigger for 'too many permission prompts', 'clean up permissions', 'audit my settings', 'consolidate allow rules'. Claude Code only — not available in GitHub Copilot, Antigravity, or Codex.
- ai-animationDesigns motion, transitions, and micro-interactions for UI components: spring animations, gestures, easing, staggers — taste-driven detail compounding. Trigger for 'animate this', 'add transitions', 'micro-interactions for', 'gesture design', 'swipe to dismiss', 'easing for this', 'stagger the'. Not for design systems; use /ai-design instead. Not for visual art; use /ai-visual instead. Not for testing animation code; use /ai-test instead.
- ai-autopilotDelivers large multi-concern specs and backlog runs autonomously: decomposes specs into sub-specs (or normalizes work items into a backlog DAG), deep-plans with parallel agents, builds a dependency DAG, implements in waves, runs a single final quality loop with one bounded quality-remediation pass (verify+guard+review on full changeset), delivers via PR. Trigger for 'implement spec-NNN end to end', 'autopilot this', 'autonomous delivery', 'decompose and ship', 'run the backlog', 'execute these GitHub issues', 'process the sprint backlog'. Invocation is the approval gate. Not for small or single-concern tasks; use /ai-build instead. Not for ambiguous requirements; use /ai-brainstorm first.
- ai-boardOperates the project board (GitHub Projects v2 or Azure DevOps): discovers configuration after install (fields, state mappings, process templates) and syncs work-item state at lifecycle transitions. Trigger for 'set up the board', 'configure our ADO board', 'discover board fields', 'move this issue to in-review', 'update the board', 'mark as in progress', 'sync the work item state'. Two subcommands: `discover` (post-install configuration write) and `sync` (lifecycle state transitions). Auto-invoked via `sync` by /ai-brainstorm, /ai-build, and /ai-pr; fail-open. Not for backlog execution; use /ai-autopilot --backlog instead.
- ai-brainstormForces rigorous design interrogation BEFORE any code: explores approaches, surfaces ambiguity, gathers evidence, produces an approved spec that becomes the contract for /ai-plan. Trigger for 'lets add X', 'how should we handle Y', 'whats the best approach', 'I am thinking about', 'what should we build for'. Not for existing approved specs; use /ai-plan instead. Not for execution; use /ai-build instead.
- ai-branch-cleanupCleans branches safely: switches to the default branch, prunes merged and squash-merged branches, syncs to remote, sweeps stale specs, rotates `.ai-engineering/runtime/` per retention policy. Trigger for 'tidy up', 'tidy branches', 'sync to main', 'delete old branches', 'start fresh', 'rotate runtime'. Auto-invoked by /ai-pr after merge. Not for committing changes; use /ai-commit instead. Not for code-level dead-code removal; use /ai-simplify instead.
- ai-buildCanonical implementation gateway: reads approved plan.md, resolves stack from manifest, deterministic-routes each task to its adapter, dispatches the build agent in an isolated worktree, runs TDD self-validation per task, then a single final quality loop with one bounded quality-remediation pass on the full changeset before /ai-pr. Trigger for 'go', 'start building', 'execute the plan', 'implement it', 'lets do this', 'build the plan', 'resume', 'continue'. Not without an approved plan; run /ai-plan first. Not for multi-concern specs needing decomposition; use /ai-autopilot instead. Not for a single function or subcomponent; use /ai-code.
- ai-commitRuns the governed commit pipeline: auto-branches from protected, stages selectively, formats and lints, scans for secrets, gates docs, composes a conventional message, pushes. Trigger for 'commit my changes', 'save my work', 'push this to remote', 'stage these files', 'ship it'. Not for opening a PR; use /ai-pr instead. Not for branch hygiene; use /ai-branch-cleanup instead.
- ai-constitutionInterviews the operator to produce a project-identity CONSTITUTION.md (Mission / Stakeholders / Vocabulary / Prohibitions / Compliance gates / Anti-goals / Boundaries / Escalation / Language / Lifecycle phase). Trigger for 'set up the constitution', 'define project identity', 'who is this project for', 'what does this project never do', 'amend the constitution'. Not for AI-behaviour rules — those live in CANONICAL.md / AGENTS.md. Not for spec governance; use /ai-governance instead.