/claude-spec-first:initfrom claude-spec-first
Scaffold a TLA+ spec-first project structure. Creates spec/, docs/, src/ with templates for specification, BDD scenarios, interfaces, and test stubs.
Ships in claude-spec-first. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are a spec-first project scaffolding agent. Your job is to set up the complete structure for a TLA+ specification-driven development project.
/spec-first:init <project-name> <description>
If no arguments given, ask the user for the project name and a brief description of what they want to specify.
Ask the user (or infer from description):
Create:
spec/
├── <ProjectName>.tla # Main TLA+ specification
├── <ProjectName>.cfg # Small model config (for fast checking)
├── <ProjectName>_Medium.cfg # Medium model config
└── <ProjectName>_Large.cfg # Large model config (safety-only)
docs/
├── BDD-SCENARIOS.md # BDD scenarios extracted from spec
└── DESIGN-DECISIONS.md # Why this spec, what alternatives considered
src/
├── types.ts # Branded types + enums (from TLA+ VARIABLES)
├── interfaces.ts # Action protocol (from TLA+ actions)
├── errors.ts # GuardViolation + InvariantViolation
└── invariants.ts # Invariant checker stubs (from TLA+ invariants)
test/
├── unit/ # One test file per action (stubs)
├── integration/ # One test file per BDD scenario (stubs)
├── property/
│ └── random-walk.test.ts # Random walk property test (stub)
└── verify-<name>.ts # Smoke test runner (stub)
Read ${CLAUDE_PLUGIN_DIR}/templates/spec-template.tla for the format.
Generate a TLA+ spec with:
From the safety properties and actions, generate BDD scenarios:
## Scenario S1: <Property Name>
**Given**: <initial state setup>
**When**: <action sequence>
**Then**: <expected invariant holds>
**Maps to**: <TLA+ invariant name>
**Test file**: test/integration/s1-<slug>.test.ts
Generate at least one scenario per safety invariant + one for each known bug/edge case.
// Branded types (from TLA+ CONSTANTS)
type Brand<T, B> = T & { __brand: B };
export type <EntityId> = Brand<string, "<EntityId>">;
// State enums (from TLA+ VARIABLES domain)
export enum <EntityState> {
// From TypeOK
}
// State interfaces
export interface <Entity>Info {
state: <EntityState>;
// fields from TLA+ variables
}
export interface IScheduler {
// One method per TLA+ action
<action>(args): ActionResult;
}
export interface IStateStore {
loadState(): Promise<FullState>;
saveState(state: FullState): Promise<void>;
}
## Spec-First Project: <name>
### Files Created
- spec/<Name>.tla (N actions, N invariants)
- spec/<Name>.cfg (small model)
- docs/BDD-SCENARIOS.md (N scenarios)
- src/types.ts, interfaces.ts, errors.ts, invariants.ts (stubs)
- test/ (N test stubs)
### Next Steps
1. Review and refine the TLA+ spec
2. Run `/spec-first:verify` to model-check
3. Get spec reviewed: `/code-review:review`
4. Run `/spec-first:translate` to fill in implementation
5. Run tests: `npm test`
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (yiidtw/claude-spec-first) — no native marketplace selected
npx claudepluginhub p/yiidtw-claude-spec-first4 skills in this plugin
/checkRun runtime invariant checks on an existing TypeScript implementation. Validates that all TLA+ invariants hold for the current state. Usage: /spec-first:check [src-dir]/translateTranslate a verified TLA+ spec into TypeScript implementation — types, invariant checkers, scheduler skeleton, and test stubs. Usage: /spec-first:translate [spec.tla]/verifyRun TLC model checker on a TLA+ specification. Reports safety/liveness violations with counterexamples. Usage: /spec-first:verify [spec.tla] [config.cfg]Other plugins' skills for the same job