Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add thedivergentai/Game-Dev-Agentic-Skills --skill godot-state-machine-advanced -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/godot-state-machine-advanced/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/godot-state-machine-advanced/

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.

Similar skills

Everything for Game dev and 3D: Unity, Unreal, Godot, Blender →

From the same set50

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor