Spec to impl

From edictum-ai/edictum · View interactive version

Spec to impl is an AI agent skill from the GitHub repository edictum-ai/edictum. Transform a feature spec into audited, implementation-ready prompts. Use when starting a new feature, designing a new adapter, or turning a design doc into sequenced build steps. Covers spec audit against project rules, gap identification, decision collection, and prompt generation.

How to use this skill

Skill file

Spec-to-Implementation Pipeline

Transform a feature specification into audited, implementation-ready sequenced prompts. This is a multi-phase process — do NOT skip phases or combine them.

Input: A spec file path (via $ARGUMENTS) or a feature description that needs a spec written first.

Output Directory

All artifacts go into .claude/skills/spec-to-impl/{feature-slug}/:

.claude/skills/spec-to-impl/{feature-slug}/
  README.md              <-- execution order, status tracking, dependency graph
  SPEC-AUDIT.md          <-- Phase 2 violations (persisted for reference)
  SPEC-DECISIONS.md      <-- Phase 3 decisions log
  P1-{SCOPE}.md          <-- first implementation prompt
  P2-{SCOPE}.md          <-- second implementation prompt
  ...

The {feature-slug} is derived from the spec file name or feature description (lowercase, hyphens, no spaces). Example: google-adk-adapter, sandbox-rules, hitl-approval.

Create the directory at the start of Phase 2 (once you know the feature name).


Phase 1: Gather Context

Before auditing anything, read the project rules. These are the audit criteria:

  1. CLAUDE.md — Architecture (core vs server boundary), non-negotiable principles, build/test commands, code conventions, API design checklist, security review checklist, terminology enforcement, pre-merge verification
  2. .docs-style-guide.md — Binding terminology reference, canonical terms, page structure pattern, pipeline description, cross-reference conventions
  3. docs/architecture.md — Pipeline overview, source layout, adapter responsibilities, what lives where

Then read the actual codebase to understand current state:

  1. Core modules — Read the relevant modules in src/edictum/ to know what already exists. Key files:
  1. Existing adapter patterns — Read at least 2 adapters in src/edictum/adapters/ to understand the established pattern (constructor, _pre/_post, _on_deny, _check_tool_success, _emit_audit_pre, pending state, observe mode, on_deny/on_allow callbacks, approval handling). Good choices:
  1. Test patterns — Read tests/conftest.py (shared fixtures: NullAuditSink, CapturingAuditSink, make_guard pattern), tests/test_adapter_parity.py (parity test tiers and helper function conventions), and one adapter test file (e.g., tests/test_adapter_openai_agents.py) to understand framework-mocking strategy.
  2. Docs patterns — Docs live in a separate repo (edictum-docs). Check README.md for any code examples that need updating.

Output of Phase 1: Internal understanding. No user-facing output yet.


Phase 2: Audit the Spec

Read the spec file. Audit every section against every rule. Be brutally honest.

Check for these categories of violations:

Architecture Violations (CRITICAL)

Adapter Pattern Violations (HIGH)

API Design Checklist (HIGH)

Security Review (HIGH)

Shared Module Duplication (HIGH)

Test Coverage Gaps (MEDIUM)

Terminology (MEDIUM)

Documentation Gaps (MEDIUM)

Design Gaps (LOW)

Output of Phase 2:

  1. Create the output directory: .claude/skills/spec-to-impl/{feature-slug}/
  2. Write violations to SPEC-AUDIT.md in that directory (persisted for reference)
  3. Present violations to the user as a prioritized table:
| Priority | # | Issue | Action needed |
|----------|---|-------|---------------|
| CRITICAL | 1 | ... | Decision: A, B, or C |
| HIGH | 2 | ... | Fix: specify X |
| ...

Group by priority. For each issue, state:


Phase 3: Collect Decisions

Wait for the user to respond to every issue. They will say things like:

Do NOT proceed to Phase 4 until every issue has a decision.

Output of Phase 3: Write SPEC-DECISIONS.md in the output directory with each issue number, the user's decision, and what will change.


Phase 4: Update the Spec

Apply all decisions to the spec file. This means editing the actual file, not just listing changes. After editing:

Output of Phase 4: Confirm the spec is updated. List any remaining minor items.


Phase 5: Generate Implementation Prompts

Slice the spec into sequenced prompts. Each prompt must be:

Sizing Rules

Prompt Structure (every prompt must include)

  1. Header: Scope, depends-on, deliverable, verification command
  2. Required reading: Specific files to read before coding (actual paths in the repo)
  3. Shared modules table: What to import, from where — prevents duplication of existing patterns
  4. Files to create/modify: Each file with its responsibilities and estimated line count
  5. Wiring instructions: How to connect new code to existing code (imports, parity test entries, architecture.md updates)
  6. Verification checklist: Specific commands and assertions:

What NOT to include in prompts

Prompt Naming and Location

Write each prompt as P{N}-{SCOPE}.md inside the output directory (.claude/skills/spec-to-impl/{feature-slug}/).

Examples: P1-CORE.md, P2-ADAPTER.md, P3-TESTS.md, P4-PARITY.md, P5-DOCS.md.

README.md Generation

After writing all prompts, generate a README.md in the output directory. This is the execution guide:

# {Feature Name} — Implementation Prompts

**Spec:** `{path-to-spec-file}`
**Generated:** {date}
**Status:** Not started

## Execution Order

| # | Prompt | Scope | Deliverable | Status | Depends On |
|---|--------|-------|-------------|--------|------------|
| 1 | [P1-CORE.md](P1-CORE.md) | ... | ... | [ ] | — |
| 2 | [P2-ADAPTER.md](P2-ADAPTER.md) | ... | ... | [ ] | P1 |
| 3 | [P3-TESTS.md](P3-TESTS.md) | ... | ... | [ ] | P2 |
| ...

## Dependency Graph

P1-CORE ──> P2-ADAPTER ──> P3-TESTS ──> P4-PARITY

└──> P5-DOCS


## Verification (run after all prompts complete)

pytest tests/ -v

ruff check src/ tests/

pytest tests/test_docs_sync.py -v


## Artifacts

- [SPEC-AUDIT.md](SPEC-AUDIT.md) — Audit violations from Phase 2
- [SPEC-DECISIONS.md](SPEC-DECISIONS.md) — User decisions from Phase 3

The Status column uses [ ] (not started), [~] (in progress), [x] (done), [!] (stalled). Update as prompts are executed.

Output of Phase 5: All prompt files and README.md written. Present the summary table to the user.


Phase 6: Final Review

Read all generated prompts in the output directory in sequence. Verify:

If issues found, fix the prompts and README, then note what changed.

Output of Phase 6: Confirm the output directory is complete. Print the path:

Implementation prompts ready at:
  .claude/skills/spec-to-impl/{feature-slug}/README.md

Key Principles

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.