Moonspec implement

From MoonLadderStudios/MoonMind · View interactive version

Moonspec implement is an AI agent skill from the GitHub repository MoonLadderStudios/MoonMind. Implement a single-story MoonSpec task breakdown with test-driven development. Use when the user asks to run or reproduce `/moonspec.implement`, execute `tasks.md`, build the story from a MoonSpec plan, write failing unit and integration tests before production code, mark tasks complete, or prepare

How to use this skill

Skill file

MoonSpec Implement

Use this skill to perform the MoonSpec implementation workflow.

When To Use

Use this skill after /moonspec.tasks has produced a complete tasks.md for one MoonSpec story.

Good triggers include:

Do not use this skill to split a broad design, write a spec, create a plan, or generate tasks. Use moonspec-breakdown, moonspec-specify, moonspec-plan, or /moonspec.tasks for those steps.

Inputs

Apply requirement statuses before all coverage and execution gates: unverified rows retain source IDs, reason and verifiableBy without executable tasks; needs_human rows retain the exact decision, owner, and action without executing it or claiming its completion. Only executable rows require code, tests, setup, and red-first evidence. Observed defects remain executable remediation; unavailable checks do not become defects. For all-Unverified stories, skip setup and code/test execution and run final verification with the disclosures.

If tasks.md is missing or lacks coverage for executable rows, stop and recommend /moonspec.tasks. If the source input is a broad technical or declarative design that has not been split into one-story specs, stop and recommend /moonspec.breakdown.

Pre-Implement Hooks

Before implementation, check for extension hooks:

  1. If .specify/extensions.yml exists, read it and look for hooks.before_implement.
  2. If the YAML cannot be parsed or is invalid, skip hook checking silently.
  3. Ignore hooks where enabled is explicitly false; hooks without enabled are enabled.
  4. Do not evaluate non-empty condition expressions. Treat hooks with no condition, null condition, or empty condition as executable. Skip hooks with non-empty conditions.
  5. For each executable hook:
## Extension Hooks

**Optional Pre-Hook**: {extension}
Command: `/{command}`
Description: {description}

Prompt: {prompt}
To execute: `/{command}`
## Extension Hooks

**Automatic Pre-Hook**: {extension}
Executing: `/{command}`
EXECUTE_COMMAND: {command}

Wait for the result of the hook command before proceeding to implementation.

If no hooks are registered or .specify/extensions.yml does not exist, skip silently.

Setup

Run the prerequisite script from the repository root:

.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks

Parse FEATURE_DIR and AVAILABLE_DOCS, then derive:

If shell arguments contain single quotes, use shell-safe escaping such as 'I'\''m Groot', or double quotes when possible.

Checklist Gate

If FEATURE_DIR/checklists/ exists, scan every checklist file:

Report a table:

| Checklist | Total | Completed | Incomplete | Status |
|-----------|-------|-----------|------------|--------|
| requirements.md | 12 | 12 | 0 | PASS |

Match incomplete checklist items to requirement status before gating. Unverified checks remain disclosed and unchecked, not blocking; actual needs_human items preserve their authority handoff. For other unfinished executable prerequisites, stop and ask whether to proceed.

Load Context

Read enough context to implement without guessing:

Validate before editing code:

If the spec contains multiple stories, stop and tell the user to split the design with /moonspec.breakdown or regenerate a one-story spec with /moonspec.specify.

Project Setup Verification

Only when executable work needs setup, create or verify the relevant ignore files:

Append only missing critical patterns. Do not rewrite existing ignore files wholesale.

Common patterns by stack:

Task Execution Model

Parse tasks.md into:

Execute only applicable planned work for executable rows; omit absent phases and never execute needs_human actions:

  1. Complete setup tasks.
  2. Complete foundational prerequisites before story work.
  3. Write unit tests and run them to confirm they fail for the expected reason.
  4. Write integration tests and run them to confirm they fail for the expected reason.
  5. Implement only enough production code to satisfy the failing tests and the single story.
  6. Run the relevant unit and integration test suites until they pass.
  7. Complete polish tasks without changing story scope.
  8. Run /moonspec.verify if it is present as a task; otherwise explicitly recommend it as the final MoonSpec check.

Rules:

Implementation Rules

Completion Validation

Before reporting completion:

  1. Verify every required task in tasks.md is complete.
  2. Evaluate production behavior against the story using evidence or valid Unverified disclosures; never describe unavailable checks as passed.
  3. Verify the implementation remains aligned with the original feature request or declarative design preserved in spec.md **Input**.
  4. Account for every in-scope source row with evidence, an Unverified disclosure, or a pending authority handoff; do not claim an unauthorized operation complete.
  5. Verify relevant AGENTS.md principles and testing discipline were not violated.
  6. Run feasible planned tests for executable rows; preserve unavailable-check disclosures.
  7. Run quickstart validation when present and feasible.
  8. Confirm no hidden scope or contradiction was introduced.
  9. Run the final /moonspec.verify task when present.

If a command cannot run because of missing credentials, services, tools, or unsafe side effects, record the exact reason and the smallest next step needed.

Report

Final response structure:

## MoonSpec Implementation

Implemented:
- [task IDs or story slice]: [short summary]

Tests:
- [command]: [PASS/FAIL/NOT RUN]

Verification:
- [/moonspec.verify result or recommendation]

Changed files:
- [path]

Remaining work:
- [blocking item or "None"]

Keep the report concise. Include blockers before summaries when implementation is incomplete.

Post-Implement Hooks

After completion validation, check .specify/extensions.yml for hooks.after_implement using the same parsing, filtering, and condition rules as pre-implement hooks. For each executable hook:

## Extension Hooks

**Optional Hook**: {extension}
Command: `/{command}`
Description: {description}

Prompt: {prompt}
To execute: `/{command}`
## Extension Hooks

**Automatic Hook**: {extension}
Executing: `/{command}`
EXECUTE_COMMAND: {command}

If no hooks are registered or .specify/extensions.yml does not exist, skip silently.

Key Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.