Moonspec breakdown

From MoonLadderStudios/MoonMind · View interactive version

Moonspec breakdown is an AI agent skill from the GitHub repository MoonLadderStudios/MoonMind. Extract coverage-checked, independently testable MoonSpec user stories from a technical or declarative design and write breakdown output under artifacts/story-breakdowns (gitignored). Use when the user asks to run or reproduce `/moonspec.breakdown`, split a broad design into one-story candidates, pr

How to use this skill

Skill file

MoonSpec Breakdown

Use this skill to perform the MoonSpec breakdown workflow.

When To Use

Use this skill when the user wants to turn a broad technical or declarative design into multiple independently testable story candidates.

Good inputs include:

Do not use this skill for a single natural-language feature request. Use moonspec-specify for one clearly scoped story.

Inputs

1. Source document path: if an explicit source document path is provided, resolve it relative to the repo root unless it is absolute, then read it before extracting stories.

2. Jira issue description: if no source document path is provided and trusted Jira issue context is available from MoonMind previous outputs, use jiraPresetBrief or the Jira issue description/acceptance criteria from that trusted context.

3. Workflow instructions: if neither of the above is available, use the workflow instructions or user request text as the source design.

Input Classification

Classify the source design before extracting coverage points, using the document classes in docs/Workflows/MoonSpecDocumentModel.md:

A document is declarative when it describes what the system is or should be; it is imperative when its primary framing is steps, phases, checkboxes, or status. Mixed documents are classified by their primary framing.

Prefer declarative sources when the input preference chain provides one. If no

declarative design is selected, use the imperative input instead of requiring

explicit confirmation. For imperative-input, infer the underlying desired

system behavior, constraints, and operator outcomes from the steps. Do not

create one story per checklist item unless that item is independently valuable

and testable as a user or operational outcome. Preserve any story-critical

uncertainty as assumptions or needsClarification rather than stopping solely

because the source is imperative.

Record the resulting class as sourceDocumentClass in the breakdown output.

Pre-Breakdown Hooks

Before extracting stories, check for extension hooks:

  1. If .specify/extensions.yml exists, read it and look for hooks.before_breakdown.
  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 the Outline.

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

Breakdown Workflow

1. Summarize The Design

Summarize the design in a few sentences, focusing on:

2. Extract Canonical Claims And Coverage Points

For canonical file-backed declarative documents, identify the selected stable

canonical claims before creating run-local coverage points:

those exact identifiers.

stable claim IDs from the repo-relative source path, source heading, and claim

order within that heading. Use deterministic, path-anchored IDs that remain

stable across reruns when surrounding unrelated text changes.

summary. The path must be the canonical repo-relative document path when

the source came from a repo file.

workflow instructions, or imperative-input, do not fabricate canonical claim

IDs. Use only run-local coverage IDs and preserve the selected source

title/key and source path when one exists.

Convert the design into normalized major design points with stable IDs: DESIGN-REQ-001, DESIGN-REQ-002, and so on.

For each coverage point, capture:

Include these design point classes when present:

3. Draft Candidate Stories

Create the smallest reasonable set of stories that fully covers the design while preserving clarity and independent validation.

Rules:

For each story, define:

4. Normalize And Order Stories

5. Run The Coverage Gate

Create a coverage matrix from every selected canonical claim ID and every

DESIGN-REQ-* point to one or more stories.

A coverage point or canonical claim passes only when at least one story

explicitly owns it in story scope, acceptance criteria, requirements, or source

design coverage. Implied coverage is not enough.

A point is weakly owned if a reasonable reader cannot tell which story is responsible for implementing or enforcing it.

If any coverage point is uncovered, weakly covered, spread so thinly that ownership is unclear, or covered only by future-work language, revise the stories and rerun the gate.

Do not write specs until the gate result is exactly:

PASS - every major design point is owned by at least one story.

Write Breakdown Output

After the coverage gate passes, write story candidates under artifacts/story-breakdowns/ (repository gitignore; not versioned).

Use the explicit storyBreakdownPath and storyBreakdownMarkdownPath values from the prompt when present. If they are not present, create a timestamped folder under artifacts/story-breakdowns/<short-name>-<YYYYMMDD-HHMMSS>/ and write:

Never name any breakdown output spec.md. Never write to specs/ during breakdown.

The JSON file must be an object with:

DESIGN-REQ-* point to story IDs.

Each story object must include:

The markdown file must include the same substance for human review:

The gate result must be exactly:

PASS - every major design point is owned by at least one story.

Report

Report completion with:

Post-Breakdown Hooks

After reporting, check .specify/extensions.yml for hooks.after_breakdown using the same parsing, filtering, and condition rules as pre-breakdown 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

sourceReference.path and non-empty sourceReference.claimIds back to stable

canonical claims in the original declarative document. Non-canonical

file-backed and imperative inputs preserve the selected source path when one

exists and use run-local coverageIds with empty claimIds. Source text

without a file path must carry the selected source title/key with path: null

and empty claimIds.

DESIGN-REQ-* coverage points before drafting story candidates.

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.