/ability-system
Use when building character abilities — Resource-based abilities with cost/cooldown/cast, buffs/debuffs, stat modifiers, gameplay tags, and HUD binding
$ npx -y skills add jame581/GodotPrompter --skill ability-system --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/ability-system
Context preview
The summary Claude sees to decide when to auto-load this skill.
Use when building character abilities — Resource-based abilities with cost/cooldown/cast, buffs/debuffs, stat modifiers, gameplay tags, and HUD binding
SKILL.md
ability-system.SKILL.mdname: ability-system
description: Use when building character abilities — Resource-based abilities with cost/cooldown/cast, buffs/debuffs, stat modifiers, gameplay tags, and HUD binding
Ability System
Build a data-driven ability system from Godot-native parts: abilities are `Resource`s, an `AbilityComponent` node owns and runs them, and effects/stats/tags compose on top. No third-party addon required.
> **Related skills:** **resource-pattern** for the `Resource` data containers, **component-system** for the component node pattern, **event-bus** for cross-system ability events, **state-machine** for caster states (e.g. casting/stunned), **hud-system** for cooldown UI.
---
1. Architecture overview
An ability system in Godot 4.x is built from three collaborating layers:
- **Data layer — `Ability` (Resource):** Each ability is a `Resource` subclass with exported fields (`ability_name`, `cost`, `cooldown`, `cast_time`) and two methods: `can_activate(caster) -> bool` to validate preconditions, and `activate(caster) -> void` to execute the effect. Storing abilities as Resources lets designers create and balance them in the Godot editor without touching code.
- **Behaviour layer — `AbilityComponent` (Node):** A single node added to any entity that should use abilities. It holds the granted ability set, enforces cost/cooldown, and drives the `Ability.activate()` call. Four signals keep the rest of the game informed without coupling: `ability_activated(ability)`, `ability_failed(ability, reason)`, `cooldown_started(ability, duration)`, and `cooldown_finished(ability)`. Grant new abilities at runtime with `grant(ability)` and trigger them with `try_activate(ability_name)`.
- **Effects layer — stat modifiers, buffs/debuffs, and gameplay tags:** Abilities can read from and write to a caster's `StatSet` (a Resource that owns a dictionary of named `StatModifier` entries) to apply temporary or permanent stat changes. A `GameplayTagContainer` node (a child of the caster) gates activation — for example, a "stunned" tag can prevent any ability from firing. These three deep-dives are covered in the reference documents:
- [Stat modifiers and StatSet](references/stat-modifiers.md)
- [Gameplay tags and conditions](references/tags-and-conditions.md)
- [HUD binding for cooldowns and resource bars](references/ui-binding.md)
**Core rule:** *Data in Resources, behavior in the component, communication via signals.*
This separation means an `Ability` resource carries no Node references and can be safely duplicated, saved, and loaded as any other Godot Resource. The `AbilityComponent` owns runtime state (cooldown timers, active ability set), keeping `Ability` resources stateless and reusable across multiple casters simultaneously.
---
2. Abilities (cost / cooldown / cast)
GDScript
# ability.gd
class_name Ability
extends Resource
@export var ability_name: String
@export var cost: float = 0.0
@export var cooldown: float = 1.0
@export var cast_time: float = 0.0
# Override in subclasses or compose via exported effect resources.
func can_activate(caster: Node) -> bool:
return true
func activate(caster: Node) -> void:
pass# ability_component.gd
class_name AbilityComponent
extends Node
signal ability_activated(ability: Ability)
signal ability_failed(ability: Ability, reason: String)
signal cooldown_started(ability: Ability, duration: float)
signal cooldown_finished(ability: Ability)
@export var resource_pool: float = 100.0
var _granted: Dictionary = {} # ability_name -> Ability
var _cooldowns: Dictionary = {} # ability_name -> seconds remaining
func grant(ability: Ability) -> void:
_granted[ability.ability_name] = ability
func _process(delta: float) -> void:
for name in _cooldowns.keys():
_cooldowns[name] -= delta
if _cooldowns[name] <= 0.0:
_cooldowns.erase(name)
if _granted.has(name):
cooldown_finished.emit(_granted[name])
func try_activate(ability_name: String) -> bool:
var ability: Ability = _granted.get(ability_name)
if ability == null:
return false
if _cooldowns.has(ability_name):
ability_failed.emit(ability, "on_cooldown")
return false
if resource_pool < ability.cost:
ability_failed.emit(ability, "insufficient_resource")
return false
if not ability.can_activate(get_parent()):
ability_failed.emit(ability, "conditions_unmet")
return false
resource_pool -= ability.cost
ability.activate(get_parent())
_cooldowns[ability_name] = ability.cooldown
cooldown_started.emit(ability, ability.cooldown)
ability_activated.emit(ability)
return trueC#
// Ability.cs
using Godot;
[GlobalClass]
public partial class Ability : Resource
{
[Export] public string AbilityName { get; set; } = "";
[Export] public float Cost { get; set; } = 0.0f;
[Export] public float Cooldown { get; set; } = 1.0f;
[Export] public float CastTime { get; set; } = 0.0f;
public virtual bool CanActivate(Node caster) => true;
public virtual void Activate(Node caster) { }
}// AbilityComponent.cs
using Godot;
using System.Collections.Generic;
public partial class AbilityComponent : Node
{
[Signal] public delegate void AbilityActivatedEventHandler(Ability ability);
[Signal] public delegate void AbilityFailedEventHandler(Ability ability, string reason);
[Signal] public delegate void CooldownStartedEventHandler(Ability ability, float duration);
[Signal] public delegate void CooldownFinishedEventHandler(Ability ability);
[Export] public float ResourcePool { get; set; } = 100.0f;
private readonly Dictionary<string, Ability> _granted = new();
private readonly Dictionary<string, float> _cooldowns = new();
public void Grant(Ability ability) => _granted[ability.AbilityName] = ability;
public override void _Process(doubleRead more
name: ability-system description: Use when building character abilities — Resource-based abilities with cost/cooldown/cast, buffs/debuffs, stat modifiers, gameplay tags, and HUD binding
Ability System
Build a data-driven ability system from Godot-native parts: abilities are `Resource`s, an `AbilityComponent` node owns and runs them, and effects/stats/tags compose on top. No third-party addon required.
> **Related skills:** **resource-pattern** for the `Resource` data containers, **component-system** for the component node pattern, **event-bus** for cross-system ability events, **state-machine** for caster states (e.g. casting/stunned), **hud-system** for cooldown UI.
---
1. Architecture overview
An ability system in Godot 4.x is built from three collaborating layers:
- **Data layer — `Ability` (Resource):** Each ability is a `Resource` subclass with exported fields (`ability_name`, `cost`, `cooldown`, `cast_time`) and two methods: `can_activate(caster) -> bool` to validate preconditions, and `activate(caster) -> void` to execute the effect. Storing abilities as Resources lets designers create and balance them in the Godot editor without touching code.
- **Behaviour layer — `AbilityComponent` (Node):** A single node added to any entity that should use abilities. It holds the granted ability set, enforces cost/cooldown, and drives the `Ability.activate()` call. Four signals keep the rest of the game informed without coupling: `ability_activated(ability)`, `ability_failed(ability, reason)`, `cooldown_started(ability, duration)`, and `cooldown_finished(ability)`. Grant new abilities at runtime with `grant(ability)` and trigger them with `try_activate(ability_name)`.
- **Effects layer — stat modifiers, buffs/debuffs, and gameplay tags:** Abilities can read from and write to a caster's `StatSet` (a Resource that owns a dictionary of named `StatModifier` entries) to apply temporary or permanent stat changes. A `GameplayTagContainer` node (a child of the caster) gates activation — for example, a "stunned" tag can prevent any ability from firing. These three deep-dives are covered in the reference documents:
- [Stat modifiers and StatSet](references/stat-modifiers.md)
- [Gameplay tags and conditions](references/tags-and-conditions.md)
- [HUD binding for cooldowns and resource bars](references/ui-binding.md)
**Core rule:** *Data in Resources, behavior in the component, communication via signals.*
This separation means an `Ability` resource carries no Node references and can be safely duplicated, saved, and loaded as any other Godot Resource. The `AbilityComponent` owns runtime state (cooldown timers, active ability set), keeping `Ability` resources stateless and reusable across multiple casters simultaneously.
---
2. Abilities (cost / cooldown / cast)
GDScript
# ability.gd
class_name Ability
extends Resource
@export var ability_name: String
@export var cost: float = 0.0
@export var cooldown: float = 1.0
@export var cast_time: float = 0.0
# Override in subclasses or compose via exported effect resources.
func can_activate(caster: Node) -> bool:
return true
func activate(caster: Node) -> void:
pass# ability_component.gd
class_name AbilityComponent
extends Node
signal ability_activated(ability: Ability)
signal ability_failed(ability: Ability, reason: String)
signal cooldown_started(ability: Ability, duration: float)
signal cooldown_finished(ability: Ability)
@export var resource_pool: float = 100.0
var _granted: Dictionary = {} # ability_name -> Ability
var _cooldowns: Dictionary = {} # ability_name -> seconds remaining
func grant(ability: Ability) -> void:
_granted[ability.ability_name] = ability
func _process(delta: float) -> void:
for name in _cooldowns.keys():
_cooldowns[name] -= delta
if _cooldowns[name] <= 0.0:
_cooldowns.erase(name)
if _granted.has(name):
cooldown_finished.emit(_granted[name])
func try_activate(ability_name: String) -> bool:
var ability: Ability = _granted.get(ability_name)
if ability == null:
return false
if _cooldowns.has(ability_name):
ability_failed.emit(ability, "on_cooldown")
return false
if resource_pool < ability.cost:
ability_failed.emit(ability, "insufficient_resource")
return false
if not ability.can_activate(get_parent()):
ability_failed.emit(ability, "conditions_unmet")
return false
resource_pool -= ability.cost
ability.activate(get_parent())
_cooldowns[ability_name] = ability.cooldown
cooldown_started.emit(ability, ability.cooldown)
ability_activated.emit(ability)
return trueC#
// Ability.cs
using Godot;
[GlobalClass]
public partial class Ability : Resource
{
[Export] public string AbilityName { get; set; } = "";
[Export] public float Cost { get; set; } = 0.0f;
[Export] public float Cooldown { get; set; } = 1.0f;
[Export] public float CastTime { get; set; } = 0.0f;
public virtual bool CanActivate(Node caster) => true;
public virtual void Activate(Node caster) { }
}// AbilityComponent.cs
using Godot;
using System.Collections.Generic;
public partial class AbilityComponent : Node
{
[Signal] public delegate void AbilityActivatedEventHandler(Ability ability);
[Signal] public delegate void AbilityFailedEventHandler(Ability ability, string reason);
[Signal] public delegate void CooldownStartedEventHandler(Ability ability, float duration);
[Signal] public delegate void CooldownFinishedEventHandler(Ability ability);
[Export] public float ResourcePool { get; set; } = 100.0f;
private readonly Dictionary<string, Ability> _granted = new();
private readonly Dictionary<string, float> _cooldowns = new();
public void Grant(Ability ability) => _granted[ability.AbilityName] = ability;
public override void _Process(doubleAgentic skills framework for Godot 4.x game development. Gives AI coding agents domain-specific expertise for GDScript and C# projects.
Other skills on godot-prompter.
- /authoring-godot-prompter-skills
Use when writing or editing a SKILL.md or an agent definition in this repo — required frontmatter, section ordering, and the GDScript-then-C# example convention.
Open skill - /releasing-godot-prompter
Use when cutting a GodotPrompter release or bumping its version — the version-bump sequence, tag-triggered workflow, and the marketplace manifests that must follow.
Open skill - /2d-essentials
Use when working with 2D-specific systems — TileMaps, parallax scrolling, 2D lights and shadows, canvas layers, particles 2D, custom drawing, and 2D meshes in Godot 4.3+
Open skill - /3d-essentials
Use when working with 3D-specific systems — materials, lighting, shadows, environment, global illumination, fog, LOD, occlusion culling, and decals in Godot 4.3+
Open skill - /addon-development
Use when creating Godot editor plugins — EditorPlugin, @tool scripts, custom inspectors, and dock panels
Open skill - /ai-navigation
Use when implementing AI movement — NavigationAgent2D/3D, steering behaviors, behavior trees, and patrol patterns
Open skill

