Skip to content
Connect an agent

Other diagram kinds

Requirement diagrams

A requirement diagram shows what a system must do and what proves it: the requirements, each with its id, its sentence, its risk, and how it is verified, and the code, tests, and documents that satisfy or verify them. Use it for a regulated feature, a hardware specification, a safety case, or the traceability table of an audit. It is for anyone, human or AI agent, who needs the answer to "is every requirement met, and how do we know".

TL;DR

QuestionAnswer
What is it for?Traceability: requirements, the elements that satisfy or verify them, and the SysML relations between them, so a gap shows at a glance.
How does it start?requirement "Title", then need id "Name" for each requirement, element id "Name" for each piece of proof, then a relation such as stripe -> card : satisfies.
What does a requirement hold?type=, risk=, verify=, ref= (the id people say, such as REQ-001), and text= (the requirement sentence). All are optional.
How do they relate?Seven words after the colon: contains, copies, derives, satisfies, verifies, refines, and traces. Each draws its word in a pill, so a reader needs no key.
Which way does it read?down (the default) puts what is required at the top and what proves it below; direction=right puts the requirements on the left.
Can I convert Mermaid?Yes. Mermaid requirementDiagram converts with the convert_mermaid tool. See From Mermaid.
How big may it be?150 requirements and elements together, and 300 relations. Past a limit the diagram is refused with error E140.
How is it drawn?A requirement is a card with a strip that names its type and ref, the name and the sentence, and chips for risk and verification. An element is a card with its icon. Layout is automatic, and the theme chooses every color.

Ask your agent

Name each requirement with its id, say how risky it is and how it is proved, then name the code, tests, and documents that meet it.

text
Use Plotwork to draw a requirement diagram of our checkout. REQ-001: the checkout accepts Visa, Mastercard and Amex; it is functional, high risk, and proved by test. REQ-002: a payment completes in under two seconds at the 95th percentile; performance, medium risk, tested. REQ-003: card data never touches our servers; a design constraint, high risk, proved by inspection, and it refines REQ-001. Stripe Elements satisfies REQ-001 and REQ-003, the end-to-end suite verifies REQ-001 and REQ-002, and the PCI self-assessment verifies REQ-003.
text
Use Plotwork to draw the hardware requirements of our drone flight controller, reading left to right: it weighs under 40 g and fits a 30.5 mm mount (physical), talks CAN and UART (interface, high risk), and runs its control loop at 8 kHz (performance, proved by analysis). The board satisfies the weight and the mount, the STM32H7 satisfies the bus and the loop, the bench rig verifies the bus and the weight, and the timing model verifies the loop.
text
Use Plotwork to draw the traceability of our account security. The business requirement BR-1, accounts are hard to take over, is high risk and contains SR-1, offer a second factor, and SR-2, lock out repeated failures. SR-1 derives from BR-1. The auth design note traces to SR-1 and SR-2, the auth test suite verifies both, and the annual penetration test verifies BR-1.

Example

This is the checkout from the first prompt. Three requirements sit at the top, the constraint that refines the first sits below it, and the elements that satisfy and verify them sit at the bottom. Every line carries its word, and every requirement carries its risk and how it is verified.

A hardware specification

Physical and interface requirements, each met by a part and proved by a rig or a model. Eight cards side by side would be too wide for a column, so direction=right stacks the requirements on the left and the parts and tests on the right.

A traceability chain

A business requirement broken down into system requirements with contains, which starts with a circled plus at the container, and the derived relations drawn dashed. The high-risk business requirement is verified by a test of its own, so nothing is left unproved.

The language

A line is one statement. A # starts a comment. Ids are words such as card, req-1 or _x, labels are in double quotes, and options are written key=value. The first line is the header.

The header

Plotwork
requirement "Checkout requirements" direction=down desc="What the checkout must do, and what proves it."
PartMeaning
requirementThe kind.
"Title"The title. It is the accessible name of the picture and heads the text description. Optional.
direction=down (the default) or right.
icons=auto (the default) gives an element with no icon= the icon its name names, such as Stripe's mark for "Stripe Elements"; off keeps every element plain.
desc=A plain-language description for the text description. Optional. A desc "text" statement does the same.

Statements

StatementMeaningExample
need <id> "Name" type= risk= verify= ref= text= tone=A requirement, drawn as a card. Every option is optional.need card "Accept card payments" type=functional risk=high
element <id> "Name" type="<text>" doc="<text>" icon=<set:name> tone=<tone>Something that satisfies, verifies, or traces to a requirement: code, a test suite, a document. type= is drawn under the name, and doc= under that in mono.element stripe "Stripe Elements" type="Library"
<from> -> <to> : <relation>A relation. The word after the colon is required.e2e -> card : verifies
desc "text"The description of the diagram.desc "What the checkout must do."

