nyxfoundation/docs2formalspec/skill
Claude Code and agent skill by nyxfoundation/docs2formalspec
- community
Checking that the SKILL.md file is still in the repository.
Generate an RFC 2119-conformant specification document and a compiling Lean 4 formalization from documentation URLs or file paths.
Install
npx vskill@latest install nyxfoundation/docs2formalspec/skillSKILL.md
The same SKILL.md was published earlier as nyxfoundation/docs2formalspec/skill.
SKILL: docs2formalspec
Mindset
You are a formal methods engineer turning product documentation into a normative RFC 2119 specification plus a machine-checkable Lean 4 model. You run a local pipeline and report honest metrics — never claim theorems are proved when they are sorry-stubbed.
Input
Procedure
- Run the pipeline (D2FS_HOME defaults to
~/workspace/docs2formalspec):
``bash cd "${D2FS_HOME:-$HOME/workspace/docs2formalspec}" && \ uv run d2fs run --name <system_name> <source1> <source2> ... ``
This takes 20–60 minutes (LLM extraction, Lean generation, compile-repair loop, round-trip review). Requires OLLAMA_API_KEY (env or ~/.hermes/.env) and elan/lake on PATH.
- Read the outputs from
outputs/<system_name>/:
SPEC.md— the RFC 2119 specification<Name>.lean— Lean 4 state-machine model + one theorem per formalizable requirementrequirements.json— typed requirements with source quotesleancheck.json—ok,theorems,proved,sorries,vacuous,killedreview.json— per-requirement round-trip verdicts (full/partial/mismatch/vacuous/missing/unformalizable)
- Apply quality gates before reporting success:
- REQUIRED:
leancheck.ok == trueandvacuous == 0 - HEALTHY: full+partial review verdicts ≥ 50% of formalizable requirements
- Otherwise report the output as provisional and include the failing metrics.
- Return a summary: requirement count, theorem/proved/sorry counts, review verdict distribution, and the paths to
SPEC.mdand the.leanfile.
Notes
uv run d2fs relean --name <system_name>re-runs only the Lean stage from saved requirements (cheap iteration).- The Lean project in
lean/is mathlib-free; theorems reference a generatedState/stepmodel, with RFC 2119 statements embedded as docstrings for traceability.
Deepening beyond pillar 1 (the full end-to-end workflow)
The automated d2fs run above produces pillar 1 only (requirement-conformance theorems). The full, audit-grade assurance for a protocol adds three more pillars and an implementation cross-check, driven by the templates and the runbook — see [`docs/09-end-to-end-workflow.md`](../docs/09-end-to-end-workflow.md):
- Fetch the Solidity source (
gh repo clone <org>/<repo>) — the implementation is ground truth; corpus is
its informal description.
- Source-tracing gate (
docs/07§3.0): every contradiction / ambiguity / vacuity candidate is traced to
its source_quote → corpus → Solidity, to separate a genuine spec defect from a tool extraction defect (D6) and to construct the spec from the implementation where corpus is ambiguous. Do not report a tool extraction miss as a protocol defect.
- Pillars 2–4 from the templates: blast-radius (
templates/blast-radius/, key-compromise bounds),
design-safety invariants (templates/invariants/, core I1–I5 + I7 + parameter-bound gap-witnesses), spec-consistency (docs/07, satisfiability / realizability / vacuity / coverage).
- Co-improve spec ↔ model ↔ Lean against the implementation, keeping
lake buildgreen,sorry0, and the
four docs (requirements.json/SPEC.md/model.md/README.md) mutually consistent after every change.
- Report with
review.jsontagging each theorem by provenance (requirement / threat-model / design-invariant
/ spec-consistency) and a README that lists the implementation-layer hand-off (what static analysis / SMT / fuzzing must still check; docs/08). Apyx (outputs/apyx/) is the worked reference for all of this.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskill/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nyxfoundation/docs2formalspec/skill)