Claude Code Plugins

Community-maintained marketplace

Feedback

patterns/state-machine

@mgreenly/ikigai
1
0

State Machine Pattern pattern for C development

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name patterns/state-machine
description State Machine Pattern pattern for C development

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.