project-brain 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -6
- package/package.json +7 -6
- package/templates/project.claude.md +1 -1
- package/templates/skills/brain-audit/SKILL.md +134 -0
- package/templates/skills/brain-audit/references/abuse.md +59 -0
- package/templates/skills/brain-audit/references/accessibility.md +55 -0
- package/templates/skills/brain-audit/references/ai.md +51 -0
- package/templates/skills/brain-audit/references/api.md +47 -0
- package/templates/skills/brain-audit/references/backend.md +48 -0
- package/templates/skills/brain-audit/references/complexity.md +52 -0
- package/templates/skills/brain-audit/references/concurrency.md +60 -0
- package/templates/skills/brain-audit/references/consistency.md +59 -0
- package/templates/skills/brain-audit/references/contract-drift.md +58 -0
- package/templates/skills/brain-audit/references/cost.md +60 -0
- package/templates/skills/brain-audit/references/database.md +59 -0
- package/templates/skills/brain-audit/references/dependencies-licensing.md +59 -0
- package/templates/skills/brain-audit/references/devops.md +61 -0
- package/templates/skills/brain-audit/references/documentation.md +56 -0
- package/templates/skills/brain-audit/references/failure.md +58 -0
- package/templates/skills/brain-audit/references/flow-integrity.md +61 -0
- package/templates/skills/brain-audit/references/frontend.md +51 -0
- package/templates/skills/brain-audit/references/functional.md +39 -0
- package/templates/skills/brain-audit/references/future.md +31 -0
- package/templates/skills/brain-audit/references/goal.md +38 -0
- package/templates/skills/brain-audit/references/i18n.md +61 -0
- package/templates/skills/brain-audit/references/infrastructure.md +62 -0
- package/templates/skills/brain-audit/references/mobile.md +58 -0
- package/templates/skills/brain-audit/references/observability.md +55 -0
- package/templates/skills/brain-audit/references/packaging.md +52 -0
- package/templates/skills/brain-audit/references/performance.md +58 -0
- package/templates/skills/brain-audit/references/privacy.md +63 -0
- package/templates/skills/brain-audit/references/product.md +34 -0
- package/templates/skills/brain-audit/references/prompt-spec-gap.md +41 -0
- package/templates/skills/brain-audit/references/reachability.md +58 -0
- package/templates/skills/brain-audit/references/scalability.md +55 -0
- package/templates/skills/brain-audit/references/security.md +75 -0
- package/templates/skills/brain-audit/references/testing.md +58 -0
- package/templates/skills/brain-audit/references/versioning-compatibility.md +59 -0
- package/templates/skills/brain-okf/SKILL.md +157 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Complexity
|
|
2
|
+
|
|
3
|
+
What is harder to change than it needs to be? Complexity is not line count — it is the number of things you must hold in your head to make a correct edit.
|
|
4
|
+
|
|
5
|
+
Use `repo_map` to find the structurally central symbols, then `impact` on each. **A symbol with a large blast radius and high internal complexity is the riskiest code in the project**, and that combination is what this module is for.
|
|
6
|
+
|
|
7
|
+
## Structural complexity
|
|
8
|
+
|
|
9
|
+
- [ ] Functions doing more than one thing. The tell is the name: `and`, `or`, `handle`, `process`, `manage`, or a name that describes the caller rather than the operation.
|
|
10
|
+
- [ ] Deep nesting. Three levels of conditionals inside a loop is where off-by-one and missed-branch bugs live. Early returns and guard clauses usually collapse it.
|
|
11
|
+
- [ ] Long parameter lists, especially with several of the same type — every call site is a chance to swap two arguments silently.
|
|
12
|
+
- [ ] Boolean parameters that select behaviour. `render(true, false)` at the call site tells the reader nothing.
|
|
13
|
+
- [ ] Functions whose control flow depends on the *caller's* state rather than their arguments.
|
|
14
|
+
|
|
15
|
+
## Coupling
|
|
16
|
+
|
|
17
|
+
- [ ] `impact` on the central symbols: how much of the codebase must be re-verified to change one of them? A high number is not automatically wrong, but it must be intentional.
|
|
18
|
+
- [ ] Modules that import from many others. `find_callees` at module granularity.
|
|
19
|
+
- [ ] Cyclic dependencies. `trace_path` from a module back to itself — a cycle means neither side can be understood alone.
|
|
20
|
+
- [ ] Shared mutable state as a coupling mechanism. Two modules communicating through a global are coupled without an interface.
|
|
21
|
+
- [ ] Reaching through an object to its internals (`a.b.c.d`) — that chain is four assumptions.
|
|
22
|
+
|
|
23
|
+
## Duplication that matters
|
|
24
|
+
|
|
25
|
+
- [ ] Duplicated *logic*, not duplicated *shape*. Two functions with the same structure and different meaning should stay separate; two encoding the same rule must not.
|
|
26
|
+
- [ ] The same business rule expressed in more than one place — a validation, a threshold, a format. `search_code` the literal value.
|
|
27
|
+
- [ ] Magic values repeated across files. One named constant, one place to change.
|
|
28
|
+
- [ ] Premature deduplication is its own finding: an abstraction with one caller and three parameters that only exist to serve it.
|
|
29
|
+
|
|
30
|
+
## Cognitive load
|
|
31
|
+
|
|
32
|
+
- [ ] Names that require reading the implementation to understand. Cross-reference the naming-drift check in `functional.md`.
|
|
33
|
+
- [ ] Implicit ordering requirements — "call `init` before `run`" enforced only by convention. Make it structural or check it.
|
|
34
|
+
- [ ] Non-obvious code with no comment explaining *why*. Comments restating *what* the code does are noise; a missing *why* on a surprising line is a real gap.
|
|
35
|
+
- [ ] Conditionals whose branches are hard to enumerate: nested ternaries, flag combinations, `switch` with fallthrough.
|
|
36
|
+
|
|
37
|
+
## Dead weight
|
|
38
|
+
|
|
39
|
+
Report these under `Reachability` rather than here, but look for them while reading: unused parameters, options nothing sets, defensive checks for states that cannot occur, and abstraction layers that only forward.
|
|
40
|
+
|
|
41
|
+
## Severity guidance
|
|
42
|
+
|
|
43
|
+
| Situation | Severity |
|
|
44
|
+
|---|---|
|
|
45
|
+
| High-blast-radius symbol that is also internally complex | High |
|
|
46
|
+
| The same business rule duplicated in more than one place | Medium |
|
|
47
|
+
| Cyclic dependency between modules | Medium |
|
|
48
|
+
| Implicit call-ordering requirement with no enforcement | Medium |
|
|
49
|
+
| Deeply nested control flow on a correctness-critical path | Medium |
|
|
50
|
+
| Boolean parameter selecting behaviour | Low |
|
|
51
|
+
| Surprising line with no explanatory comment | Low |
|
|
52
|
+
| Abstraction with one caller | Low |
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Concurrency
|
|
2
|
+
|
|
3
|
+
What happens when two of these run at once? Gate: a queue, worker, or background jobs were detected.
|
|
4
|
+
|
|
5
|
+
Concurrency defects are the ones that pass every test and fail in production, because tests run one thing at a time. Read for the interleaving, not the happy path.
|
|
6
|
+
|
|
7
|
+
## Shared mutable state
|
|
8
|
+
|
|
9
|
+
- [ ] Identify every piece of state reachable from more than one concurrent path. `find_callers` on each module-level mutable binding — more than one caller on different paths is a candidate.
|
|
10
|
+
- [ ] Module-level `let`, mutable singletons, and caches populated lazily. Lazy initialisation under concurrency initialises twice.
|
|
11
|
+
- [ ] Objects passed by reference to concurrent consumers and mutated by any of them.
|
|
12
|
+
|
|
13
|
+
## Read-modify-write
|
|
14
|
+
|
|
15
|
+
- [ ] Every read-then-write sequence on shared state. Between the read and the write, another actor can change it. Look for: counters, "check then create", "find or insert", version bumps, balance updates.
|
|
16
|
+
- [ ] The fix must be visible: an atomic operation, a compare-and-swap, a row lock, a unique constraint, or an explicit lock. A comment saying it is safe is not a mechanism.
|
|
17
|
+
- [ ] `check-then-act` on the filesystem — `existsSync` then `writeFile` is a race. Prefer atomic create or accept-and-handle-the-error.
|
|
18
|
+
|
|
19
|
+
## Ordering
|
|
20
|
+
|
|
21
|
+
- [ ] Nothing depends on the completion order of concurrent operations unless it is enforced.
|
|
22
|
+
- [ ] `Promise.all` over operations with hidden interdependencies — they will interleave.
|
|
23
|
+
- [ ] Fire-and-forget calls whose effects a later step assumes. `search_code` for unawaited async calls.
|
|
24
|
+
- [ ] Event handlers that can be re-entered before the previous invocation finishes.
|
|
25
|
+
|
|
26
|
+
## Locks and resources
|
|
27
|
+
|
|
28
|
+
- [ ] Locks are always released, including on the error path. A lock held through a throw is a permanent deadlock.
|
|
29
|
+
- [ ] Lock acquisition order is consistent everywhere; two paths taking A-then-B and B-then-A deadlock.
|
|
30
|
+
- [ ] Locks have a timeout or a lease, so a dead holder does not block forever.
|
|
31
|
+
- [ ] Nothing does I/O while holding a lock longer than necessary.
|
|
32
|
+
|
|
33
|
+
## Cancellation
|
|
34
|
+
|
|
35
|
+
- [ ] Long operations are cancellable, and cancellation actually stops work rather than only ignoring the result.
|
|
36
|
+
- [ ] Cancelled operations clean up — release resources, roll back partial state.
|
|
37
|
+
- [ ] A late result from a cancelled or superseded operation cannot overwrite a newer one. This is the same defect as the unmounted-component write in `frontend.md`.
|
|
38
|
+
|
|
39
|
+
## Signals and shutdown
|
|
40
|
+
|
|
41
|
+
- [ ] In-flight work completes or is safely abandoned on shutdown; nothing is left half-written.
|
|
42
|
+
- [ ] Shutdown is bounded — a hang on drain is worse than a forced exit.
|
|
43
|
+
- [ ] Persistent handles (database, WAL, file locks) are closed on every exit path.
|
|
44
|
+
|
|
45
|
+
## Reporting
|
|
46
|
+
|
|
47
|
+
State each finding as an interleaving: "if A reaches line X while B is between lines Y and Z, then …". A concurrency finding without a concrete interleaving is unfalsifiable, and reviewers correctly dismiss it.
|
|
48
|
+
|
|
49
|
+
## Severity guidance
|
|
50
|
+
|
|
51
|
+
| Situation | Severity |
|
|
52
|
+
|---|---|
|
|
53
|
+
| Read-modify-write on shared state with no atomicity | High |
|
|
54
|
+
| Lock not released on the error path | High |
|
|
55
|
+
| Inconsistent lock ordering across paths | High |
|
|
56
|
+
| Late result overwriting a newer one | Medium |
|
|
57
|
+
| Lazy initialisation racing to initialise twice | Medium |
|
|
58
|
+
| Unawaited async call whose effect is later assumed | Medium |
|
|
59
|
+
| Non-cancellable long operation | Medium |
|
|
60
|
+
| Unbounded shutdown drain | Low |
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Consistency
|
|
2
|
+
|
|
3
|
+
Does the codebase agree with itself? Inconsistency is cheap to live with and expensive to work in: every inconsistency is a decision the next reader has to make again.
|
|
4
|
+
|
|
5
|
+
The method here is comparison, not judgement. Find the dominant pattern with `search_code`, then find the deviations. **The dominant pattern is the standard, even if you would have chosen differently** — do not report the majority as wrong because of personal preference.
|
|
6
|
+
|
|
7
|
+
## Naming
|
|
8
|
+
|
|
9
|
+
- [ ] Casing conventions per kind of thing (files, functions, types, constants, config keys) — one convention each, or a stated reason for more.
|
|
10
|
+
- [ ] The same concept has the same name everywhere. `user` / `account` / `member` for one entity is three mental models.
|
|
11
|
+
- [ ] Opposite operations use symmetric names: `open`/`close`, not `open`/`dispose`.
|
|
12
|
+
- [ ] Boolean names read as assertions — `isReady`, `hasItems` — not as nouns.
|
|
13
|
+
- [ ] Abbreviations are used consistently or not at all.
|
|
14
|
+
|
|
15
|
+
## Structure
|
|
16
|
+
|
|
17
|
+
- [ ] Files are organised by one principle, not two competing ones (by type in one place, by feature in another).
|
|
18
|
+
- [ ] Similar things live in similar places. A new contributor should be able to guess where a file goes.
|
|
19
|
+
- [ ] Module entry points are consistent — barrel file or direct import, one or the other.
|
|
20
|
+
- [ ] Test file location and naming follow one rule.
|
|
21
|
+
|
|
22
|
+
## Idioms
|
|
23
|
+
|
|
24
|
+
- [ ] One way to do each recurring thing: error creation, logging, config reading, async style, validation.
|
|
25
|
+
- [ ] Async style is uniform. Mixed callbacks, promises, and async/await for the same kind of operation forces the reader to context-switch.
|
|
26
|
+
- [ ] Error handling shape is uniform — throw vs. return-result, chosen once.
|
|
27
|
+
- [ ] Data validation happens at consistent boundaries, not sometimes at the edge and sometimes three layers in.
|
|
28
|
+
- [ ] Immutability conventions are consistent — if most code avoids mutation, the places that mutate need a reason.
|
|
29
|
+
|
|
30
|
+
## Interfaces
|
|
31
|
+
|
|
32
|
+
- [ ] Functions with the same role have the same signature shape — options object vs. positional, sync vs. async, same parameter order.
|
|
33
|
+
- [ ] Return shapes are consistent for the same kind of operation. Cross-reference the output-correctness check in `functional.md`.
|
|
34
|
+
- [ ] Null vs. undefined vs. empty-collection means the same thing throughout.
|
|
35
|
+
- [ ] Optional parameters appear in the same position and default the same way.
|
|
36
|
+
|
|
37
|
+
## Documentation and comments
|
|
38
|
+
|
|
39
|
+
- [ ] Comment style and density are uniform. Half the exports documented is worse than none, because the gaps read as intentional.
|
|
40
|
+
- [ ] The documentation format is one format.
|
|
41
|
+
- [ ] Comments are current. A comment contradicting its code is `Medium` — readers trust comments, and this one lies. This is exactly how the "Close without binding" comment in this repo's own HTTP test came to mislead.
|
|
42
|
+
|
|
43
|
+
## Tooling agreement
|
|
44
|
+
|
|
45
|
+
- [ ] Formatter and linter config exist and the codebase actually conforms. A config nothing enforces is decoration.
|
|
46
|
+
- [ ] Committed config does not contradict itself (editor settings vs. formatter vs. linter).
|
|
47
|
+
- [ ] Pre-commit or CI enforces what the config declares. Otherwise the standard is optional, and optional standards decay.
|
|
48
|
+
|
|
49
|
+
## Severity guidance
|
|
50
|
+
|
|
51
|
+
| Situation | Severity |
|
|
52
|
+
|---|---|
|
|
53
|
+
| Comment that contradicts its code | Medium |
|
|
54
|
+
| One concept under several names | Medium |
|
|
55
|
+
| Mixed async styles for the same operation kind | Medium |
|
|
56
|
+
| Inconsistent meaning of null / undefined / empty | Medium |
|
|
57
|
+
| Two competing file-organisation principles | Low |
|
|
58
|
+
| Formatter config that nothing enforces | Low |
|
|
59
|
+
| Casing convention drift | Low |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Contract Drift
|
|
2
|
+
|
|
3
|
+
Gate: OpenAPI, GraphQL, protobuf, or shared types were detected.
|
|
4
|
+
|
|
5
|
+
A contract is a promise written in two or more places. This module checks whether those places still agree. Drift here is invisible to every party individually — each side is internally consistent, and the mismatch only appears in production.
|
|
6
|
+
|
|
7
|
+
**Find every representation of the contract first.** Typically: the schema artefact, the server implementation, the generated client, the consumer's own types, the documentation, and the test fixtures. Each one is a place drift can hide.
|
|
8
|
+
|
|
9
|
+
## Schema vs. server
|
|
10
|
+
|
|
11
|
+
- [ ] Every operation in the schema exists in the implementation. `search_code` the operation name, then `find_symbol` on the handler.
|
|
12
|
+
- [ ] Every implemented operation appears in the schema. An undocumented endpoint is drift plus a `Reachability` question.
|
|
13
|
+
- [ ] Field-level agreement: names, types, nullability, required-ness, enum members. Nullability drift is the most commonly missed and the most likely to crash a consumer.
|
|
14
|
+
- [ ] Declared error responses match what the server actually returns, including status codes.
|
|
15
|
+
- [ ] The schema is generated from the implementation or verified against it. A hand-maintained schema with no check will drift — that is not a prediction, it is a certainty.
|
|
16
|
+
|
|
17
|
+
## Schema vs. consumer
|
|
18
|
+
|
|
19
|
+
- [ ] Generated clients are regenerated from the current schema, and the generated output is either committed or built in CI. A stale committed client is drift with a long fuse.
|
|
20
|
+
- [ ] Hand-written consumer types match the schema. Cross-reference `api.md`: `find_callers` on the response type to see who destructures which fields.
|
|
21
|
+
- [ ] Consumers do not read fields the schema does not promise — including fields that happen to exist today but are undocumented.
|
|
22
|
+
- [ ] Consumers tolerate fields being added. A client that rejects unknown fields makes every additive change breaking.
|
|
23
|
+
|
|
24
|
+
## Versioning of the contract
|
|
25
|
+
|
|
26
|
+
- [ ] Schema changes are classified as additive or breaking, and breaking ones are versioned. Cross-reference `versioning-compatibility.md`.
|
|
27
|
+
- [ ] These look additive and are not: narrowing a type, adding a required field, making an optional field required, removing an enum member, tightening a pattern.
|
|
28
|
+
- [ ] For protobuf: field numbers are never reused or renumbered, removed fields are reserved, and required-ness changes are treated as breaking.
|
|
29
|
+
- [ ] For GraphQL: removing a field or changing a type is breaking even when clients do not currently request it — someone's query will.
|
|
30
|
+
|
|
31
|
+
## Shared types across boundaries
|
|
32
|
+
|
|
33
|
+
- [ ] Types shared between packages or services come from one source, not duplicated definitions kept in sync by hand.
|
|
34
|
+
- [ ] Where duplication is unavoidable, a test asserts equivalence. Same anti-drift pattern as a manifest parity test: the hand-maintained copy is fine, the unguarded hand-maintained copy is not.
|
|
35
|
+
- [ ] Serialisation boundaries agree on representation — date encoding, number precision, null vs. absent, empty vs. missing.
|
|
36
|
+
- [ ] Enum values agree on the wire, not only in name.
|
|
37
|
+
|
|
38
|
+
## Fixtures and tests
|
|
39
|
+
|
|
40
|
+
- [ ] Test fixtures are validated against the schema. A fixture that drifted from the contract makes the suite pass against a shape that no longer exists — the tests then actively hide the drift.
|
|
41
|
+
- [ ] Contract tests exist at the boundary, not only unit tests on each side. Two sides each passing their own tests is exactly the state in which drift survives.
|
|
42
|
+
- [ ] Something in CI fails when the schema and the implementation disagree. If not, that missing check is the finding that generates all the others.
|
|
43
|
+
|
|
44
|
+
## Severity guidance
|
|
45
|
+
|
|
46
|
+
| Situation | Severity |
|
|
47
|
+
|---|---|
|
|
48
|
+
| Consumer reads a field the server no longer returns | Critical |
|
|
49
|
+
| Nullability mismatch between schema and implementation | High |
|
|
50
|
+
| Breaking schema change shipped as additive | High |
|
|
51
|
+
| Protobuf field number reused or renumbered | High |
|
|
52
|
+
| Stale committed generated client | High |
|
|
53
|
+
| Test fixtures drifted from the schema, hiding the mismatch | High |
|
|
54
|
+
| Operation implemented but absent from the schema | Medium |
|
|
55
|
+
| Declared error responses that do not match reality | Medium |
|
|
56
|
+
| Duplicated shared types with no equivalence test | Medium |
|
|
57
|
+
| No CI check that schema and implementation agree | Medium |
|
|
58
|
+
| Client rejecting unknown fields | Low |
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Cost
|
|
2
|
+
|
|
3
|
+
What does running this bill? Gate: LLM/AI SDK calls, or metered cloud usage, was detected.
|
|
4
|
+
|
|
5
|
+
Cost defects are unusual: they do not break anything, so nothing surfaces them until an invoice does. The audit is mechanical — find every metered operation, then find what bounds it.
|
|
6
|
+
|
|
7
|
+
## Inventory the meters
|
|
8
|
+
|
|
9
|
+
- [ ] Every operation that bills: model calls, per-request cloud services, egress, storage, function invocations, third-party API calls.
|
|
10
|
+
- [ ] For each one, the unit it bills on — tokens, requests, gigabytes, seconds, rows scanned.
|
|
11
|
+
- [ ] For each one, **what bounds it**. If the answer is "nothing", that is the finding regardless of current volume.
|
|
12
|
+
- [ ] Metered calls reachable by an unauthenticated caller. Cross-reference `abuse.md` — that is someone else spending your money.
|
|
13
|
+
|
|
14
|
+
## Bounds
|
|
15
|
+
|
|
16
|
+
- [ ] Metered calls inside loops. `find_callees` on the loop body — a per-item model call over an unbounded list is the classic runaway.
|
|
17
|
+
- [ ] Input size bounded before a token-billed call, not after. Cross-reference `ai.md`.
|
|
18
|
+
- [ ] Output length capped. An unbounded max-tokens setting bills for whatever the model decides to say.
|
|
19
|
+
- [ ] Retries bounded and backed off. An unbounded retry against a failing paid endpoint bills for every attempt — this is both a cost and a reliability defect.
|
|
20
|
+
- [ ] Fan-out bounded: one user action must not trigger an unbounded number of paid calls.
|
|
21
|
+
- [ ] A hard ceiling exists somewhere — quota, budget alert, circuit breaker. Something that stops the bleeding without a human.
|
|
22
|
+
|
|
23
|
+
## Waste
|
|
24
|
+
|
|
25
|
+
- [ ] Repeated identical paid calls with no cache. Cross-reference the caching checks in `performance.md`; here the missing cache costs money rather than latency.
|
|
26
|
+
- [ ] Cache in place but the key omits a dimension, so it never hits.
|
|
27
|
+
- [ ] The most expensive tier used for work a cheaper one handles — a large model for classification, a premium instance for a cron job.
|
|
28
|
+
- [ ] Paid calls whose results are discarded, made speculatively, or duplicated across code paths.
|
|
29
|
+
- [ ] Provisioned capacity far above observed use. Cross-reference `infrastructure.md`.
|
|
30
|
+
- [ ] Storage with no retention policy — it only grows, and it bills monthly forever. Cross-reference `privacy.md`, where retention is also a compliance question.
|
|
31
|
+
- [ ] Egress from chatty cross-region or cross-zone traffic.
|
|
32
|
+
|
|
33
|
+
## Development and test cost
|
|
34
|
+
|
|
35
|
+
- [ ] Tests do not hit paid endpoints. A test suite that bills per run is a cost defect and a flake source. Verify the fakes are actually used.
|
|
36
|
+
- [ ] Development and staging have their own, smaller budgets and cannot reach production-scale resources.
|
|
37
|
+
- [ ] Nothing left running by default in non-production — idle instances bill exactly like busy ones.
|
|
38
|
+
|
|
39
|
+
## Attribution
|
|
40
|
+
|
|
41
|
+
- [ ] Spend is attributable to a feature, tenant, or endpoint. Without attribution you can see the total and change nothing.
|
|
42
|
+
- [ ] Usage is recorded per operation where it bills per unit, so a spike is diagnosable. Cross-reference `observability.md`.
|
|
43
|
+
- [ ] Someone would notice a 10× increase within a day. If the only detection is the monthly invoice, that is the finding.
|
|
44
|
+
|
|
45
|
+
## Severity guidance
|
|
46
|
+
|
|
47
|
+
| Situation | Severity |
|
|
48
|
+
|---|---|
|
|
49
|
+
| Unauthenticated caller can trigger a metered operation | Critical |
|
|
50
|
+
| Unbounded retry against a paid endpoint | High |
|
|
51
|
+
| Metered call inside an unbounded loop | High |
|
|
52
|
+
| No ceiling, quota, or budget alert anywhere | High |
|
|
53
|
+
| Tests hitting paid endpoints | High |
|
|
54
|
+
| Unbounded input or output size on a per-token call | High |
|
|
55
|
+
| Repeated identical paid calls with no cache | Medium |
|
|
56
|
+
| Cache key missing a dimension, so it never hits | Medium |
|
|
57
|
+
| Storage with no retention policy | Medium |
|
|
58
|
+
| Expensive tier used for work a cheaper one handles | Medium |
|
|
59
|
+
| No spend attribution per feature or tenant | Medium |
|
|
60
|
+
| Idle non-production resources left running | Low |
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Database
|
|
2
|
+
|
|
3
|
+
Schema, queries, and migrations. Gate: a schema, migrations, or an ORM was detected.
|
|
4
|
+
|
|
5
|
+
The highest-value checks here are the declared-vs-used inverse pairs from `reachability.md`. Run them against the schema specifically — a column code reads that no migration creates is a production crash, and it is invisible to the type checker when the ORM is loosely typed.
|
|
6
|
+
|
|
7
|
+
## Schema integrity
|
|
8
|
+
|
|
9
|
+
- [ ] Every table has a primary key.
|
|
10
|
+
- [ ] Foreign keys are declared as constraints, not merely implied by a naming convention. An implied relationship is not enforced by anything.
|
|
11
|
+
- [ ] Nullability is deliberate. A nullable column that code never checks for null is a latent crash.
|
|
12
|
+
- [ ] Enum-like columns are constrained (check constraint, enum type, or lookup table), not free-text.
|
|
13
|
+
- [ ] Unique constraints exist wherever the code assumes uniqueness. `search_code` for the lookup that assumes one row.
|
|
14
|
+
- [ ] Timestamps record what they claim — created vs. updated vs. deleted — and are timezone-explicit.
|
|
15
|
+
|
|
16
|
+
## Schema vs. code
|
|
17
|
+
|
|
18
|
+
- [ ] Every column read or written by code exists in a migration. **Code reading a column no migration creates is `Critical`.**
|
|
19
|
+
- [ ] Every column a migration creates is read or written somewhere. Unused columns are `Low`, but they are also where stale assumptions hide.
|
|
20
|
+
- [ ] Model/entity definitions match the migrated schema — types, nullability, defaults. Drift here means the ORM lies to every caller.
|
|
21
|
+
- [ ] Indexes exist for the columns actual queries filter and sort on, and no index exists for columns nothing queries.
|
|
22
|
+
|
|
23
|
+
## Query quality
|
|
24
|
+
|
|
25
|
+
- [ ] No query is built by string concatenation with a value that came from outside. Parameterised or nothing. This is `Critical` and belongs in `Security` too — report it once, cross-reference.
|
|
26
|
+
- [ ] No N+1: a query inside a loop over a previous query's results. `find_callees` on the loop body.
|
|
27
|
+
- [ ] `SELECT *` in code that only needs two columns — cheap to fix, and it silently widens every future schema change's blast radius.
|
|
28
|
+
- [ ] Queries that can scan the whole table have a bound, or a stated reason they cannot grow.
|
|
29
|
+
- [ ] Aggregations and counts on large tables are not on a request's hot path.
|
|
30
|
+
|
|
31
|
+
## Migrations
|
|
32
|
+
|
|
33
|
+
- [ ] Migrations are ordered, immutable once applied, and recorded. An edited applied migration means two environments have different schemas with the same version.
|
|
34
|
+
- [ ] Every migration is reversible, or its irreversibility is stated.
|
|
35
|
+
- [ ] Destructive migrations (drop, rename, narrow a type) are separated from deploys that still read the old shape. A single-step rename breaks every running instance of the previous version.
|
|
36
|
+
- [ ] Data migrations are idempotent and bounded — a single `UPDATE` over a large table locks it.
|
|
37
|
+
- [ ] Migrations run to completion or roll back; there is no half-applied resting state.
|
|
38
|
+
|
|
39
|
+
## Transactions and integrity
|
|
40
|
+
|
|
41
|
+
- [ ] Related writes share a transaction.
|
|
42
|
+
- [ ] Read-modify-write is protected against concurrent execution — optimistic version column, row lock, or an atomic single statement.
|
|
43
|
+
- [ ] Cascade behaviour is declared deliberately, not inherited by default. An unintended cascade delete is `Critical`.
|
|
44
|
+
- [ ] Soft deletes are respected by every read path. `find_callers` on the model — one query missing the `deleted_at` filter resurrects deleted data.
|
|
45
|
+
|
|
46
|
+
## Severity guidance
|
|
47
|
+
|
|
48
|
+
| Situation | Severity |
|
|
49
|
+
|---|---|
|
|
50
|
+
| Query built by string concatenation from external input | Critical |
|
|
51
|
+
| Code reads a column no migration creates | Critical |
|
|
52
|
+
| Unintended cascade delete | Critical |
|
|
53
|
+
| Applied migration edited in place | High |
|
|
54
|
+
| Destructive migration deployed alongside code that reads the old shape | High |
|
|
55
|
+
| Read path missing the soft-delete filter | High |
|
|
56
|
+
| Missing index on a filtered column of a growing table | Medium |
|
|
57
|
+
| N+1 query | Medium |
|
|
58
|
+
| Unconstrained enum-like column | Medium |
|
|
59
|
+
| Column created by a migration that nothing reads | Low |
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Dependencies & Licensing
|
|
2
|
+
|
|
3
|
+
Gate: a lockfile or dependency manifest was detected.
|
|
4
|
+
|
|
5
|
+
Two questions: is each dependency worth its cost, and are you allowed to ship it?
|
|
6
|
+
|
|
7
|
+
## Declared vs. used
|
|
8
|
+
|
|
9
|
+
Both directions, and both matter — this is the `reachability.md` inverse-gap check applied to the manifest.
|
|
10
|
+
|
|
11
|
+
- [ ] Declared but never imported. Dead weight in the install, and an attack surface for nothing. `search_code` each package name to confirm.
|
|
12
|
+
- [ ] **Imported but not declared.** Resolving today only because a transitive dependency hoisted it; the next lockfile update breaks the build or, worse, production. This is `High`.
|
|
13
|
+
- [ ] Runtime dependencies sitting in the dev section — fails only for consumers. Cross-reference `packaging.md`.
|
|
14
|
+
- [ ] Dev dependencies imported by runtime code.
|
|
15
|
+
|
|
16
|
+
## Weight
|
|
17
|
+
|
|
18
|
+
- [ ] Large dependencies used for a fraction of their surface. Name the specific function used and the size of what it drags in.
|
|
19
|
+
- [ ] Dependencies that duplicate the standard library or the runtime.
|
|
20
|
+
- [ ] Multiple packages solving the same problem — two date libraries, two HTTP clients, two validation libraries. Pick one; the other is a migration nobody finished.
|
|
21
|
+
- [ ] Duplicate versions of the same package in the lockfile. Bloat, and a source of "instanceof fails across copies" bugs.
|
|
22
|
+
|
|
23
|
+
## Health
|
|
24
|
+
|
|
25
|
+
- [ ] Unmaintained dependencies — last release long past, open issues unanswered, archived repository. Note the migration cost now, before it is forced.
|
|
26
|
+
- [ ] Single-maintainer packages on the critical path. Not a defect, but a risk worth naming.
|
|
27
|
+
- [ ] Known vulnerabilities. Cite the advisory; do not guess. Cross-reference `security.md`.
|
|
28
|
+
- [ ] Postinstall scripts. Each one executes arbitrary code at install time — enumerate them.
|
|
29
|
+
|
|
30
|
+
## Version discipline
|
|
31
|
+
|
|
32
|
+
- [ ] Lockfile present and committed. Absent lockfile means no two installs are the same build.
|
|
33
|
+
- [ ] Ranges are deliberate. Floating major versions on a runtime dependency accept breaking changes automatically.
|
|
34
|
+
- [ ] Pins with a comment explaining a workaround — verify the workaround is still needed. Cross-reference `future.md`.
|
|
35
|
+
- [ ] Something updates dependencies on a cadence. No process means the first update will be a forced emergency across many majors at once.
|
|
36
|
+
|
|
37
|
+
## Licensing
|
|
38
|
+
|
|
39
|
+
- [ ] Every dependency's license is known, including transitive ones. Unknown is not the same as permissive.
|
|
40
|
+
- [ ] No license incompatible with how this project ships. Copyleft in a proprietary distributed product is the classic case — flag it and say what it obligates rather than giving legal advice.
|
|
41
|
+
- [ ] The project's own declared license matches the file it ships and the headers in its source.
|
|
42
|
+
- [ ] Attribution requirements are met where licenses require notices.
|
|
43
|
+
- [ ] Vendored or copy-pasted third-party code retains its original license and attribution. `search_code` for pasted headers.
|
|
44
|
+
|
|
45
|
+
## Severity guidance
|
|
46
|
+
|
|
47
|
+
| Situation | Severity |
|
|
48
|
+
|---|---|
|
|
49
|
+
| Dependency license incompatible with how the project ships | Critical |
|
|
50
|
+
| Imported package absent from the manifest | High |
|
|
51
|
+
| Known vulnerability in a reachable dependency | High |
|
|
52
|
+
| No lockfile committed | High |
|
|
53
|
+
| Runtime dependency in the dev section | High |
|
|
54
|
+
| Vendored third-party code with attribution stripped | High |
|
|
55
|
+
| Unmaintained dependency on the critical path | Medium |
|
|
56
|
+
| Unknown license on any dependency | Medium |
|
|
57
|
+
| Floating major version on a runtime dependency | Medium |
|
|
58
|
+
| Two packages solving the same problem | Low |
|
|
59
|
+
| Declared but never imported | Low |
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# DevOps
|
|
2
|
+
|
|
3
|
+
Build, test, and release pipeline. Gate: CI/CD, a Dockerfile, or IaC was detected.
|
|
4
|
+
|
|
5
|
+
Read the pipeline as code, because it is. The same standards apply: no secrets inline, no unpinned inputs, no silent failure.
|
|
6
|
+
|
|
7
|
+
## Pipeline integrity
|
|
8
|
+
|
|
9
|
+
- [ ] The pipeline actually fails the build on test failure, type error, and lint error. `search_code` for `continue-on-error`, `|| true`, and `--passWithNoTests` — each one can turn a red build green.
|
|
10
|
+
- [ ] Every check that matters locally also runs in CI. A test suite the pipeline does not run is decoration.
|
|
11
|
+
- [ ] The pipeline runs on the branches and events that matter, including the merge target.
|
|
12
|
+
- [ ] Required checks are actually required by branch protection, not merely present.
|
|
13
|
+
|
|
14
|
+
## Reproducibility
|
|
15
|
+
|
|
16
|
+
- [ ] Lockfile committed and CI installs from it exactly — a frozen/CI install, not a resolving one.
|
|
17
|
+
- [ ] Action, image, and tool versions are pinned. A floating tag means yesterday's green build is not reproducible.
|
|
18
|
+
- [ ] Build does not depend on ambient state — developer machine paths, pre-installed global tools, network resources that can change.
|
|
19
|
+
- [ ] The same artefact that was tested is the one that deploys. Rebuilding between test and deploy tests one thing and ships another.
|
|
20
|
+
|
|
21
|
+
## Secrets in CI
|
|
22
|
+
|
|
23
|
+
- [ ] No secret in pipeline YAML, build args, or image layers. Build args are visible in image history.
|
|
24
|
+
- [ ] Secrets are not echoed. `search_code` for debug flags in the pipeline (`set -x`, verbose modes) alongside secret usage.
|
|
25
|
+
- [ ] Pull requests from forks cannot access secrets.
|
|
26
|
+
- [ ] Third-party actions and images have pinned digests, or the supply-chain exposure is accepted deliberately.
|
|
27
|
+
|
|
28
|
+
## Container hygiene
|
|
29
|
+
|
|
30
|
+
- [ ] Multi-stage build so build tooling is not in the final image.
|
|
31
|
+
- [ ] Runs as a non-root user.
|
|
32
|
+
- [ ] Base image is specific and updatable, and something updates it.
|
|
33
|
+
- [ ] Build context excludes what should not ship — `.git`, `node_modules`, `.env`, test fixtures. Check the ignore file exists and covers them.
|
|
34
|
+
- [ ] Healthcheck defined, and it reflects readiness rather than only liveness.
|
|
35
|
+
|
|
36
|
+
## Deploy and rollback
|
|
37
|
+
|
|
38
|
+
- [ ] There is a documented, tested rollback. An untested rollback is a hope.
|
|
39
|
+
- [ ] Migrations and code deploys are ordered so a running old version does not break — cross-reference the destructive-migration check in `database.md`.
|
|
40
|
+
- [ ] Deploys are atomic or gradual, not partial-and-visible.
|
|
41
|
+
- [ ] Configuration differs from code, so a config change does not require a rebuild.
|
|
42
|
+
|
|
43
|
+
## Local parity
|
|
44
|
+
|
|
45
|
+
- [ ] A new contributor can build and test with documented steps that work. Follow them literally and report each divergence.
|
|
46
|
+
- [ ] Local and CI use the same tool versions.
|
|
47
|
+
- [ ] Nothing required for development is available only to existing team members.
|
|
48
|
+
|
|
49
|
+
## Severity guidance
|
|
50
|
+
|
|
51
|
+
| Situation | Severity |
|
|
52
|
+
|---|---|
|
|
53
|
+
| Secret in pipeline config, build arg, or image layer | Critical |
|
|
54
|
+
| Pipeline cannot fail the build (`\|\| true`, `continue-on-error`) | High |
|
|
55
|
+
| Artefact rebuilt between test and deploy | High |
|
|
56
|
+
| Container runs as root | High |
|
|
57
|
+
| Untested or absent rollback path | High |
|
|
58
|
+
| Unpinned action, image, or tool version | Medium |
|
|
59
|
+
| Build depends on ambient developer state | Medium |
|
|
60
|
+
| Build context ships `.git` or secrets | Medium |
|
|
61
|
+
| Documented local setup that does not work | Medium |
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Documentation
|
|
2
|
+
|
|
3
|
+
Can someone else use and change this? Documentation findings are verifiable: follow the instructions literally and report where they fail. **Do not assess whether docs "look thorough" — execute them.**
|
|
4
|
+
|
|
5
|
+
## Correctness
|
|
6
|
+
|
|
7
|
+
- [ ] Every documented command, path, flag, and signature exists. `search_code` each one. A documented flag the parser does not accept is `Medium`; readers trust docs over code.
|
|
8
|
+
- [ ] Follow the install and first-run instructions exactly as written, on a clean assumption. Report every missing prerequisite, wrong path, and undocumented step.
|
|
9
|
+
- [ ] Code examples match current signatures. Test one against the real symbol with `find_symbol`.
|
|
10
|
+
- [ ] No documentation of features that no longer exist. Cross-reference `Reachability` for the inverse.
|
|
11
|
+
- [ ] Claims about behaviour are true. This repo's own README claimed skills were "installed globally" when nothing installed them — a false claim is worse than a gap, because nobody investigates what they believe is handled.
|
|
12
|
+
|
|
13
|
+
## Coverage
|
|
14
|
+
|
|
15
|
+
- [ ] Purpose stated up front — what this is and who it is for. Cross-reference `goal.md`.
|
|
16
|
+
- [ ] Every public entry point documented: commands, endpoints, exported functions, config keys, environment variables.
|
|
17
|
+
- [ ] Every configuration option documented with its type, default, and effect.
|
|
18
|
+
- [ ] Prerequisites and supported platforms stated, and matching what the code requires.
|
|
19
|
+
- [ ] Failure modes documented: what common errors mean and what to do about them.
|
|
20
|
+
- [ ] A path from install to first useful result, in order.
|
|
21
|
+
|
|
22
|
+
## Structure
|
|
23
|
+
|
|
24
|
+
- [ ] A reader can find what they need without reading everything. Reference material separate from tutorials.
|
|
25
|
+
- [ ] Nothing important lives only in a comment, a commit message, or an issue.
|
|
26
|
+
- [ ] Docs live near what they describe, so a change is likely to update both.
|
|
27
|
+
- [ ] No duplicated documentation of the same thing in two places — they will diverge, and the reader cannot tell which is current.
|
|
28
|
+
|
|
29
|
+
## In-code documentation
|
|
30
|
+
|
|
31
|
+
- [ ] Non-obvious code explains **why**, not what. A comment restating the line is noise; a missing rationale on a surprising line is a real gap.
|
|
32
|
+
- [ ] Public APIs document their contract: what they accept, what they return, what they throw, what they mutate.
|
|
33
|
+
- [ ] Comments are current. A comment contradicting its code is `Medium` — cross-reference `consistency.md`.
|
|
34
|
+
- [ ] Workarounds record why they exist and what would let them be removed. An unexplained workaround is permanent by default.
|
|
35
|
+
- [ ] Deliberate deviations from an obvious approach say so, and say what was traded.
|
|
36
|
+
|
|
37
|
+
## Maintenance
|
|
38
|
+
|
|
39
|
+
- [ ] Something keeps docs honest — a test asserting required sections, a link check, or executable examples. Docs with no enforcement decay silently.
|
|
40
|
+
- [ ] Onboarding docs name an owner, or are recent enough to trust.
|
|
41
|
+
- [ ] Where specs, plans, or ADRs exist, they reflect what shipped. Cross-reference `prompt-spec-gap.md`; a plan describing a design the code abandoned actively misleads.
|
|
42
|
+
|
|
43
|
+
## Severity guidance
|
|
44
|
+
|
|
45
|
+
| Situation | Severity |
|
|
46
|
+
|---|---|
|
|
47
|
+
| Documented behaviour that is false | High |
|
|
48
|
+
| Install or first-run instructions that do not work | High |
|
|
49
|
+
| Undocumented required configuration | High |
|
|
50
|
+
| Documented flag, path, or command that does not exist | Medium |
|
|
51
|
+
| Comment that contradicts its code | Medium |
|
|
52
|
+
| Public entry point with no documentation | Medium |
|
|
53
|
+
| Spec or plan describing an abandoned design | Medium |
|
|
54
|
+
| Unexplained workaround | Low |
|
|
55
|
+
| Same thing documented in two places | Low |
|
|
56
|
+
| No enforcement keeping docs honest | Low |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Failure
|
|
2
|
+
|
|
3
|
+
What happens when things go wrong? Gate: auth, external input, or a network boundary was detected.
|
|
4
|
+
|
|
5
|
+
The test suite proves the happy path. This module walks the other paths — and in most codebases there are more of them.
|
|
6
|
+
|
|
7
|
+
## Error propagation
|
|
8
|
+
|
|
9
|
+
- [ ] No swallowed errors. `search_code` for empty catch blocks, `.catch(() => {})`, and `catch` bodies that only log at debug level. Each one converts a failure into wrong behaviour.
|
|
10
|
+
- [ ] Caught errors either handle or rethrow. Catching to log and continue with invalid state is the worst of both.
|
|
11
|
+
- [ ] Error context survives the chain. A rethrown error that loses the original cause makes the real failure unfindable.
|
|
12
|
+
- [ ] Errors are distinguishable by type or code, not by matching message strings. Message matching breaks on the next wording change.
|
|
13
|
+
|
|
14
|
+
## Boundaries
|
|
15
|
+
|
|
16
|
+
- [ ] Every external call is wrapped: network, filesystem, subprocess, database, parsing untrusted input.
|
|
17
|
+
- [ ] Every external call has a timeout. Missing timeout is `High` — it turns a slow dependency into an outage.
|
|
18
|
+
- [ ] Retries exist where the failure is transient, are bounded, and back off. Retrying a non-idempotent operation is worse than failing.
|
|
19
|
+
- [ ] Non-transient failures are not retried. Retrying a 400 wastes time and hides the bug.
|
|
20
|
+
|
|
21
|
+
## Partial failure
|
|
22
|
+
|
|
23
|
+
- [ ] Multi-step operations state what happens when step 3 of 5 fails. Transaction, compensating action, or documented tolerance — pick one explicitly.
|
|
24
|
+
- [ ] Nothing is left half-written: no partial config, no orphaned rows, no half-copied directory.
|
|
25
|
+
- [ ] Operations that touch two systems have a reconciliation story. Cross-reference `Backend`.
|
|
26
|
+
- [ ] Batch operations report which items succeeded and which failed, rather than one aggregate boolean.
|
|
27
|
+
|
|
28
|
+
## Degradation
|
|
29
|
+
|
|
30
|
+
- [ ] Optional dependencies failing does not fail the whole operation. An analytics outage must not take down a request.
|
|
31
|
+
- [ ] There is a defined degraded mode where one exists — cached data, reduced functionality, a clear message.
|
|
32
|
+
- [ ] Degradation is visible. Silently serving stale data with no signal is how small outages become long ones.
|
|
33
|
+
|
|
34
|
+
## User-facing failure
|
|
35
|
+
|
|
36
|
+
- [ ] Every error the user can hit produces something actionable — what happened, and what to do.
|
|
37
|
+
- [ ] No stack trace, internal path, SQL, or provider error reaches the user. That is also an information-disclosure finding — cross-reference `Security`.
|
|
38
|
+
- [ ] Failures the user caused are distinguishable from failures the system caused.
|
|
39
|
+
|
|
40
|
+
## Recovery
|
|
41
|
+
|
|
42
|
+
- [ ] Restart-safety: the process can be killed at any point and restarted without corruption.
|
|
43
|
+
- [ ] Interrupted operations are resumable, or safely re-runnable from the start. Cross-reference the idempotency check in `functional.md`.
|
|
44
|
+
- [ ] Anything that can be left in a bad state has a way out — a repair command, a documented manual procedure, or self-healing.
|
|
45
|
+
|
|
46
|
+
## Severity guidance
|
|
47
|
+
|
|
48
|
+
| Situation | Severity |
|
|
49
|
+
|---|---|
|
|
50
|
+
| Swallowed error leading to silent data loss | Critical |
|
|
51
|
+
| Missing timeout on an external call | High |
|
|
52
|
+
| Multi-step write with no rollback or reconciliation | High |
|
|
53
|
+
| Retrying a non-idempotent operation | High |
|
|
54
|
+
| Internal error detail leaked to the user | Medium |
|
|
55
|
+
| Optional dependency failure taking down the request | Medium |
|
|
56
|
+
| Error type distinguished by message string | Medium |
|
|
57
|
+
| Silent degradation with no signal | Medium |
|
|
58
|
+
| Batch reporting only an aggregate result | Low |
|