# Decide Enum Vs State

> When to use enum vs state pattern. Complexity threshold.

- Skill: `attac-t/decide-enum-vs-state` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add attac-t/decide-enum-vs-state`
- Raw SKILL.md: https://api.skillmd.com/api/skills/attac-t/decide-enum-vs-state/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: attac-t (https://skillmd.com/u/attac-t)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/attac-t/decide-enum-vs-state

---


# Skill: Enum vs State

> "Enums are labels. States are behavior."

## The Decision

**Use Enum when:**
- Simple labels with no behavior
- 1-2 places check the value
- No state-specific logic

**Use State Pattern when:**
- State has behavior (methods, calculations)
- 3+ places check the same state
- Transitions have side effects

## The Heuristic

Ask: *"Does the state DO anything, or just BE something?"*

## The Quick Test

| Ask | Answer | Use |
|-----|--------|-----|
| Do I need methods on the state? | Yes | State Pattern |
| Are there 3+ places with `if ($status === ...)` | Yes | State Pattern |
| Do transitions trigger side effects? | Yes | State Pattern |
| Is it just a label for display? | Yes | Enum |

## Real-World Examples

See [examples.md](examples.md).

