From silver-bullet
Enforces DRY design, single-source-of-truth, composable abstractions, and consumer-friendly APIs during planning and review.
How this agent operates — its isolation, permissions, and tool access model
Agent reference
silver-bullet:agents/cursor/reusability/skillThe summary Claude sees when deciding whether to delegate to this agent
Every design, plan, and implementation MUST produce components that are written once and reused everywhere applicable. Duplication is a bug — not in logic, but in design. **Why this matters:** Duplicated logic drifts over time. When the same concept lives in two places, one gets updated and the other doesn't — causing subtle bugs that are hard to trace. Reusable design prevents this by ensuring...
Every design, plan, and implementation MUST produce components that are written once and reused everywhere applicable. Duplication is a bug — not in logic, but in design.
Why this matters: Duplicated logic drifts over time. When the same concept lives in two places, one gets updated and the other doesn't — causing subtle bugs that are hard to trace. Reusable design prevents this by ensuring every concept has exactly one authoritative implementation.
When to invoke: During PLANNING (after /silver:context, before /silver:plan) and during REVIEW (as part of code review criteria). This skill applies to both new code and modifications to existing code.
Every piece of knowledge — business rule, algorithm, configuration value, validation logic — MUST have exactly ONE authoritative representation in the system.
| Violation | Fix |
|---|---|
| Same validation in frontend and backend | Shared schema (JSON Schema, Zod, Protobuf) or single validation layer |
| Same constant in multiple files | Extract to a shared constants module |
| Same SQL query in multiple handlers | Extract to a repository/query module |
| Same error message in multiple places | Extract to an error catalog |
Test: Search the codebase for the concept. If it appears in more than one place with substantively identical logic, it violates this rule.
Prefer composition over inheritance for code reuse. Inheritance creates tight coupling between parent and child — changes to the parent ripple unpredictably.
Before writing a reusable component:
If you can't explain how to use it in 3 lines of code, it's too complex for reuse — simplify.
Not everything should be reused. Premature abstraction is worse than duplication.
| Count | Action |
|---|---|
| 1 occurrence | Just write it inline. No abstraction. |
| 2 occurrences | Note the duplication. Consider extracting if the logic is identical. |
| 3+ occurrences | Extract to a shared module. The pattern is confirmed. |
The Rule of Three: Wait for the third occurrence before extracting. Two similar things might diverge; three similar things are a pattern.
When a variation of existing behavior is needed:
If the variation is too different to parameterize cleanly (>30% different logic paths), it's a new component — not a variant.
Reusable code must live at the right level:
| Scope | Location | Example |
|---|---|---|
| Within a feature | Feature's shared/ or utils/ | Feature-specific helpers |
| Across features | Project-level lib/ or shared/ | Common business logic |
| Across projects | Published package/library | Generic utilities, SDK clients |
Never import from another feature's internals. If two features need the same thing, extract it to a shared location.
Every reusable component MUST have:
If it's not documented, it won't be reused — it will be reimplemented.
Before finalizing any design or plan, run the Reusability Checklist:
If any item fails: redesign before proceeding to implementation.
As you write code:
Verify these as part of every code review:
If existing code violates these rules:
| Pattern | Problem | Fix |
|---|---|---|
| Copy-paste programming | Drift between copies, bugs fixed in one not others | Extract shared component |
| God utility file | Grabs bag of unrelated functions | Split by domain |
| Premature abstraction | Abstraction for 1 use case, overly generic | Wait for Rule of Three |
| Leaky abstraction | Consumer must know internals to use correctly | Redesign the interface |
| Not-invented-here | Rewriting what a dependency already provides | Use the dependency |
| Over-parameterization | 15 options where 3 suffice | Separate components for distinct use cases |
| Excuse | Reality |
|---|---|
| "It's faster to just copy it" | Faster now, 10x slower to debug drift later. |
| "They're almost the same but slightly different" | Parameterize the difference. |
| "I'll consolidate later" | You won't. Extract now. |
| "This is too specific to reuse" | If it exists 3+ times, it's not specific. |
| "Adding parameters makes it complex" | Complex is better than duplicated. |
| "The other team owns that code" | Extract to shared, or coordinate. Don't duplicate. |
npx claudepluginhub alo-exp/silver-bullet --plugin silver-bulletExpert Go code reviewer that analyzes diffs, runs go vet and staticcheck, and checks for idiomatic Go, concurrency bugs, error handling, and security issues.