Object-oriented design principles including object calisthenics, dependency inversion, fail-fast error handling, feature envy detection, and intention-revealing naming. Triggers on: writing new classes or functions, refactoring, code review, 'clean up', method longer than 10 lines, feature envy, primitive obsession, deep nesting.
Professional object-oriented design patterns and principles for maintainable, well-structured code.
Comprehensive design guidance including:
Activates during code refactoring, design reviews, or architecture discussions.
❌ const service = new Service() (tight coupling)
✓ this.service.doWork() (injected dependency)
❌ value ?? backup ?? 'unknown' (silent fallback)
✓ if (!value) throw new Error(...) (explicit validation)
❌ data, utils, helpers, manager, processor
✓ Use domain-specific, intention-revealing names
Automatically applied during REFACTOR state:
TDD Process rules that implement these principles:
Use for design reviews, refactoring sessions, or architecture planning without TDD workflow.
// Feature envy, generic names, hard dependencies, silent fallbacks
class DataProcessor {
process(data: any): any {
const validator = new Validator() // Hard dependency
const result = data.value ?? 'unknown' // Silent fallback
return validator.process(result) // Feature envy
}
}
// Clear responsibilities, domain names, injected dependencies, fail-fast
class OrderTotalCalculator {
constructor(private taxCalculator: TaxCalculator) {} // Injected
calculateTotal(order: Order): Money {
if (!order.subtotal) {
throw new Error(
`Expected order.subtotal to exist, got ${order.subtotal}. ` +
`Order ID: ${order.id}`
)
}
return this.taxCalculator.applyTax(
order.subtotal,
order.taxRate
)
}
}
When reviewing code, verify:
anySome exceptions are acceptable:
Use judgment - principles serve quality, not dogma.
software-design-principles/
├── SKILL.md # Complete design principles guide
└── README.md # This file
Symlink to Claude skills directory:
ln -s /path/to/claude-skillz/software-design-principles ~/.claude/skills/software-design-principles
1.0.0
npx skills add NTCoding/software-design-principles下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer