Dependency Discipline
The five questions
Before adding a dependency, answer these five questions in order:
- Does the project already have what you need?
- Does the framework, platform, or standard toolchain already provide it?
- Does the dependency solve a real requirement?
- Is the maintenance cost worth it?
- Does it work with the standardized toolchain?
Worked example — candidate zod for runtime validation in a TypeScript project:
- Project: no existing runtime validation.
- Platform: TypeScript types are compile-time only; request bodies and environment variables are untyped at runtime.
- Requirement: external input crosses the runtime boundary and must be validated before use.
- Maintenance: single-purpose library with a small API — only one dependency to track.
- Toolchain: a pure runtime library; installed with pnpm, no conflict with oxlint or oxfmt.
Decision: add zod.
Use the same questions to rule out unnecessary dependencies: a truncate string-helper library fails question 3 — three clear lines implement it without a dependency; axios fails question 2 when the platform fetch already covers the requirement.
Do not add a library for logic you can write clearly in a few lines.
Do not replace a standardized tool with another dependency without explicit user approval.
Compatibility reference
Evaluate compatibility against the mandatory toolchain:
- TypeScript toolchain — pnpm, oxlint, oxfmt
- Python toolchain — uv, ruff
- Quality gates — prek
- Git workflow — Cocogitto for Conventional Commits
For endorsed library choices, see Frontend framework and Python API stack.
The standardization principle behind these rules is defined in Core Engineering Principles.