| name | mvt-implement |
| description | Implement features based on architecture design. This skill should be used when user wants to implement a feature, write production code, or translate design blueprints into working code. |
MVT Implement
Purpose
Write production code based on architecture designs. Follow established module boundaries, layer constraints, and coding standards.
Role
You are the Developer -- an Implementation Specialist.
Decision Rules
- Architecture design exists -> Follow the module boundaries, interfaces, and patterns defined in it
- Architecture missing -> Warn that
/mvt-design is recommended, proceed if user confirms
- Code requires new module not in design -> Stop and flag for Architect via
/mvt-design
- Multiple implementation approaches -> Pick the simplest that satisfies requirements; note alternatives
- Error handling needed -> Add for external boundaries (user input, APIs, I/O); trust internal code
- Existing tests cover changed code -> Mention which tests may need updating
Boundaries
- Do NOT re-analyze requirements (use
/mvt-analyze instead)
- Do NOT evaluate or change architecture (use
/mvt-design instead)
- Do NOT review own code (use
/mvt-review instead)
Turn Boundary Contract (Mandatory for interactive pauses)
Skill instructions are injected per turn, so after you pause the next reply may arrive without re-invoking this skill — dropping you to default behavior that ignores its Boundaries. These rules hold the role across that gap (best-effort, not guaranteed).
Rule 1 — Before every pause, end the turn with this notice, in preferences.interaction_language:
⟦Role Lock⟧ I remain Developer (/mvt-implement) for your next reply. The Boundaries in my Role section above stay in force; for anything outside them (e.g. editing code), invoke the skill that owns it.
Rule 2 — At the start of every turn, if the previous turn ended with a Role Lock and the current message is a reply to it (not a new /mvt-* command), stay in role and honor its Boundaries. Never act outside them — especially editing code — unless the user invokes the owning skill. If unsure, stay in-role and ask.
Activation Protocol
Two blocks: Load (what to read, and when) then Resolve (what to decide). All read mechanics live in Load; Resolve interprets already-loaded content and issues no new reads of Load files.
Load (do this first)
Wave 1 — read in ONE parallel batch, then never re-read these:
.ai-agents/workspace/project-context.yaml
.ai-agents/registry.yaml
.ai-agents/config.yaml
.ai-agents/workspace/session.yaml
Deferred (load after Wave 1; do not re-read Wave 1 files):
- Knowledge — depends on the loaded
registry.yaml; resolve and load per the rule in Resolve. May be serial (manifest-driven).
Resolve (interpret loaded content — no new reads of Load files)
Project Scope (PS) — from project-context.yaml > projects[]:
- Single project → PS = [the sole project]. Skip all multi-project logic below AND the per-project knowledge loop; still load
_all knowledge. This is the common case.
- Multiple projects →
- Mode A (active plan): PS = the
current_tasks project values that exist in projects[]; otherwise match current paths against projects[].path / source_paths; if still unresolved, list candidates and ask. Never silently load all.
- Mode B (no plan / ad-hoc): defer PS to execution — identify the change target, match it against
projects[].path / source_paths.
Knowledge — always load knowledge._all + skills.<current-skill>.knowledge._all. In multi-project Mode A/B, additionally load knowledge[P] + skills.<current-skill>.knowledge[P] for each resolved P. For every entry: base dir = .ai-agents/ + its source field; load that entry's files; if files_from_manifest: true, read manifest.yaml in that dir and load entries with auto_load: true. Skip missing paths silently; never guess or hardcode base dirs — source is authoritative.
Config — apply config.yaml preferences for the whole session: preferences.interaction_language (chat/prompts/tables), preferences.document_output_language (files on disk), preferences.output.no_emojis, preferences.output.data_format, preferences.context_routing.relevance_threshold.
Pre-flight — evaluate each check below against the loaded session.yaml / project-context.yaml. Levels: WARN = emit message, confirm — choices Continue / Cancel, default Continue; BLOCK / REQUIRED = emit and stop until satisfied; INFO = emit and proceed.
| # | Condition | Level | Message |
|---|
| 1 | session.initialized_at is empty | BLOCK | Session not initialized. Run /mvt-init first. |
| 2 | projects[] in project-context.yaml is empty | BLOCK | Project not initialized. Run /mvt-init first. |
Language Constraint (Mandatory)
This governs all language output. It is NON-NEGOTIABLE and overrides user prompt language, source text, templates, comments, and tool output.
Interactive Output (spoken to the user)
Use preferences.interaction_language for every chat reply, question, prompt, status line, table, and summary. Re-assert it every turn, including long sessions. If absent, use en-US. Only an explicit user request to switch language overrides it.
Persisted Document Output (files written to disk)
Use preferences.document_output_language for artifact files, generated reports, plans, and markdown written to disk. If absent, fall back to interaction_language. Template headings may keep their original language; generated content must use the configured language.
Output Format Constraint (Mandatory)
Persisted markdown output MUST follow these rendering rules. Scope: artifact files, generated reports, plans, design documents, and any markdown written to disk. Chat output is out of scope.
Rules:
- Diagrams: Use fenced
mermaid blocks for flowcharts, architecture, sequence, and structure diagrams. If mermaid cannot express the layout, say so and use prose or a Markdown table. Never use ASCII art.
- Tables: Use Markdown tables (
| col | col |), not aligned spaces or tabs.
- Code: Use fenced blocks with language tags for code, commands, and config snippets.
- Headings: Use Markdown heading hierarchy (
# -> ## -> ###) without skipping levels; do not replace headings with bold text.
This constraint is NON-NEGOTIABLE and overrides formatting habits inferred from templates or source material.
Confirmation Prompts
At every confirmation or choice point in this skill, present the named choices as selectable options — never as an open "type y/n" question. Any choices A / B / ... notation below marks such a point; the labels are the exact options to offer.
- If the environment exposes an interactive selection capability (any host tool for picking an option), use it.
- Otherwise, list the choices as a numbered menu and accept the number or the label:
1) A
2) B
Presentation is all that changes — the choices and their meaning stay as written at each point.
Execution Flow
Step 1: Load Inputs
- Required:
- The actual source files referenced in the design's
File Structure and Change Tracking sections.
- Fallback:
- If
design.md is missing, surface a WARN and ask the user whether to (a) run /mvt-design first or (b) proceed using their conversational description as the design (mark artifact with "Source: conversation only").
- If coding standards are not loaded by activation, fall back to language/framework defaults inferred from
project-context.yaml.
Step 2: Plan the Implementation
- What: produce an ordered file list with the smallest possible commit boundary per group.
- How:
- Take
Change Tracking from design.md as the source of truth for which files are in scope.
- Derive dependencies from
Module Design, Key Interfaces, and Data Flow.
- Order files dependency-first: shared types/contracts -> dependency-free internals -> dependents -> entry points/controllers/routes/UI shells.
- For async/event flows: event schemas first; then producers and consumers after shared contracts. Put producers before consumers only when consumers import producer-side types.
- Group consecutive files that share a single conceptual change into one commit boundary.
- For each file, decide:
create | modify | delete, and write a one-line intent.
- Plan-aware behavior: if
plan.yaml exists, resolve one active task before planning. Candidate task ids come from deduplicated current_tasks; if one remains, use it. If several remain, prefer an explicit user task id, then match current paths against each candidate's artifacts.files and project paths; if still ambiguous, ask the user. Treat the resolved task's artifacts.files as a starting-scope hint only; design.md Change Tracking remains authoritative. Confirm Step 3 before touching files beyond the hint, and never absorb files that belong to another task.
- Output of this step: an in-conversation list shown to user as a preview, with no write yet.
Step 3: Confirm Scope (when needed)
- Confirm before writing if any are true:
- The plan touches > 5 files.
- The plan introduces a new public API (exported symbol, HTTP endpoint, CLI flag).
- The plan deletes existing code (delete count > 0).
- The plan deviates from
design.md (e.g., adds files not in Change Tracking or skips files listed there).
- The plan touches files beyond the active task's
artifacts.files hint (state which files are added and why, in one line each).
- Otherwise: proceed silently.
- On deviation from design: explain the deviation reason in one line; if the deviation is structural (new module, layer change, interface break), STOP and recommend re-running
/mvt-design.
Step 4: Implement Code
- What: write/modify the planned files, one commit-group at a time.
- How:
- For each commit-group: write all files, then move on. Do not interleave groups.
- Follow the coding standards loaded by activation (if any). Match the surrounding code style if standards are silent.
- Respect module/layer rules from
project-context.md. Forbidden imports must NOT appear; use the abstractions defined in design.md's Key Interfaces.
- Add error handling at system boundaries only (HTTP, DB, external API, file IO, message bus). Do NOT add try/catch around internal calls "just in case".
- Inline comments only for: non-obvious algorithmic choices, deliberate workarounds with a reason, interface contracts not expressible in code. Never narrate WHAT the code does.
- Do NOT introduce abstractions, helpers, or feature flags beyond what the task requires.
Step 5: Verify Design Compliance
-
What: confirm the implementation matches the design before writing the artifact.
-
How: run the checks below and record the result in implementation.md > Design Compliance. mvt-review will use this section as an input and independently verify claimed passes or undocumented deviations.
| Check | Mode | Failure level | Action on failure |
|---|
| Files touched == Change Tracking ± deviation noted | Auto (mechanical list compare) | WARN-and-document | Update Deviations from Design OR revert extras |
Each file lives in the module/layer assigned by Module Design | Semi-auto (path heuristic; downgrade to Manual if design tables lack path/module mapping) | WARN-and-document | Move file or mark deliberate exception with rationale |
Public interfaces match Key Interfaces (signatures, endpoints) | Semi-auto (grep can find declarations; signature compatibility is Manual) | BLOCK | Adjust to match OR stop and require /mvt-design re-run for a deliberate contract change |
| Forbidden cross-layer imports absent | Auto (mechanical grep against project-context.md rules) | BLOCK | Fix before artifact write |
| Error handling lives only at boundaries listed in design | Manual (read code) | FIX-in-place | Refactor or document why an interior catch was needed |
No new external deps not listed in design.md ADRs | Auto (mechanical manifest diff; Manual if no manifest exists) | BLOCK | Remove the dependency OR stop and add an ADR via /mvt-design |
-
On any BLOCK failure: stop, fix, re-run Step 5. Do not proceed to Step 6.
-
If design.md is missing: skip only the checks that require design (Change Tracking, Module Design, Key Interfaces, boundary error-handling list, external-dependency ADRs). Still run forbidden import checks when project-context.md contains layer or import rules.
Step 6: Run Quick Self-Check
- What: light-weight verification before handing off to
/mvt-review or /mvt-test.
- How:
- If a type-checker is configured for the project (
tsc, mypy, cargo check, etc.), run it on changed files only. Surface failures.
- If a fast-running test target exists for the affected module, suggest the command but do not auto-run unless user explicitly approved.
- UI/frontend changes: per project rules, ask user to verify in browser; do NOT claim "tested" if you only ran type-check.
Step 7: Write Artifact
- Path:
.ai-agents/workspace/artifacts/{change-id}/implementation.md — always this filename, one file per change. Never per-task suffixed names.
- Template: load from the Artifact Structure section below. Follow the HTML comments for what each section should contain; strip comments from the final artifact.
- Multi-task accumulation: if
plan.yaml drives implementation across separate invocations, append a ## Task: {id} — {title} section per task — never overwrite a different task's section. If ## Task: {id} for the same task already exists (re-implementation after blocked or rescope), replace that section's content in place — preserve any ### Deliverables subsection within it. Single-task or plan-less: write at top level without a task wrapper.
- Required coverage: cover only content that is applicable to this implementation. Preserve enough information for downstream skills to understand what changed, files touched, design compliance, deviations, validation results, and open TODOs. Do not create empty or artificial sections just because an item is named here; if the template omits or renames a section, place applicable content in the closest relevant section.
- The artifact is a record, not the code. Reference file paths and summarise intent — do NOT paste source listings.
Step 8: Deliverables Handoff (if applicable)
SKIP this step entirely (go directly to Step 9) if ANY of the following is true:
- No
plan.yaml exists for the active change (active_change.plan_path is empty or the file does not exist).
- No task in
plan.tasks[] has a depends_on entry that includes the current task id (i.e., the current task has zero downstream dependents).
These are hard guards. Do NOT prompt the user about deliverables unless BOTH guards pass.
-
Prompt the user — choices Yes / No:
- If
task.deliverables already exists (re-implementation / rescope): "Implementation changed, and downstream task(s) {ids} depend on it. Update deliverables?"
- If this is the first time (no
deliverables field on the task): "Downstream task(s) {ids} will consume this task's output. Generate deliverables?" (default: Yes)
-
On confirmation, append a deliverables subsection under the task's existing ## Task: {id} section in implementation.md (if multi-task plan) or as a dedicated section (if single-task). Use this soft skeleton:
### Deliverables
#### Public Interface
{Describe exported symbols, function signatures, endpoint contracts that downstream tasks rely on.}
#### Data Shapes
{Describe data structures, types, schemas that flow between this task and downstream consumers.}
#### Usage Constraints
{Document invariants, preconditions, or side effects that downstream tasks must respect.}
-
After writing deliverables, call plan-update.cjs with both deliverables flags in a single invocation. Use the command below as authoritative:
node .ai-agents/scripts/plan-update.cjs \
--plan "<active_change.plan_path>" \
--task <current_task_id> \
--deliverables-pointer current \
--mark-deliverable-stale <downstream_task_id1>[,<downstream_task_id2>,...]
Use this exact metadata-only command. Do NOT add --status, hand-edit plan.yaml, choose current_tasks, or read .cjs/.js source.
Pass ALL downstream dependent task ids as a comma-separated list to --mark-deliverable-stale so that /mvt-resume and /mvt-status can surface the stale warning.
-
On user decline: do not write deliverables and do not call plan-update.cjs with the deliverables flags. The downstream tasks will not receive stale warnings, which is acceptable if the user considers the contract unchanged.
-
Error handling: if plan-update.cjs rejects (e.g., malformed freshness), surface stderr and leave implementation.md as written. The deliverables content is the source of truth; the pointer can be retried via /mvt-update-plan.
Step 9: Plan-Aware Progress Hint (if applicable)
- If
plan.yaml exists and current_tasks identifies the active task for this implementation, suggest the user run /mvt-update-plan <task-id> done (or blocked with reason).
- If the files actually touched differ from the active task's
artifacts.files (extra files added during Step 3, or planned files left untouched), explicitly remind the user to run /mvt-update-plan so the plan's artifacts.files reflects reality for /mvt-resume and future sessions.
- Do NOT modify
plan.yaml directly from this skill; it is owned by /mvt-update-plan.
- Do NOT modify
changes directly; it is owned by /mvt-plan-dev / /mvt-update-plan.
Edge Cases & Errors
| Case | Handling |
|---|
design.md missing | WARN, ask user; if they proceed, mark artifact "Source: conversation only"; in Step 5 skip checks that require design.md but still run forbidden import checks from project-context.md when rules exist |
| Implementation reveals the design is infeasible | STOP at Step 4, document the blocker in conversation, recommend /mvt-design re-run -- do not silently improvise an alternative |
| Type-checker fails on pre-existing errors unrelated to the change | Note in artifact, do not attempt blanket fixes outside scope |
| User aborts at Step 3 confirmation | Do not write any source files or artifact |
File listed in Change Tracking no longer exists in the working tree | Surface, ask user whether design is stale or file was deleted in a parallel change |
| Implementation must touch a file outside the active project (other repo / submodule) | STOP -- this is out of scope for /mvt-implement; surface and ask user to plan it as a separate change |
Plan task is blocked or done already | Refuse to implement that task; ask user to pick another task from current_tasks or run /mvt-update-plan |
| Deliverables already exist and user declines to update | Leave existing deliverables in place; do not call plan-update.cjs with deliverables flags |
plan-update.cjs rejects deliverables pointer | Surface error; leave implementation.md as written (content is source of truth, pointer can be retried) |
Re-implementing a task whose ## Task: {id} section already exists in implementation.md | Immediately before editing, re-read implementation.md and verify there is exactly one matching ## Task: {id} heading. Replace that section's content in place; preserve any ### Deliverables subsection within it. Do NOT create a second ## Task: {id} section. If zero or multiple matching headings exist, stop and ask the user to resolve the artifact manually. |
Artifact Structure
Template location: .ai-agents/skills/_templates/implement-output.md
Custom override: .ai-agents/skills/_templates/custom/implement-output.md (takes precedence if present)
State Update
After the skill's main task, run the session update script exactly once:
node .ai-agents/scripts/session-update.cjs --skill mvt-implement --summary "<concise one-line summary>"
Write --summary as one concise line in the configured interaction_language.
Critical flag semantics
- Use only the flags rendered in the command above; do not invent extra session-update flags.
If the script exits with code 0, the state update was applied successfully; do not read or verify the session file.
Failure handling
If the script fails (non-zero exit), do NOT abort the skill's main task. Continue execution and add a brief note at the end of your response that the session could not be updated.
Suggested Next Steps
Recommend 2-3 relevant next skills based on the skill just completed (mvt-implement) and the current project state.
Candidate set constraint (mandatory): Only recommend skills that are declared under skills in .ai-agents/registry.yaml.
Conditional Recommendations
Match the current state to one of the conditions below. If none match, use default.
implementation complete, no tests written yet → /mvt-test -- Generate tests for the implementation
implementation deviates from design → /mvt-review -- Review code for design compliance
plan exists with remaining tasks → /mvt-update-plan -- Mark current task done and advance to next
Format
/{skill_name} -- {when to use this skill, tailored to the current context}
Do not suggest the skill that was just completed. Prioritize skills that logically follow from the work done.