Skip to content
/

spec-first (sunrain520)

spec-first-sunrain · sunrain520/spec-first · ★ 30 · last commit 2026-05-26

npm CLI + 40 skills + 51 agent reviewers that turns AI coding into a repeatable loop where scripts prepare deterministic facts and LLMs make semantic decisions.

Best whenThe hard problem of AI-assisted development is not agent coordination but keeping software decisions durable and reusable across sessions — the workflow chai…
Skip ifHand-editing generated runtime files in .claude/ instead of source in skills/, Treating doctor-passing as full graph readiness
vs seeds
spec-kit(Archetype 2, CLI + commands/skills) but 4x larger component footprint (40 skills, 51 agents vs. 9+9) and adds an option…
Primitive shape 92 total
Skills 40 Subagents 51 Hooks 1
00

Summary

spec-first (sunrain520) — Summary

An npm-installable CLI (spec-first) that turns AI coding sessions into a repeatable engineering loop for Claude Code and Codex. Installs via npm install -g spec-first, ships a spec-first binary with commands including doctor, init, and workflow entry points, and generates runtime assets (.claude/ and .codex/ directories) at init time.

The methodology centers on a nine-stage workflow: ideate → brainstorm → plan → write-tasks → work → code-review → debug → compound → optimize. Each stage produces a durable Markdown artifact in docs/. A GitNexus/code-graph layer provides code-graph-aware context for impact analysis and cross-module review.

The component footprint is unusually large for a single-author project: 40 skills and 51 named agent files, covering domain-specific reviewers (Rails, TypeScript, iOS, Python), adversarial review agents, architectural strategists, and CI/CD deployment specialists.

Closest seed match is spec-kit (Archetype 2 — CLI + mirror commands/skills), but spec-first-sunrain has a significantly larger component count (40 skills vs. 9), deeper agent library, and an explicit "scripts prepare facts, LLM decides semantics" philosophy that resembles the claude-conductor architectural approach.

01

Overview

spec-first (sunrain520) — Overview

Origin

Created by sunrain520. Repository description: "AI coding workflow CLI for spec-driven engineering." 30 stars, last commit 2026-05-26 (actively updated). Available on npmjs.com as the spec-first package, version 1.8.2. Has a documentation website at spec-first.cn.

Philosophy

The hard problem is not multi-agent coordination — it is keeping software decisions durable and reusable across sessions:

From the README:

"The hard problem is not only how to make more agents cooperate. The hard problem is how to keep the software lifecycle itself legible: requirements, plans, tasks, diffs, reviews, failures, and learnings must survive beyond one session."

On the core architectural principle:

"Scripts prepare facts; LLMs make semantic decisions."

The CLAUDE.md in the repository states:

"Light contract: contract must be lightweight, clear, and maintainable. Explicit boundaries: clarify source-of-truth, generated runtime, provider, artifact, consumer boundaries. Scripts prepare, LLM decides: scripts produce deterministic facts, LLM makes semantic judgments."

Core workflow chain:

"Codebase → Graph → Spec → Plan → Tasks → Code → Review → Knowledge"

Key differentiator from agent orchestration tools (README table)

Question Agent orchestration tools spec-first
Primary unit Agent, role, team, queue Requirement, plan, task pack, diff, review, bug, learning
Main problem How should agents coordinate? How should software decisions stay durable and reusable?
State location Session state, message bus, runtime memory Repo-local docs, generated runtime assets, verifiable CLI facts
Automation boundary Often pushes toward more autonomous chains Scripts prepare facts; LLMs make semantic decisions
02

Architecture

spec-first (sunrain520) — Architecture

Distribution

  • Type: npm-package (CLI tool)
  • Install: npm install -g spec-first
  • Install complexity: npm-install

Directory tree (repo source)

spec-first/
├── bin/
│   ├── spec-first.js       ← CLI binary entry point
│   └── postinstall.js      ← Post-install hook
├── src/
│   └── cli/                ← CLI source (Node.js)
│       ├── index.js
│       ├── commands/       ← CLI command implementations
│       ├── adapters/       ← Host adapters (claude, codex)
│       ├── contracts/      ← Quality gate contracts
│       └── ...
├── skills/                 ← 40 named skills (source-of-truth)
├── agents/                 ← 51 named agent files (source-of-truth)
├── templates/              ← Spec/plan/task templates
├── CLAUDE.md               ← Project guidelines + managed block
├── AGENTS.md               ← Cross-agent guidance
├── README.md               ← English documentation
├── README.zh-CN.md         ← Chinese documentation
├── package.json            ← CLI package definition (spec-first binary)
├── jest.config.js
└── tests/                  ← Test suite

