From enterprise-software-playbook
Pick the right in-process code pattern for a refactoring or extensibility need (GoF creational/structural/behavioral), and access implementation guides for specific patterns. Use as a decision workflow when unsure which pattern family fits, or go directly to pattern references when you already know. NOT for multi-service/distributed architecture (use architecture).
How this skill is triggered — by the user, by Claude, or both
Slash command
/enterprise-software-playbook:designThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Pick the simplest design that fits, then map it to a code pattern only if it buys you clear leverage (change isolation, testability, reuse, or performance).
references/behavioral/chain-of-responsibility.mdreferences/behavioral/command.mdreferences/behavioral/iterator.mdreferences/behavioral/mediator.mdreferences/behavioral/memento.mdreferences/behavioral/observer.mdreferences/behavioral/state.mdreferences/behavioral/strategy.mdreferences/behavioral/template-method.mdreferences/behavioral/visitor.mdreferences/creational/abstract-factory.mdreferences/creational/builder.mdreferences/creational/factory-method.mdreferences/creational/prototype.mdreferences/creational/singleton.mdreferences/patterns-behavioral.mdreferences/patterns-creational.mdreferences/patterns-structural.mdreferences/snippets/react.mdreferences/snippets/typescript.mdPick the simplest design that fits, then map it to a code pattern only if it buys you clear leverage (change isolation, testability, reuse, or performance).
In TypeScript systems, also watch for “complications” that patterns can accidentally amplify (hidden lifetimes, implicit throw, unchecked boundary data, cyclic deps). Prefer patterns that keep boundaries and ownership explicit.
If the main pressure is system-level (multiple services/processes, partial failures, retries/idempotency, sagas, event-driven architecture, domain boundaries), use architecture first; then come back here to pick any code patterns needed for the in-process implementation.
If you’re standardizing cross-cutting boundary behavior across multiple services, consider extracting the primitive into a shared package (see platform) so the pattern becomes a consistent “golden path” instead of copy/paste.
Monolith edge case: In a monolith, use design to isolate modules within the process (Facade for subsystem boundaries, Adapter for third-party libs, Strategy for swappable implementations). If the goal is decomposing the monolith into separate deployable units or defining service boundaries, start with architecture — then return here for the in-process patterns each new service needs.
Inputs: Archobs JSON — file coupling (xnbr, hubness), cluster leakage (required); architecture output (if exists); forecast lifecycle data (if wrapping external dep).
Outputs: Pattern selection with rationale, implementation sketch, trade-offs. Consumed by testing (test strategy), finish (verification).
Load archobs data (required): Run archobs show risks --format json and archobs show clusters --format json to get risk scores and coupling signals for the files under consideration. Use xnbr to identify files bridging multiple concerns, hubness to find fan-in bottlenecks, and cluster leakage to see where boundaries are porous. This data helps narrow the pattern choice — e.g., high xnbr suggests Facade or Strategy; high hubness suggests Mediator. If the artifacts do not exist, run archobs report --repo <path> --out .archobs --suggestions-provider rules and wait for it to complete before continuing.
Decide whether the context is scriptic vs systemic (short-lived script vs long-lived system). Set policies for boundary validation, error semantics, and ownership/lifetimes.
Restate the problem as: what varies and what must stay stable (API, data model, timing, performance). 2b. Pattern Longevity Check (conditional — run when the selected pattern wraps or isolates an external dependency):
intel forecast # lifecycle phase for the wrapped dependency
Decision mapping: See Lifecycle Decision Mapping — Design: Pattern Longevity for lifecycle phase → pattern adjustment tables and compound signal (archobs x forecast) implications.
Identify the main pressure:
Pick 1 primary pattern (avoid "pattern soup"). Add a 2nd only if it addresses a different pressure.
Stress-test the decision (if 2+ viable approaches exist; skip for single viable approach):
workflow orchestration), refine it instead of re-running.Validate with 2 examples: a "happy path" and a likely future change.
Confirm the choice reduces coupling and increases testability (or has a clear perf win).
When context or time is constrained, these are the load-bearing steps:
Steps that can be cut under pressure: pattern longevity check (step 2b), stress-test probes (step 5), scriptic/systemic policy decision (step 1).
unknown and how will it be decoded?Result/tagged unions)?AbortSignal) or long-running “agents”?architecture), not in-process (design).archobsarchitectureplatformtypescript../references/ (checklists for inline probes, templates for escalation)When you need implementation details for a specific pattern:
references/patterns-creational.mdreferences/patterns-structural.mdreferences/patterns-behavioral.mdreferences/creational/ (factory-method, abstract-factory, builder, prototype, singleton)references/structural/ (adapter, bridge, composite, decorator, facade, flyweight, proxy)references/behavioral/ (chain-of-responsibility, command, iterator, mediator, memento, observer, state, strategy, template-method, visitor)references/snippets/typescript.mdreferences/snippets/react.mdWhen recommending a pattern, return:
npx claudepluginhub bricerising/enterprise-software-playbook --plugin enterprise-software-playbookGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.