.agents/skills/architecture-review/SKILL.md
Use this skill before implementing a non-trivial structural change. Do not use it for a local bug fix or a small refactor whose boundaries and contracts remain unchanged.
The score is a decision aid, not a substitute for reasoning. Explain the evidence behind each score and reject an abstraction that adds complexity without improving the baseline.
baseline → proposal.Behavior shared by multiple types should live in one place. Adding a precondition or branch should touch one site, not require synchronized edits across implementations.
Cross-module access must use an intentional boundary, never another class's internals. Adding methods to npm-exported
classes such as Span, Tracer, or OpenTelemetry bridge spans is a lasting compatibility commitment. Prefer a
callback, diagnostic channel, composition, or a redesigned module boundary over exposing internal state.
Express invariants through constructor signatures, specific JSDoc types, narrow interfaces, abstract methods when
appropriate, and #private state. Do not rely on undocumented conventions between modules.
Test boundaries with multiple consumers or protocol/specification contracts directly. Exercise real entry points and observable output; do not export internals or construct impossible object states solely for tests.
Evaluate the likely next consumer, type, or method. A third implementation should require a localized addition rather than edits across every existing implementation. Do not add speculative generality without a credible next case.
Measure overhead at architectural boundaries on the actual call path. Avoid extra allocations, closures, dispatch, parsing, and listeners per call. A performance-motivated increase in complexity requires focused, reproducible benchmark evidence.
7 → 7 rewrite is not architectural progress.Summarize the review in a compact table:
| Dimension | Baseline | Proposal | Evidence |
|---|---|---|---|
| Drift prevention | |||
| Module coupling | |||
| Explicit contracts | |||
| Testability at boundaries | |||
| Extensibility | |||
| Hot-path fitness |
Then state the decision, rejected alternatives, remaining risks, and the validation needed before merging.