keeping-one-source-of-truth
riekelt/principal-engineer
Enforce single ownership of every fact in code and data to prevent drift and duplication.
What is keeping-one-source-of-truth?
This skill encodes the one-fact-one-source doctrine: every piece of information lives in exactly one place, and all other parts read from there. Use it when adding data, config, state, or constants, or when you notice the same value exists in multiple locations.
- Identify the authoritative owner of each fact and extend that owner rather than creating a rival source
- Derive values at read time instead of copying them into secondary storage where they can become stale
- Detect and absorb duplicates during code changes instead of leaving multiple variants behind
- Use typed constants and enums instead of free strings to prevent typos from creating accidental sources of truth
- Surface contradictions when two sources disagree, rather than silently following one
- Mark artifacts as generated or hand-edited to prevent accidental edits to derived output
How to install keeping-one-source-of-truth
npx skills add https://github.com/riekelt/principal-engineer --skill keeping-one-source-of-truth- Familiarity with the principal-engineering skill (listed as required background)
How to use keeping-one-source-of-truth
- 1.Before adding any new data, config, or constant, identify which component or service already owns that information
- 2.Extend the existing owner to include your use case rather than creating a copy in your own code or service
- 3.When reading a value, derive it from the authoritative source at read time instead of caching or storing a copy
- 4.If you find duplicates while working, consolidate them into a single source as part of your change
- 5.Use typed constants, enums, or sealed types for identifiers and states instead of free strings
- 6.Mark any generated artifacts clearly and never edit generated output by hand
Use cases
- Adding a new configuration value: find the existing config owner and extend it rather than hardcoding the value elsewhere
- Refactoring code that duplicates a threshold or URL: consolidate to a single source and reference it everywhere
- Discovering that an enum exists in two services with the same states: merge them into one canonical definition
- Updating a cache or read model: ensure derivation is automatic and staleness is bounded and observable
- Resolving a disagreement between a config file and code defaults: determine which is authoritative, delete the loser, and surface the contradiction
- Principal engineers and architects designing system-wide data governance
- Backend and full-stack engineers building multi-service systems
- Teams managing configuration, state, and constants across codebases
- Code reviewers catching duplication and drift before it compounds
keeping-one-source-of-truth FAQ
Caches and read models are legitimate derived copies when their derivation is automatic, their staleness is bounded, and the staleness is observable. The rule bans copies that a person keeps in sync by hand.
Surface the contradiction immediately as the first fix. Determine which value is authoritative, make that the single source, delete the loser, and never silently follow either one.
No. Temporary copies have the same lifetime as the TODO above them—they become permanent. Instead, reference the authoritative source.
A missing entry should fail loudly (see the handling-failures skill). The single source is only authoritative if absence from it is an error, never a silent default.
Test fixtures may freeze a copy of reality on purpose; the word 'fixture' is the label that declares this exception. Regular code should not do this.
Full instructions (SKILL.md)
Source of truth, from riekelt/principal-engineer.
name: keeping-one-source-of-truth description: "Use when adding data, config, state, constants, an enum-like string, a cache, or anything that could exist in two places - or when two sources already disagree. Encodes the one-fact-one-source doctrine for code and data: derive rather than store, extend the owner, absorb duplicates. Use at the moment copying a value feels faster than referencing it."
Keeping one source of truth
REQUIRED BACKGROUND: the principal-engineering skill.
Overview
Every fact about the system lives in exactly one place, and every other part of the system reads it from there. This outranks convenience.
The doctrine
- Before adding data, find who already owns it. Extend that owner; do not start a rival.
- Derive rather than store. If the platform or an existing source can answer it at read time, read it there; do not copy the answer into a second source where it can go stale.
- Absorb duplicates you find on the way. When you touch code that hardcodes what a file already knows (or the reverse), fold the two together as part of the work instead of leaving a third variant behind.
- A missing entry fails loud (see
handling-failures): the single source is only authoritative if absence from it is an error, never a silent default. - Mark generated versus hand-edited, and never edit generated output. Every artifact states which it is.
- Vocabulary is typed, not stringly. Identifiers, kinds, states, and names that code branches on are constants, enums, sealed types, or registry entries; a free string spelled twice is two sources of truth with a typo between them.
- When two sources disagree, say so. Surfacing the contradiction is the first fix. The full fix determines which value is live, collapses to one source, and deletes the loser. Never silently follow either one; that launders the disagreement into whichever answer you happened to read first. On a declared critical path, a live disagreement earns a direct message to the owner, not only a tracked item; an unread ticket surfaces nothing.
Boundaries
- Caches and read models are legitimate derived copies when their derivation is automatic and their staleness is bounded and observable. The rule bans copies a person keeps in sync by hand.
- Test fixtures may freeze a copy of reality on purpose; the word fixture is the label that says so.
- Documentation follows the same rule (an index routes, never decides); the technical-writer plugin's
technical-writingskill carries that side where installed.
Common mistakes
- Copying a threshold, URL, or mapping "temporarily". Temporary copies have the same lifetime as the TODO above them.
- Creating
thing-v2besidethinginstead of editing in place. - A default value in code that shadows the config file's value. When someone changes the config and nothing happens, this is why.
- Two enums in two services spelling the same states. The day one gains a state, the boundary between them becomes a silent filter.
Related skills
More from riekelt/principal-engineer and the wider catalog.

operating-safely
Safety guards for destructive operations, secrets handling, and concurrent-session work on live systems.

principal-engineering
Evidence-based engineering discipline for safe, verifiable changes to code, data, and infrastructure.

scoping-changes
Right-size fixes to their trigger; decompose visibly instead of trimming quietly.

testing-changes
Determine what tests a behavior change requires and verify test coverage is sufficient.

verifying-before-done
Verify every completion claim by driving the change at its surface and running the verify command before declaring done.

writing-unit-tests
Behavior-first unit testing: one claim per test, deterministic setup, mocks only at external boundaries.