A customer writes to support: “Your help centre says I can return items within 14 days. I am on day 20 and the shop just accepted my refund. Which one is it?” Support checks with a developer. The code has allowed 30 days since spring. Nobody updated the article, and nobody would have noticed if the customer had not asked.
FACET keeps a short, checkable description of each feature, called a record, next to your code, and can tie other documents, such as help articles, to it. By the end of this guide the help article states what the code does, and it is tied to that code. When someone changes the refund rule, facet docs check names the article that is now out of date, on your machine and in every pull request.
The commands below use a small example shop written in TypeScript; FACET has to be set up as in One answer instead of three. In your own project, pick one help article that customers quote and the code it describes.
Step 1Find out what the code really allows
Before touching the article, read the code that decides. In the example shop it is src/orders/refund.ts:
export const refundWindowDays = 30;export function requestRefund(order: Order, now = new Date()): { orderId: string; amountCents: number } { const deadline = order.placedAt.getTime() + refundWindowDays * 24 * 60 * 60 * 1000; if (now.getTime() > deadline) throw new ShopError("E3001"); return { orderId: order.id, amountCents: order.totalCents };}
Now compare it with the article. The example shop has no help centre, so save the article customers quote as help/returns.md:
# Returns and refundsYou can return any item within **14 days** of delivery.1. Open **My orders** and choose the order.2. Select **Request a refund**.Refunds usually arrive within five working days.
The article is wrong twice. The window is 30 days, not 14, and it starts when the order is placed, not on delivery: the code counts from placedAt, and the shop stores no delivery date at all.
Step 2Write the rule down next to the code
The article needs something to be checked against. Write the refund rules into a FACET record. Create the folder:
mkdir -p docs/facets/features/orders/refunds
Save this as docs/facets/features/orders/refunds/request-refund.yaml:
schema_version: "0.1"id: orders/refunds/request-refundlifecycle: activeintent: summary: A customer asks for the money back on an order and gets the order total refunded, or a reason why not.contract: scenarios: - id: request-inside-window-is-accepted statement: | Given an order placed 30 days ago When the customer requests a refund Then the shop refunds the order total - id: late-request-is-refused statement: | Given an order placed 31 days ago When the customer requests a refund Then the shop refuses it with E3001lineage: owner: team: orders created_at: "2026-11-22"
Then connect the record to the code. Add two comment lines directly above requestRefund in src/orders/refund.ts:
// @facet: orders/refunds/request-refund// @facet-role: primaryexport function requestRefund(order: Order, now = new Date()): { orderId: string; amountCents: number } {
Check that record and code point at each other:
npx facet lint
The summary line reads 2 record(s), 2 anchor(s) checked — 0 error(s). The two warnings say that no test is named for the new ScenarioA scenario is one behaviour a feature promises, written in a record as Given/When/Then steps. Each scenario has an id that tests and other records can refer to.Read more here yet and that two test files, invoice.test.ts and refund.test.ts, have no record. Warnings never fail the check.
Step 3Correct the help article
Rewrite help/returns.md so it says what the record says:
# Returns and refundsYou can return an order within **30 days** of placing it.1. Open **My orders** and choose the order.2. Select **Request a refund**.3. You get the full order total back.Refunds usually arrive within five working days.
Write it by hand or with the tool you already use for help content. What matters for the next step is that the article now matches the record and the code.
Step 4Tie the article to the record and the code
Tell FACET which record the article was written from:
npx facet docs record --artifact help/returns.md --feature orders/refunds/request-refund --pipeline hand-written
FACET stores a content fingerprint of the record and of every file that carries its AnchorAn anchor is a comment in the source code, starting with @facet:, that names the record the code belongs to. FACET reads these comments to know where each feature is implemented.In the glossary, here src/orders/refund.ts, in docs/facets/generated.lock.yaml. --pipeline only names how the article was made. Then check the article:
npx facet docs check


Commit the record, the anchor, the corrected article and the lock file together:
git add docs/facets help/returns.md src/orders/refund.tsgit commit -m "Correct the refund window in the help article and tie it to the refund rule"
Step 5Change the rule and watch the article get flagged
Months later, a developer extends the refund window for the holidays. Open src/orders/refund.ts and change the constant:
export const refundWindowDays = 45;Nobody thinks of the help centre. Run the check:
npx facet docs check


The article is flagged by name, together with the file that changed. A change to the record would flag it the same way.
Step 6Make the pull request fail until the article follows
Plain docs check only reports; it exits 0. Add --strict to make it fail while an article is stale:
npx facet docs check --strict
It prints the same report and exits with status 1. To run it on every pull request, add one line to the workflow init wrote, .github/workflows/facet-lint.yml, after the line that runs lint:
sh "$dispatcher" --root "$GITHUB_WORKSPACE" lint sh "$dispatcher" --root "$GITHUB_WORKSPACE" docs check --strict
Now the developer who changes the refund window also sees the help article in the failed check. Update the record's scenarios and the article to 45 days, then record the article again:
npx facet docs record --artifact help/returns.md --feature orders/refunds/request-refund --pipeline hand-writtennpx facet docs check --strict
The check reports 1 artifact(s) checked — 0 need regeneration and exits 0.
Step 7If the check says something else
no such file or directoryafterrecord for orders/refunds/…: the--featureid has no record file. Copy theid:from the record.no such file or directoryaftergenerated artifact help/…: the--artifactpath is wrong. Give it relative to the repository root.--feature and --artifact are both required: add the missing flag.orphaned: help/returns.md, withfeature record … no longer exists: the record was deleted or renamed. Point the article at the new id withdocs record, or remove its entry fromdocs/facets/generated.lock.yamlif the article is gone.staleafter a change that does not affect customers: read the diff. If the article is still right, rundocs recordagain to accept the new state.
For why teams keep help content tied to the code it describes, read The help article says 14 days. The code says 30..