implement-calculator-pattern

Installation
SKILL.md

Implement Calculator Pattern

One API for the client: Calculator::Factory.for(entity).calculate. The factory picks the strategy; NullService handles unknown variants safely.

Quick Reference

Component Responsibility
Factory Dispatch to correct service class via SERVICE_MAP; fall back to NullService
BaseService Guard with should_calculate?; delegate to compute_result
NullService Always returns nil safely — never raises
Concrete Override should_calculate? (add variant check on top of super) and compute_result

HARD-GATE

Tests Gate Implementation
Installs
33
GitHub Stars
3
First Seen
Jul 28, 2026