diff --git a/AGENTS.md b/AGENTS.md index 578e608a..48ec3119 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,6 +37,19 @@ arbitrary and is not. Test: does it still earn its lines for someone reading the file a year from now with no idea what was asked? The same test applies to the prose in these AGENTS.md files. +Keep comments as simple and short as possible, so one read is enough: +short sentences, plain words, no nested clauses or dashes. Good: + +```ts +// the simulation ends once the metric has data, but the cache may +// still hold an empty result from before. Refetch, but only when the +// query can run, because refetch does not check that itself. +``` + +Bad: "the cached answer is keyed by the time range and not by the window it +resolves to, so the one waiting here was taken while the metric was still +missing — which is what the block has just been told it no longer is." + ## 5. Goal-driven execution Turn the task into a verifiable goal ("fix the bug" becomes a test that diff --git a/web/AGENTS.md b/web/AGENTS.md index 3d7292fb..327d96af 100644 --- a/web/AGENTS.md +++ b/web/AGENTS.md @@ -184,6 +184,9 @@ sentinel or a restructure over a non-null assertion. `CalendarInput.vue` → `CalendarInput.nuxt.test.ts`), never a mirror tree. A test spanning two files lives with the one that initiates the behaviour. Top-level `describe`s follow the source file's order. +- **Test file shape**: top-level constants and variables above the first + `describe`, never between tests; file-local helper functions below all + tests, at the bottom. - **The suffix encodes the environment**, never `.spec.ts`, never an `@vitest-environment` pragma: @@ -336,9 +339,13 @@ test context). - **One assignment per statement** (`no-multi-assign`): no chaining, no assignment inside an expression such as `const group = (groups[key] ??= …)`. `??=` as its own statement is fine. -- `