Instruction file imported from dot-principles/dot-principles.github.io (
.github/instructions/source-code.instructions.md). Copyright stays with the author.
applyTo:
- "**/*"
Source Code Principles
- INFRA-NO-SECRETS-IN-CODE: Inject secrets at runtime from a secrets manager; never store credentials in code, config files, or logs.
- CODE-DX-NAMING: Every name must reveal intent; never use a name that requires a comment to explain it.
- CODE-DX-SMALL-FUNCTIONS: Keep functions small, doing one thing only; extract additional responsibilities into named functions.
- CODE-DX-CODE-FOR-READERS: Write code to be read by humans first; prioritize clarity over cleverness in every choice.
- CODE-DX-REDUCE-COGNITIVE-LOAD: Structure code so developers hold as few concepts in working memory as possible at any point.
- CODE-CS-DRY: Every piece of knowledge must have a single, authoritative representation in the system.
- CODE-CS-YAGNI: Never add functionality until it is actually needed; implement only what current requirements demand.
- CODE-CS-KISS: Choose the simplest solution that correctly solves the problem; never add unnecessary complexity.
- CODE-CS-FAIL-FAST: Detect errors as early as possible and report them clearly; never silently continue in a broken state.
- CODE-CC-PREFER-IMMUTABLE: Design shared objects to be immutable after construction so they require no synchronization to be thread-safe.
- GOF-COMPOSITION-OVER-INHERITANCE: Favour object composition over inheritance to keep classes focused and enable behaviour changes at runtime.
- GOF-PROGRAM-TO-INTERFACE: Declare all variables and parameters against abstract interfaces, never against concrete implementation types.