skills/design-patterns/behaviorals/pattern-chain-of-responsibility/SKILL.md
Teaches and applies the Chain of Responsibility behavioral design pattern — passing requests along a chain of handlers where each handler decides to process or forward. Trigger: When implementing request handling pipelines, middleware chains, or event propagation.
npx skillsauth add johnnystefan/test-saas-business pattern-chain-of-responsibilityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Enables the agent to pass requests along a chain of handlers. Each handler decides either to process the request or pass it to the next handler in the chain.
handle()) for all steps.next handler.interface Handler {
setNext(handler: Handler): Handler;
handle(request: string): string | null;
}
abstract class AbstractHandler implements Handler {
private nextHandler: Handler | null = null;
public setNext(handler: Handler): Handler {
this.nextHandler = handler;
return handler;
}
public handle(request: string): string | null {
if (this.nextHandler) return this.nextHandler.handle(request);
return null;
}
}
class AuthHandler extends AbstractHandler {
public handle(request: string): string | null {
if (request === 'unauthorized') return 'Auth: Access denied.';
return super.handle(request);
}
}
class ValidationHandler extends AbstractHandler {
public handle(request: string): string | null {
if (request === 'invalid') return 'Validation: Data invalid.';
return super.handle(request);
}
}
tools
Zustand 5 state management patterns. Trigger: When implementing client-side state with Zustand (stores, selectors, persist middleware, slices).
databases
Zod 4 schema validation patterns. Trigger: When creating or updating Zod v4 schemas for validation/parsing (forms, request payloads, adapters), including v3 -> v4 migration patterns.
development
Vitest unit testing patterns with React Testing Library. Trigger: When writing unit tests for React components, hooks, or utilities.
tools
Vite 8 (Rolldown-powered) build tool configuration, plugin API, SSR, and migration guide. Trigger: When working with vite.config.ts, Vite plugins, building libraries, or SSR apps with Vite.