Generated runtime directories (post-init)

.claude/               ← Generated by spec-first init --claude
  skills/              ← Runtime mirrors of source skills
  hooks/               ← SessionStart hook
  settings.json        ← Permissions + hook config
.codex/                ← Generated by spec-first init --codex
  skills/              ← Runtime mirrors for Codex
.agents/skills/        ← Shared agent skill mirrors

Required runtime

  • Node.js >= 20.0.0
  • npm
  • Git
  • Claude Code OR Codex (at least one)

Target AI tools

  • Claude Code (primary)
  • Codex CLI
  • Both simultaneously (init --claude && init --codex)

Config files

File Purpose
CLAUDE.md Project guidelines + managed spec-first block
AGENTS.md Cross-agent (Codex) guidance
.claude/settings.json Claude Code permissions + SessionStart hook
03

Components

spec-first (sunrain520) — Components

CLI Binary: spec-first

Command Purpose
spec-first doctor Health check: Node/Git/package checks, stale verification evidence
spec-first init --claude Generate Claude Code runtime assets
spec-first init --codex Generate Codex runtime assets
spec-first init --claude --codex Generate assets for both hosts
spec-first doctor Verify CLI/runtime layer readiness

Skills (40, source in skills/)

Partial list of named skills:

  • using-spec-first — entry governor and routing skill
  • spec-ideate — ideation workflow
  • spec-brainstorm — requirements brief generation
  • spec-plan — implementation plan generation
  • spec-work — implementation + verification
  • spec-work-beta — beta work workflow
  • spec-code-review — structured code review
  • spec-doc-review — documentation review
  • spec-debug — debugging workflow
  • spec-compound — compound knowledge workflow
  • spec-compound-refresh — refresh compound knowledge
  • spec-optimize — optimization workflow
  • spec-update — update/maintenance workflow
  • spec-write-tasks — task generation
  • spec-graph-bootstrap — code graph readiness refresh
  • spec-mcp-setup — MCP/helper tool setup
  • spec-sessions — session management
  • spec-standards — coding standards enforcement
  • spec-polish-beta — polish/release prep
  • spec-release-notes — release notes generation
  • spec-slack-research — Slack-based research integration
  • spec-app-consistency-audit — cross-tool config audit
  • spec-skill-audit — skill quality audit
  • spec-dhh-rails-style — DHH/Rails style enforcement
  • agent-native-architecture — agent-native architecture review
  • agent-native-audit — agent-native code audit
  • git-worktree — worktree management
  • git-commit — conventional commit helper
  • git-commit-push-pr — commit + push + PR creation
  • git-clean-gone-branches — branch cleanup
  • changelog — changelog management
  • proof — proof loop runner
  • test-browser — browser test runner
  • test-xcode — Xcode test runner
  • lfg — quick start workflow
  • frontend-design — frontend design workflow
  • feature-video — feature video creation
  • report-bug — bug report workflow
  • resolve-pr-feedback — PR feedback resolution
  • gemini-imagegen — Gemini image generation (experimental)

Agents (51, source in agents/)

Named agent files covering domain-specific reviewers:

  • spec-adversarial-reviewer.agent.md — adversarial review
  • spec-adversarial-document-reviewer.agent.md
  • spec-agent-native-reviewer.agent.md
  • spec-architecture-strategist.agent.md
  • spec-security-reviewer.agent.md
  • spec-security-sentinel.agent.md
  • spec-performance-reviewer.agent.md
  • spec-maintainability-reviewer.agent.md
  • spec-reliability-reviewer.agent.md
  • spec-correctness-reviewer.agent.md
  • spec-code-simplicity-reviewer.agent.md
  • spec-testing-reviewer.agent.md
  • spec-data-integrity-guardian.agent.md
  • spec-schema-drift-detector.agent.md
  • spec-scope-guardian-reviewer.agent.md
  • spec-dhh-rails-reviewer.agent.md
  • spec-kieran-python-reviewer.agent.md
  • spec-kieran-rails-reviewer.agent.md
  • spec-kieran-typescript-reviewer.agent.md
  • spec-swift-ios-reviewer.agent.md
  • spec-julik-frontend-races-reviewer.agent.md
  • spec-web-researcher.agent.md
  • spec-best-practices-researcher.agent.md
  • spec-git-history-analyzer.agent.md
  • spec-session-historian.agent.md
  • spec-deployment-verification-agent.agent.md
  • ... and 25+ more

