Track authored Claude Code configuration

This commit is contained in:
2026-09-20 18:00:44 +02:00
commit 990a7ac9b9
21 changed files with 1657 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
# Shared principles
Org-wide technical principles, kept here so the reviewer agents depend on no external repo.
Consumed by, with the same principles applied through different lenses:
- `../agents/stability-reviewer.md` — enforces them at code level, per PR.
- `../agents/systems-architect.md` — treats them as baseline constraints on every design.
- `../agents/product-owner-reviewer.md` — checks the externally-visible ones (`rest-apis.md`, `frontend.md`, and what surfaces from `technical-principles.md`) from the customer's perspective.
Files:
- `technical-principles.md` — core engineering principles (all code and design).
- `frontend.md` — frontend-specific principles.
- `logging.md` — log levels and infrastructure.
- `rest-apis.md` — REST API conventions (URLs, errors, status codes, pagination, versioning, OpenAPI).
+28
View File
@@ -0,0 +1,28 @@
# Frontend principles
Follow all of them. The two groups below are for orientation, not permission to skip the
second one: **foundational stances** are structural bets that are expensive to reverse;
**quality attributes** are the -ilities and UX outcomes you uphold continuously.
General principles (KISS, DRY, …) live in `technical-principles.md` and apply here too.
## Foundational stances
| Principle | Explanation |
|-----------|-------------|
| Backend-agnostic | Tight coupling between front- and backend causes duplicated work. **Why?** The front- and/or backend should be replaceable independently of each other, to allow us to improve and/or modernize incrementally. |
| Prefer state in the URL first, backend second | State can be managed in the backend, in the URL, and in the browser (e.g. JavaScript memory, local storage, etc). We want to limit state management in the browser as much as possible and focus on the backend and the URL. **Why?** Working with state in the browser is difficult from a development perspective. It is not intuitive that the same URL yields different results on different devices or even different tabs. Centralized state can be shared across multiple separate frontends. |
| Prefer backend-based business logic | Centralized logic can be consumed by multiple separate frontends and minimizes duplication. **Why?** To avoid distributing logic and risking that different rules apply to the same thing, depending on where in the system it is done. |
| CSS > JavaScript | If something can be solved with CSS, solve it with CSS. If you can negotiate with product to achieve the same functionality in a way that can be solved with CSS instead of JavaScript, solve it with CSS. **Why?** CSS is significantly more performant than JS. CSS is declarative in contrast to JS, which makes it much more robust against bugs and issues. |
| Prefer established web standards over custom solutions | For example, use an HTML select instead of a cool library that renders a similar-looking select out of divs and CSS. HTML and CSS are managed by a committee that thinks long and hard before anything changes. Things are deprecated for years before they stop working, if they ever do. **Why?** Standards will always outlive the week's hottest framework and give us a more stable foundation to build on. Upgrading an entire framework is usually significantly more cumbersome than upgrading a single library. Frameworks push us toward doing what they want us to do rather than what we want to do ourselves. |
| Use semantic HTML | Use HTML elements for their meaning (`<button>`, `<nav>`, `<table>`, `<label>`), not `<div>`/`<span>` with behavior bolted on. **Why?** Semantic markup gives accessibility, keyboard support, and correct browser behavior for free, and reinforces "prefer established web standards" and "broad device support". |
## Quality attributes
| Principle | Explanation |
|-----------|-------------|
| Intuitive > Interactive, Functional > Fancy | Somewhat presumptuously, one can note that the users of our system are not very technically advanced. It is more important that it is clearly evident how the system works than that it is interactive and "modern". **Why?** We build and deliver our customers' primary business systems. A beautiful/fancy system that does not work has a massive impact on the customers' workday. |
| Testability | For example, by thinking about how a frontend should be optimally tested from the very beginning. **Why?** Good testability leads to fewer bugs, safer updates, and faster development. It also makes it easier for new developers to understand and contribute to the codebase. |
| Important features should have broad device support | Where interactivity and "fancy things" are implemented — and are part of an important flow — it should be done as progressive enhancement and be able to fall back to something that works even on devices that are not the latest model/version. Many of our field customers have rather poor hardware. **Why?** So that as many people as possible can use our system. |
| Responsive design | Functional in "all" screen sizes. Responsiveness should not be an afterthought but a focus from the start. **Why?** The use of handheld devices is constantly increasing. Our users are using more and more different devices to access our systems. |
| Consistent design | Use uniform components, colors, and typography. Creates recognition and a professional impression. **Why?** To not waste energy on non-value-creating discussions. Makes the system easier to maintain and avoids spending energy on non-value-creating development. |
+19
View File
@@ -0,0 +1,19 @@
# Logging
## Levels
Log levels have a standard, RFC5424: { emerg: 0, alert: 1, crit: 2, error: 3, warning: 4, notice: 5, info: 6, debug: 7 }.
We follow a simplified variant (sadly with non-matching numbers atm):
* **0: Error** - Crash or equivalent catastrophe that needs fairly immediate action.
* **1: Warning** - The app works, for now, but something is wrong and needs to be fixed.
* **2: Info** - Nothing is wrong, but this is important information that should be possible to find in a production system.
* **3: Verbose** - Somewhat more detailed information than Info, suitable level to enable in a production system where more information is needed for a limited time.
* **4: Debug** - Suitable level for development. If enabled in production, the logs will be flooded.
## Infrastructure
All logging in our applications goes to OTLP or stdout.
In our server environments, nothing is saved to disk on the servers. Neither in Docker nor on the host. Everything is sent to Grafana Cloud via OTLP.
+33
View File
@@ -0,0 +1,33 @@
# REST APIs
Conventions for any REST API we build, regardless of product or stack. Existing APIs keep their current shapes until their next major version — reviewers flag deviations on new surfaces, not old ones.
## URLs & query parameters
* URL paths and parameter **names** may only contain the characters a-z, 0-9, - and / (kebab-case); parameter values are exempt. E.g.: `/fooBar?WakkBazz=Value!` should be `/foo-bar?wakk-bazz=Value!`.
* Query parameters that can be more than one are repeated flat keys: `?ids=x&ids=y`. Do _not_ do `?ids[]=x&ids[]=y` or `?ids=x,y`. Where a framework's default parsing collapses repeated keys, parse them with one shared helper per stack — never reimplement per endpoint.
## Errors
* Error responses follow RFC 9457 (`application/problem+json`): `type`, `title`, `status`, `detail`.
* Field-level validation errors go in an `errors` extension member (RFC 9457 §3.2), one entry per field with the field name exactly as the consumer sent it and an actionable message.
* Details must be actionable for the consumer and never leak internals (stack traces, table names, upstream URLs, ticket ids).
## Status codes
* Follow the HTTP standard (RFC 9110); no local reinterpretations.
* An idempotent PUT returns 201 when it created the resource, 200 when it updated it.
* When an upstream dependency fails, report it honestly (502/503) — never disguise it as a local 500.
## Pagination
* Offset-based by default: `page` (default 1) and `page-size`. Counts and navigation links live in the response body (`meta`/`links`), not in headers.
## Versioning
* Major version as a URL path prefix (`/v1/...`). Breaking changes ship as a new major version, never in place. No header- or per-endpoint versioning.
## OpenAPI
* Every REST API has a well-written OpenAPI specification with a live web GUI to view it (e.g. Swagger UI).
* Ideal: spec first — code generated from the spec. Generating the spec from code annotations is the accepted second best where spec-first isn't in place yet.
+50
View File
@@ -0,0 +1,50 @@
# Purpose and goals of our principles
1. Efficiently and sustainably deliver technical solutions with fewer bugs that are easier to resolve.
2. Make our technical solutions easier to maintain and further develop.
# Principles
* Make invalid states unrepresentable.
- Example: using a time-only type in the database when we actually want to store a time of day introduces risk for errors.
* Always store timestamps as full ISO datetime in UTC.
- Always communicate timestamps as full ISO datetime in UTC from APIs with database access.
* Always grant explicit access to data, both read and write.
* One owner per value; a reader can name every writer.
- The test: from the code in front of them, can a reader list every writer to this value, and the order those writers run in?
- BANNED: a record passed to 24 functions, 13 of which mutate it and return nothing. GOOD: one type owns the value, the rest call it and take a result.
- BANNED: `fill(set)` then `adjust(set)`, where swapping the two lines changes the output. GOOD: `const filled = fill(); const adjusted = adjust(filled);`
- BANNED: `stack` and `edges`, two arrays a comment says must stay in step. GOOD: `edges` derived from `stack`, or one array whose element type holds both.
- Allowed, never flag: mutation that never leaves the function that made it; a loop counter; data shared and never written; a state machine with named states and one transition function.
* Validate data and build DTOs as early as possible.
- For example, parse a form into a strictly typed DTO as the first thing that happens instead of passing strings down to be validated deep inside a service.
* Always use explicit state machines.
* Most, if not all, code should have automated tests.
* Test coverage should not decline.
* Idempotent data writing.
- Typical example: `PUT /resource/{id}` instead of `POST /resource` + Idempotent-Id header.
* Handle errors explicitly, as values — avoid the exception path.
- Enumerate the cases that can go wrong and return them as explicit results (e.g. a result DTO with an optional error), so failure is part of the signature instead of a hidden second channel.
- try/catch lives only at the edges, wrapped tightly around the call that can actually throw (DB, HTTP, filesystem), converting the exception into an explicit result right there. Pure functions and core logic never throw or catch for control flow.
* Commands and Queries Separation (CQS)-ish
- Queries must never modify data, commands may only return data that is the result of their change.
* Copy important contextual information on buisness transactions and equal data, instead of referencing it.
- Example set order.client_firstname instead of order.client_id and fetching firstname from the clients table.
* Explicit over implicit.
- Avoid magic, avoid "clever" solutions, only abstract when the API can clearly describe what is happening.
* Deterministic order wherever order carries no meaning.
- Sort it, on a key that does not move: the name a line introduces, never where it came from. A sorted list is searchable, its diff shows only what changed, and two edits to it conflict only where they mean to.
* Keep It Simple, Stupid (KISS).
- Keep solutions simple and easy to understand, so it is dead easy to grasp what they do.
* Don't Repeat Yourself (DRY).
- Reuse code instead of duplicating it; one concept, one implementation.
* All critical flows should have good traces, from where something was initiated until it completed.
- Use traceparent OTLP and standardized logging for this.
* Prefer the vendor-neutral option, and know what leaving would cost.
- Where two options do the job, the one that ties us to no supplier wins by default — dependency, protocol, format, service, provider and storage alike. Choosing neutral is usually free; it is the leaving that is expensive, so the test is what an exit costs and whether anyone has priced it.
- Sidestep deliberately, never by drift: a capability only that vendor has, or a vendor that is the target itself (an integration we build, a format we implement). Record which of the two it is and what the tie buys.
- Do not buy portability nobody asked for. An abstraction over one implementation, "in case we swap X", is speculative generality rather than neutrality — prefer the neutral thing, do not build a layer to preserve the option.
- Durable records are the case with no excuse: a decision log, runbook, architecture note or schema is project documentation, living in the repository proper (`docs/`), plain and legible with no tool installed. A vendor's directory — `.claude/`, `.vscode/`, a CI provider's folder — holds only what that vendor executes, and points at such a record rather than holding it.
* Semantic versioning, read strictly: a minor only adds, and a major is the only release that changes what exists.
- "Exists" is everything a consumer can depend on, not just signatures: an added output column, a removed list value, a changed default, the facts an error names, a dropped runtime version. A consumer takes a minor without editing code, data or scripts.
- Batch breaking changes into few majors. Before 1.0.0 the minor is the breaking unit and a patch never breaks.