grill-with-docs, improve-codebase-architecture, tdd, and triage kept non-spec markdown files at their skill root, in violation of skill-audit's file-structure.md rule (only SKILL.md/README.md belong at the root; everything else lives in scripts/, references/, assets/ or tests/). A root-level file is invisible to the ADR-0020 dangling-reference gate, which only resolves unqualified `references/...` pointers. - Moved and renamed to lowercase-kebab-case under references/: grill-with-docs (ADR-FORMAT.md, CONTEXT-FORMAT.md), improve-codebase-architecture (DEEPENING.md, INTERFACE-DESIGN.md, LANGUAGE.md), tdd (five files, casing was already fine), triage (AGENT-BRIEF.md, OUT-OF-SCOPE.md). - Updated every in-skill link to the new references/ paths, including link text that still showed the old uppercase filenames. - Fixed improve-codebase-architecture/SKILL.md's cross-skill citation of grill-with-docs's two files to the sanctioned possessive form with the references/ segment included. - Updated all four skills' README.md file tables to match. - Regenerated the flat content mirror via scripts/sync-plugin-content.sh --all. Fixes #122. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PDj6F7SPXzh3FtPN78dZ88
32 lines
653 B
Markdown
32 lines
653 B
Markdown
# Interface Design for Testability
|
|
|
|
Good interfaces make testing natural:
|
|
|
|
1. **Accept dependencies, don't create them**
|
|
|
|
```typescript
|
|
// Testable
|
|
function processOrder(order, paymentGateway) {}
|
|
|
|
// Hard to test
|
|
function processOrder(order) {
|
|
const gateway = new StripeGateway();
|
|
}
|
|
```
|
|
|
|
2. **Return results, don't produce side effects**
|
|
|
|
```typescript
|
|
// Testable
|
|
function calculateDiscount(cart): Discount {}
|
|
|
|
// Hard to test
|
|
function applyDiscount(cart): void {
|
|
cart.total -= discount;
|
|
}
|
|
```
|
|
|
|
3. **Small surface area**
|
|
- Fewer methods = fewer tests needed
|
|
- Fewer params = simpler test setup
|