principles
2
总安装量
2
周安装量
#66662
全站排名
安装命令
npx skills add https://github.com/weegigs/claude-kitbash --skill principles
Agent 安装分布
opencode
2
gemini-cli
2
claude-code
2
github-copilot
2
codex
2
kimi-cli
2
Skill 文档
Code Quality Principles
These principles guide all code review and quality assessment. Each principle has detailed examples in both Rust and TypeScript.
Architecture
| Principle | Description |
|---|---|
@architecture |
Imperative shell, functional coreâseparate pure logic from I/O |
Design Principles
| Principle | Description |
|---|---|
@illegal-states |
Make illegal states unrepresentable via type design |
@single-responsibility |
One reason to change per unit |
@parse-dont-validate |
Validated types at boundaries |
@composition |
Prefer composition over inheritance |
@open-closed |
Open for extension, closed for modification |
@explicit-dependencies |
No hidden globals or implicit state |
@fail-fast |
Surface errors immediately with context |
@domain-errors |
Errors should be identifiable to allow action |
@immutability |
Const/readonly by default |
@no-stringly-typed |
Unions/enums over magic strings |
@happy-path |
Left-hand side is the happy path (Go style early returns) |
Code-Level Standards
- Clarity over brevity: Explicit, readable code over clever one-liners
- Reduce nesting: Use early returns to flatten conditionals
- Eliminate redundancy: Remove duplicate logic and dead code
- No workarounds: Fix root causes, never suppress lints without explicit approval
Testing Strategy
- Property-based testing for pure functionsâverify invariants across thousands of inputs
- Snapshot testing for complex data structuresâcatch unintended changes
- Integration tests for the imperative shellâverify I/O coordination
Review Checklist
When reviewing code, verify:
- Types prevent invalid states (no interacting boolean flags)
- Functions have single responsibility
- Validation happens at boundaries, not scattered throughout
- Dependencies are explicit (no hidden globals)
- Errors surface immediately with context
- Mutations are justified and isolated
- No magic strings where types would work
- No lint suppressions without explicit approval