Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions CODING_STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,13 @@ A state the compiler refuses needs no test and cannot return unnoticed.
shell, a database, or a framework.
- Why: decision logic coupled to side effects cannot be tested or replaced in
isolation.
- **SF-SHP-5** Fix the root cause of defects; restructure wrong underlying
designs. Never add unrequested aliases, fallbacks, or compatibility shims.
- Why: patching symptoms lets defects return, and each shim adds a second code
path to maintain.
- **SF-SHP-5** Fix the root cause of defects and restructure wrong underlying
designs, never adding an unrequested second path to existing behaviour, such
as an alias, fallback, or coercion kept so old callers or formats keep
working, in whatever module it sits. Composing around an interface to add a
new concern is not such a path (`SF-SHP-10`).
- Why: patching symptoms lets defects return, and each second path is more
code to maintain.
- **SF-SHP-7** Every line of code is a liability. Delete dead code, unify
duplicate paths, or make invalid states unconstructable before adding code.
When removing something, delete every definition, call site, and export in the
Expand All @@ -117,6 +120,20 @@ A state the compiler refuses needs no test and cannot return unnoticed.
TypeScript if it has none. Use shell scripts only as thin wrappers setting
options and running one command.
- Why: shell scripts lack type checking and tests, and fail silently.
- **SF-SHP-10** Give each component one job: put a change that would make it
import or call a dependency or I/O boundary it does not already use in a
separate module (a shim, wrapper, or decorator) that uses only its public
interface and is wired at the composition root (`SF-SHP-1`); when the
capability belongs to another owned component, add it there, and wrap or fix
upstream a third-party one (`SF-SHP-8`). A tool offered to an agent may
combine steps into one call as a new component calling single-job parts, but
never takes an input that selects among operations sharing no step.
- Why: each concern grown inside a component widens every caller's contract
and imports, and its tests can no longer run without that concern.
- Wrong: a task runner gained a worktree option and a git dependency, so its
unit tests needed a git repository.
- Right: a worktree wrapper creates the worktree and calls the unchanged
runner.

## Secrets and public repositories

Expand Down
Loading