Establishes the global AI development config repo from scratch: - Chunk 1: repo skeleton, install.sh, statusline, deploy manifest - Chunk 2: core instructions (coding/git/testing), CLAUDE.md rewrite (always-on + content index two-tier model), docs restructure, 6 ADRs, ROADMAP.md, .gitkeep placeholders - Bootstrap skills in .claude/skills/ (to be catalogued and migrated to .agents/skills/ in Chunk 3) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
|