The statement is need, not requirement, because requirement is the header. A Mermaid block such as functionalRequirement x { is an error whose hint shows the line to write.

Requirement types

type=StripToneUse it for
plain (the default)requirementneutralA requirement with no finer kind, such as a business need.
functionalfunctional requirementblueWhat the system does.
interfaceinterface requirementvioletHow it connects to another system or part.
performanceperformance requirementaquaHow fast, how much, how often.
physicalphysical requirementorangeSize, weight, power, temperature.
constraintdesign constraintneutralA limit on how it may be built.

tone= overrides the type's tone. A diagram cannot set a color: the theme chooses every color, in light and dark.

Risk and verification

risk= is low, medium, or high, drawn as a chip with a green, amber, or red dot. verify= is analysis, inspection, test, or demonstration, drawn as a chip with its icon. The chips sit at the foot of the card, and the words say the same as the colors, so the diagram still reads for someone who cannot tell two tones apart.

ref= is the id people use, such as REQ-001, drawn on the right of the strip. Quote it, since it often holds a -. text= is the requirement sentence, wrapped in the card; past five lines it is cut with warning W203, and the full sentence stays in the text description.

Relations

A relation reads from left to right as a sentence: stripe -> card : satisfies is "Stripe Elements satisfies Accept card payments". The layout puts what is required above what relates to it, so most arrows point up, at the requirement.

WordReadsDrawnAbove
satisfiesa satisfies bSolid arrowb
verifiesa verifies bSolid arrowb
refinesa refines bDashed arrowb
derivesa derives from bDashed arrowb
copiesa copies bDashed arrowb
tracesa traces to bDashed arrowb
containsa contains bSolid line with a circled plus at aa

Every relation draws its word in a pill on the line, next to the card below. Lines run through the gaps between ranks and never through a card.

Limits and warnings

Warnings never stop a diagram from being drawn. Errors do.

LimitValueWhat happens past it
Requirements and elements150E140
Relations300E140
Requirements and elements before the density warning30W200
Relations before the density warning60W200
Lines of a requirement sentence5Cut with an ellipsis, and W203

Layout is plain arithmetic, so even a diagram at the limits is laid out in a few milliseconds.

CodeSeverityWhenFix
E100errorA missing id or label, a relation with an arrow other than ->, no word after the colon, a relation from a card to itself, or a Mermaid block.Each says what to write.
E136errorA type=, risk=, or verify= that is not one of the choices, or a relation word that is not one of the seven.The hint lists the choices and the nearest one.
E140errorThe diagram is over a limit in the table above.Split it by feature.
E110, E121, E123, E130, E131, E135errorAn unknown statement, tone, or direction, a duplicate id, an unknown requirement or element in a relation, or an unknown option.Each says what to write, with the nearest name for a mistyped one.
W200warningMore than 30 requirements and elements, or 60 relations.Split it into one diagram for each feature.
W201warningA requirement nothing satisfies or verifies (once the diagram has elements, and not for one that contains others), a high-risk requirement nothing verifies, an element that relates to nothing, or a loop of contains.Add the relation that proves it, or remove the card.
W202warningThe diagram is wider than a column would keep readable.Use direction=right, shorten the names, or split it.
W203warningText was cut with an ellipsis.Shorten the name or the sentence.

From Mermaid

Mermaid's requirementDiagram converts with convert_mermaid. The fields of each block become options on one line, and a relation written either way round becomes one -> line.

MermaidPlotwork
requirementDiagramrequirement, with the front matter title: as its title
direction TB, direction LRthe default, direction=right
direction BT, direction RLdrawn as TB and LR, M202
requirement x { }need x "x"
functionalRequirement, interfaceRequirement, performanceRequirement, physicalRequirement, designConstrainttype=functional, interface, performance, physical, constraint
id:, text:ref=, text=
risk: High, verifymethod: Testrisk=high, verify=test
element x { type: docRef: }element x "x" type= doc=
a - satisfies -> b, b <- satisfies - aa -> b : satisfies
style, classDef, class, :::dropped, M200
A risk or method outside the choices, a field Plotwork has no option for, a relation word outside the seven, or a relation to a name with no blockdropped, M203
A name that is not a valid id, such as "Card payments"renamed, M206; the label keeps the name
The same relation twicethe second dropped, M209
A block never closed, or a } that closes nothingrepaired, M217

Mermaid draws a requirement's name as its title, so the converter keeps the name as the label. Rename the labels to the words people use, and check in the outline that each relation reads the right way round.

See also

DocWhy
Writing diagramsThe flow, sequence, and schema kinds, and the options every kind shares
Use case diagramsWho uses a system and for what, which a set of requirements often starts from
Migrating from MermaidThe converter, its diagnostic codes, and what carries over
Diagram evidence for auditsDiagrams as evidence, where a traceability picture belongs
Icon referenceEvery icon name you can put in icon=
Language referenceEvery word of the language, one page for each topic