# Patterns/chain Of Responsibility

> Chain of Responsibility Pattern pattern for C development

- Skill: `majiayu000/patterns-chain-of-responsibility` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add majiayu000/patterns-chain-of-responsibility`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/patterns-chain-of-responsibility/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/patterns-chain-of-responsibility

---


# Chain of Responsibility Pattern

Pass request along a chain of handlers until one handles it. Each handler decides to process or pass to next. In C, linked list of handler functions.

## ikigai Application

**Input processing:** Bytes flow through: escape sequence detector → UTF-8 assembler → action mapper → REPL handler.

**Command dispatch:** Try slash command handlers in order until one matches.

**Future uses:**
- Middleware for tool execution (auth, logging, rate limiting)
- Message preprocessing pipeline
- Error recovery chain

**Implementation:**
```c
typedef res_t (*handler_fn)(void *ctx, request_t *req, handler_fn next);
```

**Benefit:** Add/remove processing steps without modifying existing handlers.

