Agent skill
patterns/state-machine
State Machine Pattern pattern for C development
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/patternsstate-machine
SKILL.md
State Machine Pattern
Model system behavior as discrete states with defined transitions. Current state determines which actions are valid and what state comes next.
ikigai Application
Input parser: Tracks escape sequence state (normal, escape, CSI, etc.) to interpret terminal input bytes.
Streaming response: States like idle → requesting → streaming → complete → idle.
Implementation: Enum for states, switch or function pointer table for transitions:
typedef enum { STATE_IDLE, STATE_STREAMING, STATE_ERROR } stream_state_t;
REPL states: Input mode, scrolling mode, command mode.
Benefit: Complex input handling becomes manageable. Each state handles its valid inputs.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?