godot-state-machine-advanced — Claude Code skill: HSM and pushdown
A Godot skill for hierarchical finite state machines and pushdown automata: ready scripts for sub-states, state stacks and transition validation.
npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill godot-state-machine-advanced -a claude-codeWhat godot-state-machine-advanced does
The skill ships a set of GDScript files for complex character and AI behavior in Godot. You get a hierarchical base that forwards physics and input down to sub-states, a pushdown stack for interrupt overlays like pause or menus, a context object for passing data between states, a guard that blocks illegal transitions, an AnimationTree syncer, concurrent state machines, a loader that reads state definitions from .tres resources, a history logger and an auto-transition timer.
A decision tree maps the need to the machine: flat FSM, HSM, pushdown, concurrent or utility cost polling. The scripts are declared the source of truth, and copying inline samples is discouraged because an earlier body called exit() twice and dropped resume messages. For hierarchy, pushdown and guards you are told to read hsm_hierarchical_base.gd, hsm_pushdown_stack.gd and hsm_transition_guard.gd.
Depth is the hard limit. Nesting beyond three levels is called state spaghetti, and the skill points you toward a behavior tree or utility AI instead. Every push_state needs a matching pop_state or the stack overflows. The license is LGPL-3.0, so if you ship a closed-source game, check what that means before the code goes into a release build.
What it helps with
- split character movement into nested Move, Air and Attack states
- stack a pause or dialogue overlay on top of combat and resume it later
- block a transition that would break animation or timer logic
- pass health and parameters between states without global singletons
- keep state logic in sync with AnimationTree
Example prompts for the agent
- Build an HSM for the player: a base state with Move, Air and Attack children, forwarding physics to them
- Add a pushdown stack so the menu pauses combat and resumes with the is_resume flag
- Set up a guard that blocks the Dash transition while Stun is active
How to install godot-state-machine-advanced
1Skills CLI (Vercel)
npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill godot-state-machine-advanced -a claude-code2Manually: put the files in place
~/.claude/skills/godot-state-machine-advanced/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/godot-state-machine-advanced/
1Skills CLI (Vercel)
npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill godot-state-machine-advanced -a codex2Manually: put the files in place
.agents/skills/godot-state-machine-advanced/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill godot-state-machine-advanced -a cursor2Manually: put the files in place
.cursor/skills/godot-state-machine-advanced/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install thedivergentai/Game-Dev-Agentic-Skills godot-state-machine-advanced2Manually: put the files in place
.github/skills/godot-state-machine-advanced/SKILL.md1Skills CLI (Vercel)
npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill godot-state-machine-advanced -a gemini-cli2Platform CLI
gemini skills install https://github.com/thedivergentai/Game-Dev-Agentic-Skills --path skills/godot-state-machine-advancedManually: put the files in place
.devin/skills/godot-state-machine-advanced/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill godot-state-machine-advanced -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about godot-state-machine-advanced
How do I install godot-state-machine-advanced in Claude?
Run npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill godot-state-machine-advanced -a claude-code. The skill lands at ~/.claude/skills/godot-state-machine-advanced/SKILL.md.
What does godot-state-machine-advanced do?
It provides scripts for hierarchical finite state machines and pushdown automata in Godot: nested states, an interrupt stack, transition validation and context passing.
How is a pushdown automaton different from a plain FSM?
It pushes an interrupting state onto a stack and returns to the previous one with pop_state instead of resetting the machine. Resuming uses a message carrying the is_resume flag.