Hooks

1 hook (SessionStart):

  • session-start — re-injects spec-first bootstrap block if stale

Scripts

Script Purpose
scripts/run-test-suite.cjs Run test suites
scripts/release-publish.cjs npm release
scripts/lint-skill-entrypoints.js Lint skill entry points
scripts/typecheck-js.js Type check
scripts/run-ai-dev-quality-gate.js AI dev quality gate
bin/postinstall.js Post-install setup

MCP Servers

None bundled. The spec-mcp-setup skill handles external MCP provider configuration (GitNexus, Serena, etc.).

05

Prompts

spec-first (sunrain520) — Prompts

Excerpt 1 — using-spec-first SKILL.md (verbatim excerpt)

---
name: using-spec-first
description: "Use before substantial work in a spec-first project, and when users ask what spec-first workflow or command to run next."
---

# Using Spec-First

`using-spec-first` is the standalone meta skill and entry governor for `spec-first` in this repository. It decides whether the current request should enter a public `spec-first` workflow before the agent changes state.

## Contract Summary

| Field | Contract |
| --- | --- |
| When to use | Before substantial work in a `spec-first` repo, and when the user asks what `spec-first` workflow or command to run next. |
| When not to use | Lightweight factual answers, narrow code-location questions, or work already governed by an active public workflow. |
| Artifacts | None. `using-spec-first` does not create plans, task packs, review reports, or durable knowledge. |
| Failure modes | Ambiguous WHAT/HOW, unclear target repo, stale or missing runtime guidance, or a request that names an impossible/unsafe route. Ask one narrow question or route to the repair workflow instead of guessing. |

Prompting technique: Contract-table format. Rather than prose instructions, the skill opens with a machine-readable contract table defining inputs, outputs, when-to-use, when-not-to-use, and failure modes. This reduces ambiguity about the skill's scope.

Excerpt 2 — Core philosophy boundary (from CLAUDE.md verbatim)

## 核心哲学 (Core Philosophy)

必须始终保持:

- **Light contract**:contract 必须轻量、明确、可维护。
- **Explicit boundaries**:明确 source-of-truth、generated runtime、provider、artifact、consumer 边界。
- **Scripts prepare, LLM decides**:脚本产出确定性事实,LLM 做语义判断。

核心 workflow 链路:

Codebase -> Graph -> Spec -> Plan -> Tasks -> Code -> Review -> Knowledge

