一键导入
data-refactor
Analyze code for hardcoded values and extract them into data files (.tres resources, JSON configs). Combines analysis and extraction in one skill.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyze code for hardcoded values and extract them into data files (.tres resources, JSON configs). Combines analysis and extraction in one skill.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate and maintain a playable HTML/JS prototype from feature specs. Builds a persistent browser-based game sandbox that grows across sprints, letting you test mechanics and UI flows before committing to Godot implementation.
Orchestrate the full game development workflow — Phase 0 design pipeline, sprint cycles, lifecycle gates. Reads workflow state to ensure correct sequencing across sessions. Run this before starting any game development work.
End-to-end UI generation pipeline — generate art with Ludo MCP, build HTML mockup, push to Figma, pull interactive Make prototype back, and implement in Godot.
Generate a comprehensive Full Game Vision document capturing every mechanic, system, content layer, and feature across all lifecycle phases. Creates the master scope map that GDDs pull from.
Generate sprint-based implementation roadmaps with "Player can X" playable increments and per-agent breakdowns. Scales from prototype to production.
Generate detailed feature specifications with an optional idea refinement phase. Handles the full pipeline from vague idea to structured spec, using the project's feature spec template, GDD, and roadmap for context.
| name | data-refactor |
| description | Analyze code for hardcoded values and extract them into data files (.tres resources, JSON configs). Combines analysis and extraction in one skill. |
| domain | code-quality |
| type | refactorer |
| version | 1.0.0 |
| allowed-tools | ["Read","Write","Edit","Glob","Grep"] |
This skill analyzes GDScript code to identify hardcoded configuration data and extracts it into external data files. It operates in two modes: Analyze mode (scan and report) and Extract mode (create data files and refactor code).
| Field | Value |
|---|---|
| Assigned Agent | qa-docs |
| Sprint Phase | Phase C (QA) after 3+ features |
| Directory Scope | docs/data-analysis/ |
| Output Directory | docs/data-analysis/ (analysis), docs/refactoring/ (extraction) |
| Workflow Reference | See docs/agent-team-workflow.md |
Invoke this skill when the user:
Scan code for hardcoded values and produce a report. Triggered by:
Create data files and refactor scripts. Triggered by:
When neither mode is specified explicitly:
Data-driven design separates "what" (data) from "how" (code):
Hardcoded values that designers might want to tune:
# Bad -- hardcoded in script
const MAX_SPEED = 200.0
const BULLET_DAMAGE = 15
const FIRE_RATE = 0.2
var health = 100
Common balance data:
System-level settings:
Structured game content:
Magic numbers scattered in code:
# Bad -- magic numbers
velocity = velocity.move_toward(Vector2.ZERO, 500 * delta)
if distance < 150:
attack()
# Good -- named constants in a data file
# friction_deceleration: 500
# attack_range: 150
Definitely extract when you see:
const declarations with numeric values, direct numeric assignments in _ready(), exported variables with defaults, magic numbers in calculationsdocs/data-analysis/When to use: Type-safe data with Godot editor integration, inheritance/composition, per-instance configuration.
# Resource script: weapon_data.gd
class_name WeaponData
extends Resource
@export var weapon_name: String
@export var damage: int
@export var cooldown: float
@export var range: float
@export var projectile_scene: PackedScene
# Usage in weapon script
@export var weapon_data: WeaponData
func fire():
var damage = weapon_data.damage
Benefits: Type safety, editor property panel, drag-and-drop in editor, can reference other resources/scenes.
When to use: Simple key-value data, human-readable format, easy version control diffing, external tools.
{
"machine_gun": {
"damage": 5,
"fire_rate": 5.0,
"range": 300,
"projectile_speed": 500
}
}
# Loading in script
func _ready():
var file = FileAccess.open("res://data/weapons.json", FileAccess.READ)
var json = JSON.new()
json.parse(file.get_as_text())
weapons_data = json.data
file.close()
Benefits: Simple to edit, good for large datasets, easy to compare versions.
When to use: Complex data structures, code completion, shared constants/enums.
# data/weapon_stats.gd
class_name WeaponStats
extends Node
const WEAPONS = {
"machine_gun": {"damage": 5, "fire_rate": 5.0, "range": 300},
"railgun": {"damage": 100, "fire_rate": 0.5, "range": 600}
}
Benefits: No runtime parsing, type checking, enums and complex types, fast access.
When to use: INI-style settings, user preferences, simple key-value per section.
[player]
max_health = 100
movement_speed = 200
[weapons.machine_gun]
damage = 5
fire_rate = 5.0
Benefits: Built-in Godot support, good for settings, human-readable.
# Data-Driven Refactor Analysis
## Summary
- Scripts analyzed: X
- Hardcoded values found: X
- Recommended extractions: X
---
## Priority 1: Game Balance Data (High Value)
### Weapon Statistics
**Current state:** Hardcoded in N weapon scripts
**Problem:** Each weapon redefines damage/cooldown/range constants
**Duplication:** Same variable names across all weapons
**Current code example:**
[code snippet]
**Recommended approach:** Godot Resources (.tres)
**Effort:** Medium (2-3 hours)
---
## Priority 2: [Next Category]
[Same format]
---
## Quick Wins (Low Effort, High Value)
1. Player Stats -> ConfigFile (15 minutes)
2. VFX Settings -> GDScript Constants (10 minutes)
---
## Migration Priority Order
1. Weapon data -> Resources
2. Enemy data -> Resources
3. Wave progression -> JSON
4. System settings -> ConfigFile
5. UI constants -> Keep in code
## Overall Recommendation
[1-2 paragraph summary with concrete next steps]
Every analysis must be saved to a file in addition to being shown in chat.
File Location: docs/data-analysis/[scope]_data-analysis_[YYYY-MM-DD].md
Examples:
docs/data-analysis/weapon-system_data-analysis_2025-12-20.mddocs/data-analysis/full-project_data-analysis_2025-12-20.mdFile Naming Convention:
_data-analysis_[date] where date is YYYY-MM-DDReport Header (file only, not in chat):
---
analysis_date: YYYY-MM-DD
analyzed_files:
- path/to/script1.gd
- path/to/script2.gd
analyzer: Claude Code (data-refactor skill)
analysis_type: Data-Driven Design Opportunities
---
List available reports from docs/data-analysis/ and ask user to confirm which to execute. If invoked immediately after an analysis, use those findings directly.
Extract data extraction opportunities grouped by priority:
For each, identify: data to extract, recommended format, source files, target files, refactoring steps.
Before making ANY changes, show the user a plan listing:
Wait for user confirmation before proceeding.
Execute in phases, in order:
Phase 1: Create Directory Structure
Create data/ subdirectories as needed (weapons/, enemies/, waves/, balance/).
Phase 2: Create Resource Scripts (if using .tres)
Write Resource class definitions with @export properties, @export_group, and @export_range hints.
Example:
class_name WeaponData
extends Resource
@export_group("Identity")
@export var weapon_name: String = ""
@export_group("Combat Stats")
@export var damage: int = 10
@export_range(0.1, 10.0) var fire_rate: float = 1.0
@export_range(0, 1000) var range: float = 300.0
Phase 3: Create Data Files Generate .tres files, JSON files, or ConfigFile (.cfg) files with the extracted values.
Example .tres:
[gd_resource type="Resource" script_class="WeaponData" load_steps=2 format=3]
[ext_resource type="Script" path="res://scripts/resources/weapon_data.gd" id="1"]
[resource]
script = ExtResource("1")
weapon_name = "Machine Gun"
damage = 5
fire_rate = 5.0
range = 300.0
Phase 4: Refactor Source Scripts
@export or load() calls for data resourcesPhase 5: Validation
Save to docs/refactoring/[report-name]_execution_[YYYY-MM-DD].md with:
git status, git checkout -- [file], or full revert as neededValues do not match: Compare extracted values to original constants carefully before overwriting.
Resource files not loading: Check file paths, verify .tres format, ensure scripts can find resources.
Complete rollback needed: Use git to revert changes; original constants are preserved in git history.
Analyze mode:
Extract mode:
Combined flow:
Analyze mode:
docs/data-analysis/[scope]_data-analysis_[date].mdExtract mode:
docs/refactoring/