AgentSkillsCN

new-system

以管理脚本、资源及自动加载配置为基础,快速搭建全新的游戏系统(如战斗系统、物品库存系统、对话系统、存档与读取系统、音效系统、摄像机系统、任务系统等)。

SKILL.md
--- frontmatter
name: new-system
description: Scaffold a new game system (combat, inventory, dialogue, saveload, audio, camera, quest, etc.) with manager script, resources, and autoload setup.
argument-hint: <system-name> [details...]
disable-model-invocation: true

Create New Game System

Scaffold a complete game system for: $ARGUMENTS

Step 1 — Identify the System

Parse arguments to determine which system to create. Common JRPG systems:

SystemManager ScriptResourcesAutoload?Key Docs
combatcombat_manager.gdSkill, StatusEffectNophysics, animation, signals
inventoryinventory_manager.gdItemYesresources, autoloads, saving
dialoguedialogue_manager.gdDialogueLine, DialogueTreeYesresources, UI, RichTextLabel
save / save-loadsave_manager.gdYesiosaving_games, data_paths
audioaudio_manager.gdYesaudio_buses, audio_streams
cameracamera_controller.gdNoCamera2D class
questquest_manager.gdQuest, QuestObjectiveYesresources, signals, saving
stats / progressionstats_manager.gdCharacterStatsNoresources, signals
state-machinestate_machine.gdNoscripting, best_practices
inputinput_manager.gdYesinputs, InputEvent
scene-transitionscene_manager.gdYeschange_scenes_manually, scene_tree
partyparty_manager.gdPartyMemberYesresources, autoloads

Step 2 — Look Up Documentation (MANDATORY — do not skip)

You MUST complete ALL of these before writing any code:

  1. Call the godot-docs skill for the key classes this system uses:
    code
    activate_skill("godot-docs") # Look up [Node type], [Resource type], and [related classes] for building a [SYSTEM] system. I need properties, methods, signals, and patterns.
    
  2. Read the relevant best practices files:
    • docsbest-practices/03-autoloads-and-singletons.md (if autoload system)
    • docsbest-practices/02-signals-and-communication.md (for signal design)
    • docsbest-practices/04-resources-and-data.md (if system uses Resources)
    • docsbest-practices/07-state-machines.md (if state machine based)
  3. Read the relevant design doc from docs/game-design/ for game-specific requirements

Step 3 — Create Directory Structure

code
game/systems/<system_name>/
├── <system_name>_manager.gd    # Main manager script
├── resources/                   # Custom Resource scripts
│   ├── <resource_type>.gd      # Resource class definitions
│   └── ...
└── data/                        # Data files (optional)
    └── ...

Step 4 — Create the Manager Script

The manager is the central coordinator for the system. It should follow this pattern:

gdscript
class_name <SystemName>Manager
extends Node
## Manages the <system_name> system.
##
## <Extended description of what this system handles.>


# --- Signals ---

signal <system_event_happened>(params)


# --- Constants ---

const <RELEVANT_CONSTANT>: <type> = <value>


# --- Exports ---

@export var <config_property>: <type> = <default>


# --- State ---

var <internal_state>: <type> = <default>


# --- Lifecycle ---

func _ready() -> void:
	pass


# --- Public API ---

## <Description of what this method does.>
func <public_method>(params) -> <ReturnType>:
	pass


# --- Private Methods ---

func _<helper_method>(params) -> <ReturnType>:
	pass

Step 5 — Create Resource Scripts (if needed)

Custom Resource classes for system data:

gdscript
class_name <ResourceName>
extends Resource
## <Description of this resource type.>


@export var <property>: <type> = <default>

Step 6 — Register Autoload (if needed)

If the system should be an autoload singleton, tell the user to add it:

code
Project > Project Settings > Globals > Autoload
Path: res:/systems/<system_name>/<system_name>_manager.gd
Name: <SystemName>Manager

Or instruct them to add it to project.godot:

ini
[autoload]

<SystemName>Manager="*res:/systems/<system_name>/<system_name>_manager.gd"

Step 7 — Report

After creating files, report:

  1. Files created (with full paths)
  2. Public API surface (signals, public methods)
  3. Resources defined
  4. Whether autoload registration is needed
  5. Integration points (how other scripts should interact with this system)
  6. Suggested next steps