Prompting technique: Bilingual Iron Law. The core philosophy is written in Chinese (the author's primary language) which may make it less likely to be inadvertently overridden by English-language reasoning. The "Scripts prepare, LLM decides" axiom explicitly separates deterministic operations from semantic judgment.

Excerpt 3 — Scope guard from using-spec-first (verbatim)

### What Counts as Substantial Work

Treat these as substantial work:
- modifying code, docs, config, or generated runtime assets
- starting implementation, debugging, review, planning, setup, update, bootstrap, optimization, or context-capture workflows
- making architectural, prompt, workflow, governance, or contract decisions

These are not substantial work:
- lightweight factual answers
- brief explanations with no workflow leverage
- quick questions where `spec-first` provides no meaningful routing benefit

Prompting technique: Explicit scope boundary with positive/negative examples. Defining what is NOT substantial work is as important as what is — this prevents the governor from over-triggering on trivial queries.

09

Uniqueness

spec-first (sunrain520) — Uniqueness

differs_from_seeds

Closest to spec-kit (Archetype 2 — CLI + mirror commands/skills) but with an order-of-magnitude larger component footprint: 40 skills and 51 agent files vs. spec-kit's 9 commands + 9 skills. The "scripts prepare facts, LLM decides semantics" philosophy and explicit source/runtime boundary management are architectural principles borrowed more from claude-conductor (Archetype 4 — markdown scaffold) than from spec-kit. The graph layer (GitNexus, code-graph indexes in .spec-first/) adds code-topology-aware context not present in any seed — the closest analogue is taskmaster-ai's MCP-anchored tool server, but spec-first-sunrain's graph is an optional addon rather than the core. The 51 named agent files for domain-specific review (Rails, TypeScript, Python, iOS, security, performance, maintainability) makes this the most "persona library"-heavy single-author project in the batch, resembling BMAD-METHOD's persona system (Archetype 1) applied to code review rather than development roles.

Positioning

A mature, production-quality single-author framework that has grown beyond its SDD origins into a comprehensive AI engineering workflow harness. The documentation in both English and Chinese (with a Chinese website) indicates a dual-language user base. Version 1.8.2 with npm publish and CI/CD pipeline suggests stable release cadence.

Observable failure modes

  1. Readiness ladder complexity: Three layers (doctor → mcp-setup → graph-bootstrap) must be validated before graph-heavy workflows. Users frequently confuse doctor-passing with full readiness.
  2. Source/runtime split confusion: The explicit source-of-truth vs. generated-runtime architecture requires discipline — editing generated files in .claude/ instead of source in skills/ causes silent drift.
  3. Large component surface: 40 skills + 51 agents creates a high learning curve. The using-spec-first governor helps but there are many workflows to understand.
  4. Optional graph layer: Without MCP setup and graph bootstrap, cross-module impact analysis is degraded. Workflows that depend on graph evidence may produce "missing evidence" warnings.
  5. Chinese-primary codebase: CLAUDE.md and internal documentation are partially in Chinese, which may create friction for English-only contributors.
04

Workflow

spec-first (sunrain520) — Workflow

Core workflow chain

Codebase → Graph → Spec → Plan → Tasks → Code → Review → Knowledge

Main workflow stages (host-session entries)

Stage Claude Code Codex Artifact
Ideate /spec:ideate $spec-ideate docs/ideation/YYYY-MM-DD-topic-ideation.md
Brainstorm /spec:brainstorm $spec-brainstorm docs/brainstorms/YYYY-MM-DD-NNN-topic-requirements.md
Plan /spec:plan $spec-plan docs/plans/YYYY-MM-DD-NNN-topic-plan.md
Work /spec:work $spec-work code, tests, verification notes
Code review /spec:code-review $spec-code-review structured findings + residual risks
Debug /spec:debug (n/a) debug artifacts
Compound /spec:compound $spec-compound learning document
Optimize /spec:optimize (n/a) optimization notes

Readiness ladder

Three layers (doctor → mcp-setup → graph-bootstrap) must be passed before graph-backed workflows:

Layer Command Proves
CLI/runtime health spec-first doctor Node/Git/package checks, runtime assets present
Harness setup /spec:mcp-setup MCP/helper tool config complete
Graph readiness /spec:graph-bootstrap GitNexus/.spec-first/graph/* indexes ready

Fast path

Lightweight workflows (docs changes, small bugs, planning) can proceed after doctor alone:

$spec-ideate / $spec-brainstorm / $spec-plan / $spec-work / $spec-code-review

Approval gates

Gate Type When
Spec review file-review After brainstorm before plan
Human review human-required For high-risk changes
/spec:code-review post-implementation file-review After work

Artifact naming convention

docs/ideation/YYYY-MM-DD-{topic}-ideation.md
docs/brainstorms/YYYY-MM-DD-{NNN}-{topic}-requirements.md
docs/plans/YYYY-MM-DD-{NNN}-{topic}-plan.md
docs/tasks/YYYY-MM-DD-{NNN}-feat-{topic}-tasks.md

Phase routing

The using-spec-first skill is the entry governor. When used before any substantial work, it classifies the request and routes to the appropriate workflow entry point.

06

Memory Context

spec-first (sunrain520) — Memory & Context

State storage

Hybrid file-based system with optional graph layer:

Primary state (always available):

docs/
  ideation/YYYY-MM-DD-*.md
  brainstorms/YYYY-MM-DD-NNN-*.md
  plans/YYYY-MM-DD-NNN-*.md
  tasks/YYYY-MM-DD-NNN-*.md

Graph layer (optional, requires MCP setup):

.spec-first/
  graph/        ← GitNexus code graph indexes
  providers/    ← Provider configs
  impact/       ← Impact analysis artifacts

Source vs. runtime distinction

A key architectural principle: source files and generated runtime files are explicitly separated.

Source-of-truth (committed, never auto-modified):

  • CLAUDE.md, AGENTS.md
  • skills/, agents/, templates/
  • src/cli/

Generated runtime (do not hand-edit):

  • .claude/ — generated by spec-first init --claude
  • .codex/ — generated by spec-first init --codex
  • .agents/skills/ — runtime mirrors

If runtime drift occurs, repair via spec-first init --claude (not by hand-editing generated files).

Persistence

  • Project level: docs/ directory artifacts persist across sessions
  • Graph level: .spec-first/ graph indexes persist but must be refreshed on branch changes

Cross-session handoff

Each artifact in docs/ carries a date-stamped filename and NNN sequence number, enabling resumption by reading the most recent artifact for the active feature.

Context injection

SessionStart hook in .claude/settings.json re-injects the spec-first bootstrap block from CLAUDE.md if it is stale or missing.

Compaction handling

SessionStart hook handles context reset scenarios. The using-spec-first skill instructs the agent to re-read CLAUDE.md after compaction events.

Memory type

Hybrid: file-based (primary) + optional external graph (GitNexus, MCP-bridged).

07

Orchestration

spec-first (sunrain520) — Orchestration

Multi-agent support

Yes, via 51 named agent files. Agents are domain-specific reviewers and specialists dispatched for particular review tasks:

  • Adversarial reviewers
  • Security/performance/maintainability reviewers
  • Language-specific reviewers (Rails, TypeScript, Python, iOS)
  • Research agents (web, Slack, git history)
  • Deployment verification agents

Orchestration pattern

Sequential primary workflow + task-decomposition-tree for reviews. The main spec→plan→tasks→code chain is sequential. The review stage dispatches multiple specialist agents in parallel for comprehensive coverage.

Execution mode

Interactive-loop. The spec-first CLI provides entry points; agent session management is interactive.

Isolation mechanism

None. In-place edits in the project directory. Git worktrees are supported via the git-worktree skill but are not mandated.

Multi-model routing

None. The CLI is model-agnostic.

Prompt chaining

Yes, explicit. The workflow chain Codebase → Graph → Spec → Plan → Tasks → Code → Review → Knowledge is an explicit sequence where each artifact feeds the next.

Consensus mechanism

None.

Auto-validators

  • spec-first doctor — CLI health check (runtime, dependencies)
  • spec-skill-audit — skill quality audit
  • spec-app-consistency-audit — cross-tool config consistency check
  • Quality gate contracts in src/cli/contracts/
  • CI gate: npm run test:ai-dev:gate

Subagent definition format

Agent files use *.agent.md naming convention with a role description at the top. This is the persona-md format.

Git automation

Yes, via skills:

  • git-commit — conventional commit helper
  • git-commit-push-pr — commit + push + PR
  • git-clean-gone-branches — branch cleanup
08

Ui Cli Surface

spec-first (sunrain520) — UI / CLI Surface

Dedicated CLI binary

Yes.

  • Name: spec-first
  • Language: Node.js
  • Install: npm install -g spec-first
  • Is thin wrapper: No — it has its own orchestration logic (init, doctor, runtime asset generation)
  • Primary subcommands: doctor, init (with --claude / --codex / -u / --lang flags)

Local web dashboard

None. Documentation website at spec-first.cn (external, not a local dashboard).

IDE integration

Claude Code and Codex via generated runtime assets.

After spec-first init --claude:

  • .claude/skills/ — runtime mirrors of all 40 source skills
  • .claude/settings.json — permissions + SessionStart hook
  • CLAUDE.md managed block updated

After spec-first init --codex:

  • .codex/skills/ or .agents/skills/ — Codex runtime mirrors

Host-session entries

Claude Code:

/spec:ideate      /spec:brainstorm    /spec:plan
/spec:work        /spec:code-review   /spec:debug
/spec:compound    /spec:optimize      /spec:graph-bootstrap
/spec:mcp-setup   /spec:sessions      (and 30+ more)

Codex:

$spec-ideate      $spec-brainstorm    $spec-plan
$spec-work        $spec-code-review   $spec-compound

Observability

  • spec-first doctor — runtime health check report
  • Test suite: npm run test (unit, smoke, integration, release)
  • AI dev quality gate: npm run test:ai-dev:gate
  • CI workflows in .github/

Shell completion

None for the spec-first binary.

Related frameworks

same archetype · same primary tool · same memory type

Claude-Flow / Ruflo ★ 55k

Eliminates single-agent context limits and sequential bottlenecks by orchestrating fault-tolerant swarms of specialized AI agents…

Hermes Agent (NousResearch) ★ 168k

Self-improving personal AI agent with closed learning loop, 7 terminal backends, and messaging gateway — not tied to any AI…

OpenCode ★ 165k

Terminal-first AI coding agent with multi-model routing, native desktop app, and a typed .opencode/ configuration system for…

OpenHands ★ 75k

Open-source AI software development platform (open-source Devin alternative) with Docker sandbox isolation, 77.6% SWE-bench…

DeerFlow ★ 70k

Long-horizon superagent that researches, codes, and creates by orchestrating parallel sub-agents with isolated contexts in Docker…

oh-my-openagent (omo) ★ 60k

Multi-provider AI agent orchestration for OpenCode: escape vendor lock-in by routing Sisyphus (Claude/Kimi/GLM) and Hephaestus…