Example
requirementDiagram
requirement share_diagram {
id: 1
text: User can share a diagram via a unique URL
risk: low
verifymethod: test
}
functionalRequirement render_mermaid {
id: 2
text: Editor renders Mermaid diagrams in real time
risk: medium
verifymethod: demonstration
}
performanceRequirement fast_render {
id: 3
text: Diagram renders within 500ms of last keystroke
risk: high
verifymethod: test
}
share_diagram - refines -> render_mermaid
fast_render - traces -> render_mermaid Syntax
Requirements
requirementDiagram
requirement login {
id: R1
text: Users authenticate with email and password
risk: medium
verifymethod: test
}
performanceRequirement fast_login {
id: R2
text: Login completes under 500 ms
risk: high
verifymethod: analysis
} Types: requirement, functionalRequirement, performanceRequirement, interfaceRequirement, physicalRequirement, designConstraint. Risk: low, medium, high. Verify: analysis, inspection, test, demonstration.
Elements and relationships
requirementDiagram
requirement login {
id: R1
text: Users authenticate
risk: low
verifymethod: test
}
element auth_service {
type: service
docref: docs/auth.md
}
element login_test {
type: unit_test
}
auth_service - satisfies -> login
login_test - verifies -> login Relationships: contains, copies, derives, satisfies, verifies, refines, traces. Syntax is source - relation -> target.
Common mistakes
These are the parse errors that come up most, including in code written by ChatGPT and Claude. Paste any failing diagram into the editor and it marks the offending line.
-
Spaces in requirement or element names.
Fix: Use snake_case or camelCase identifiers. The
text:field is where the readable sentence goes. -
A verification method outside the four allowed values.
Fix: Only analysis, inspection, test, and demonstration parse. "review" or "manual" fails.
-
Relationship written like a flowchart arrow (
a --> b).Fix: Requirement links need the relation word:
a - satisfies -> b.
FAQ
Can I show which requirement a test covers?
Yes, that is the main use: declare the test as an element with type: test and connect it with - verifies ->.
Does it support hierarchy between requirements?
Use - contains -> from the parent to each child, or - derives -> when a lower-level requirement is derived from a higher one.