/claude-spec-first:checkfrom claude-spec-first
Run runtime invariant checks on an existing TypeScript implementation. Validates that all TLA+ invariants hold for the current state. Usage: /spec-first:check [src-dir]
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 runtime invariant validation agent. Your job is to verify that a TypeScript implementation correctly enforces all TLA+ invariants.
src/invariants.ts in the current directorysrc/types.ts, src/scheduler.ts, src/interfaces.tsRead all source files to understand the state model and invariant checkers.
Look for spec/*.tla in the current directory. Read it to understand the original invariants.
For each TLA+ invariant, verify:
checkAndPersist flow?Build a mapping table:
| TLA+ Invariant | TS Checker | Faithful? | Integrated? | Notes |
|----------------|-----------|-----------|-------------|-------|
| TypeOK | checkTypeOK() | ✓ | ✓ | |
| SkillExclusivity | checkSkillExclusivity() | ✓ | ✓ | |
| NoBypassSafety | checkNoBypassSafety() | ⚠ | ✓ | Missing edge case |
For each TLA+ action, verify that the TypeScript implementation:
if checkGuardViolation with the correct code| TLA+ Action | TS Method | Guards Complete? | Atomic? | Notes |
|-------------|----------|-----------------|---------|-------|
| Submit(t) | submit() | ✓ | ✓ | |
| Schedule(t,s,n) | schedule() | ✓ | ✓ | ATOMIC: skill+task in one step |
Execute the test suite to verify all invariants hold:
# Run all tests
npm test 2>&1
# Run property tests specifically (high coverage)
npx vitest run test/property/ 2>&1
# Run verification script
npx tsx test/verify-*.ts 2>&1
Check for common translation errors:
getState() should return deep copies to prevent external mutationsaveState after mutation## Invariant Check Report
**Spec**: <TLA+ file>
**Implementation**: <TypeScript files>
**Date**: <date>
### Invariant Mapping
| # | TLA+ Invariant | TS Checker | Faithful | Integrated | Test Coverage |
|---|----------------|-----------|----------|------------|---------------|
| 1 | TypeOK | checkTypeOK | ✓ | ✓ | 5 tests |
| 2 | ... | ... | ... | ... | ... |
### Guard Mapping
| # | TLA+ Action | TS Method | Guards | Atomic | Test Coverage |
|---|-------------|----------|--------|--------|---------------|
| 1 | Submit | submit() | 2/2 ✓ | ✓ | 8 tests |
| 2 | ... | ... | ... | ... | ... |
### Test Results
- Unit tests: N/N pass
- Integration tests: N/N pass
- Property tests: N random walks, 0 violations
- Verification: N/N checks pass
### Issues Found
1. [SEVERITY] <description> — <file:line>
**TLA+ reference**: <invariant or action>
**Fix**: <recommendation>
### Confidence Level
- **Invariant completeness**: X/Y invariants verified faithful
- **Guard completeness**: X/Y actions verified complete
- **Test coverage**: X% of state space explored
- **Overall**: HIGH / MEDIUM / LOW
Save to ${CLAUDE_PLUGIN_DIR}/data/latest-check.json.
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
/initScaffold a TLA+ spec-first project structure. Creates spec/, docs/, src/ with templates for specification, BDD scenarios, interfaces, and test stubs./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