Specs are markdown files that define functional requirements and unit tests that verify correct implementation of those requirements. Where appropriate, specs typically begin with a code block describing any public API contracts in a compact, scannable format. All spec files end with .spec.md.
Specs include YAML frontmatter at the beginning of the file to clarify what they document. For example:
---
name: Database Architecture
Description: Key design patterns used across our data models
targets:
- ../src/models/**/*.py
---targetsA list of relative file paths or glob patterns described by the spec. They can include:
./src/auth/login.py**/*.py, src/**/*.tsRequired: All specs must have at least one target.
[@test] LinksSpecs should contain links to the tests that verify their behaviour. Test links are intermingled with the requirements they verify, with context dictating what content is verified.
name: Calculator description: Functional requirements for the calculator module targets:
Performs basic arithmetic operations to two digits of precision.
def add(a: int, b: int) -> int: ...
def subtract(a: int, b: int) -> int: ...
def multiply(a: int, b: int) -> int: ...
def divide(a: int, b: int) -> float: ...[@test] ../tests/calculator/test_basic_arithmetic.py
Nan
[@test] ../tests/calculator/test_divide_by_zero.pyTypeError
[@test] ../tests/calculator/test_invalid_input_type.py
</calculator.spec.md>