spec-constraints

Extract invariants, preconditions, postconditions, and laws into constraints.yaml with proof obligations.

37|5|Updated Nov 18, 2025
One-click install
npx skills add https://github.com/BellaBe/lean-os --skill spec-constraints
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spec-constraints
Source: https://github.com/BellaBe/lean-os/tree/main/.claude/skills/engineering-spec-constraints
Command: npx skills add https://github.com/BellaBe/lean-os --skill spec-constraints

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill defines constraints (invariants, pre/post-conditions, and laws) for a system, enabling formal specification and proof obligations.

Core Features & Use Cases

  • Invariant definitions
  • Precondition / Postcondition
  • Law definitions
  • Expression language and common patterns

Quick Start

Create constraints.yaml and example invariants, preconditions, and laws for a sample domain.

Frequently Asked Questions about spec-constraints

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define invariants and preconditions for formal verification?

Invariants and preconditions are constraints that hold true throughout system execution or before operations run. This Skill extracts these from requirements and business rules, then generates a validated constraints.yaml file that documents them formally, enabling proof obligations and formal verification of system correctness.

What's the difference between runtime checks and formal proofs for constraints?

Runtime checks validate constraints during execution; formal proofs verify them mathematically before code runs. This Skill distinguishes between the two, marking which constraints require formal proof obligations versus runtime validation, so you know which guarantees are statically verified.

Can I extract postconditions and laws from existing requirements documents?

Yes. This Skill analyzes natural-language requirements and existing artifacts to extract postconditions, laws, and other constraints automatically. It produces a constraints.yaml file with proof obligations, eliminating manual specification work and ensuring completeness.

How do I structure invariants and laws in a constraints.yaml file?

This Skill generates constraints.yaml following a standard expression language with common patterns for invariants, preconditions, postconditions, and laws. The format is designed for formal systems, making constraints machine-readable and suitable for verification tools.

When should I use constraint specification instead of just writing validation code?

Constraint specification is essential when you need formal guarantees about system behavior, must prove correctness mathematically, or enforce complex business rules across multiple components. Unlike scattered validation code, formal constraints enable comprehensive verification and catch edge cases before runtime.

Do I need existing formal verification tools to use this Skill?

No prerequisites are listed. This Skill focuses on defining constraints and marking proof obligations in constraints.yaml. You can use the output with verification tools later, or use it standalone to document formal requirements for your system architecture.