Facet
DeutschInstall
Docs & onboarding

One glossary for your product terms, checked by FACET in every pull request

Define your product's key words once in a FACET FACET glossaryThe FACET glossary is a file, glossary.yaml, next to the records that defines a product's terms once. Lint warns when a record spells a defined term differently and fails when a term gets a second meaning.In the glossary, let the check warn when a FACET recordA FACET record is a short, checkable description of one feature, kept as a YAML file next to the code. It states why the feature exists, the behaviour it promises as scenarios, and the tests that check it.In the glossary misspells a term and fail when a term gets a second meaning, and read the definitions in AtlasSchematic Atlas preview: checkout with linked features and a seven-stripe seal.Atlas opens your repository as a product map, showing features, their requirements and the tests linked to them in your browser.View nowRead more here.

  • 6 min read
  • 6 steps
  • npmFACET Atlas
  • Your coding agent

A customer complains that the discount code SPRING5 was refused although "the order was over 25 euros". Support looks at the order total, which includes shipping, and agrees. The developer says the minimum is checked against the subtotal, before discount and shipping. The help article says "order value". Three words for amounts that are not the same, and each person reads the other two as their own.

FACET keeps a short, checkable description of each feature, called a record, next to your code and tells you when code and description DriftDrift is when code changes and the record describing it does not follow, so the two no longer match. facet drift lists the features whose anchored code changed since a chosen baseline.In the glossary apart. By the end of this guide the shop's money words are defined once, in one glossary file next to the records. npx facet lint warns in every pull request when a record spells a defined term differently, and fails when the same term gets a second meaning. FACET Atlas, the browser app for reading FACET records, shows each term with its definition and the records that use it.

The commands below use the example shop from “One answer instead of three”. In your own project, start with the two or three words that cause the most misunderstandings.

Step 1Define each word once

The glossary lives next to the records, in docs/facets/glossary.yaml. Save this there:

yaml
schema_version: "0.1"categories:  - id: money    title: Money    purpose: Amounts the shop computes on a cart or an order.terms:  - term: Subtotal    category: money    definition: |      The sum of all line items in the cart, before any discount and before shipping.      The minimum order value of a discount code is checked against it.  - term: Total    category: money    definition: |      What the customer pays: the Subtotal minus the discount, plus shipping.
  • term is the exact word as records should write it. Matching is case-sensitive and whole-word: Subtotal and subtotal are different words to FACET.
  • definition says what the word means and how it differs from its neighbours. What the shop does with the amount belongs in the records.
  • categories group terms, and each term names at most one category. They are optional; a short glossary works without them.

Step 2Let the check find spellings that miss the term

sh
  • npx facet lint
Terminal output of npx facet lint: a warning says subtotal in contract.scenarios minimum-order-value is not a defined glossary term, did you mean Subtotal; another warning lists two test files no record names, invoice.test.ts and refund.test.ts; 0 errors, 2 warnings.Terminal output of npx facet lint: a warning says subtotal in contract.scenarios minimum-order-value is not a defined glossary term, did you mean Subtotal; another warning lists two test files no record names, invoice.test.ts and refund.test.ts; 0 errors, 2 warnings.
The record writes the term in lower case, so it does not link to its definition.

The existing discount-code record says When the cart subtotal is below that value. That is almost the term, but not exactly, so nothing links it to the definition. FACET reads intent.summary and every 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 statement of every record and reports each word that is a different case or a small typo away from a defined term.

Open docs/facets/features/checkout/discounts/redeem-code.yaml and change the line in the scenario minimum-order-value to:

text
When the cart Subtotal is below that value

Run the check again:

sh
  • npx facet lint

The summary now ends with 0 error(s), 1 warning(s) (unclaimed-tests 1): the glossary warning is gone, and only the note about unclaimed test files from “One answer instead of three” remains.

Step 3Keep one meaning per word

A month later someone adds "Subtotal" again at the end of the glossary, meaning the amount with shipping:

yaml
terms:  # Subtotal and Total from step 1 stay here  - term: Subtotal    category: money    definition: |      The order value including shipping.
sh
  • npx facet lint
Terminal output of npx facet lint: an error says term Subtotal is defined more than once, merge the definitions into one entry or give the second term a name of its own; summary 1 error, 1 warning.Terminal output of npx facet lint: an error says term Subtotal is defined more than once, merge the definitions into one entry or give the second term a name of its own; summary 1 error, 1 warning.
A second definition of the same term is an error.

This one is an error, and the command exits with status 1, so the pull request that adds it fails. Remove the second entry. If the team really needs a word for the amount with shipping, give it its own name, as Total already does.

Step 4Read the glossary in Atlas

Atlas, the FACET reader, starts from the npm package. In the shop's folder, run:

sh
  • npx facet-framework ui

The first run asks Download and start? [y/N] before it downloads Atlas; answer y. Later runs start without asking.

Atlas opens in the browser. Click Glossary:

FACET Atlas, Glossary tab: 2 domain terms, a filter for the category Money, and the terms Subtotal with its definition and 1 record, and Total with its definition and 0 records.FACET Atlas, Glossary tab: 2 domain terms, a filter for the category Money, and the terms Subtotal with its definition and 1 record, and Total with its definition and 0 records.
Each term with its definition and the number of records that use it.

Support, product and new colleagues read the same definitions here without opening YAML. Subtotal shows 1 record: the discount-code record that uses the exact spelling since step 2.

Step 5Commit the glossary so every pull request checks it

sh
  • git add docs/facets/glossary.yaml docs/facets/features/checkout/discounts/redeem-code.yaml
  • git commit -m "Define Subtotal and Total in the glossary"

The workflow from “One answer instead of three” runs facet lint on every pull request. A spelling that misses a term shows up there as a warning; a term defined twice, or a term naming a category that does not exist, fails the run.

Step 6If the check says something else

  • "…" in contract.scenarios … is not a defined glossary term — did you mean "…"? for an ordinary word: a common word like "total" in normal prose now looks like a misspelled term. Either write the term as defined wherever you mean it, or define only words that are terms of art in your product.
  • term "…" is defined more than once: two entries share the same term. Merge them, or give the second one its own name.
  • term "…" names category "…", which the glossary does not declare: the category id is misspelled or was deleted. The message lists the declared categories; correct the term or declare the category.
  • No glossary warnings at all, although a record misspells a term: check that the file is called docs/facets/glossary.yaml. Without the file, no glossary check runs.

For more on teams that need the same words for the same things, read the page for distributed teams.

Sources