doc2spec-synthesizing-formal-programminglisted
Install: claude install-skill ndpvt-web/arxiv-claude-skills
# Doc2Spec: Formal Specification Synthesis via Grammar Induction
This skill enables Claude to convert natural-language programming documentation (API docs, READMEs, RFCs, ERC standards) into formal, machine-checkable specifications by first inducing a domain-specific grammar from the documentation and then generating specifications that conform to that grammar. The technique comes from the Doc2Spec multi-agent framework (Xia et al., 2026), which demonstrated that automated grammar induction constrains the specification space, enforces consistent representations, and produces higher-quality specs than direct LLM translation. It works across Solidity, Rust, Java, and other languages.
## When to Use
- When the user has API documentation and wants formal pre/post-conditions or usage contracts extracted from it
- When the user asks to "formalize" or "specify" rules from a natural-language source (README, RFC, ERC standard, man page, Javadoc)
- When the user wants to validate that code conforms to rules stated in documentation
- When building a linter, static analyzer, or verification harness and needs a specification DSL derived from docs
- When the user has inconsistent or scattered documentation rules and wants them unified into a single formal grammar
- When reviewing smart contract implementations against their ERC specification text
- When converting Rust safety invariants or Java API contracts from prose to checkable assertions
## Key Technique
**Grammar induction befor