unity-csharp-editing
БесплатноБез исполняемых скриптовНе проверенSupports Unity C# script editing, searching, and refactoring. Enables TDD cycle code editing, symbol navigation, reference searching, and structured editing…
Об этом скилле
Unity C# Script Editing
A guide for efficient editing, searching, and refactoring of Unity C# scripts.
Quick Start
1. Initialize Code Index
On first use or when the index is outdated, build the index first:
// Check index status
mcp__unity-mcp-server__get_index_status()
// Build index (first time only, may take a few minutes)
mcp__unity-mcp-server__build_index()
2. Basic Reading Flow
// Get symbol list in file
mcp__unity-mcp-server__get_symbols({
path: "Assets/Scripts/Player.cs"
})
// Get specific symbol details
mcp__unity-mcp-server__find_symbol({
name: "PlayerController",
kind: "class",
exact: true
})
// Read code
mcp__unity-mcp-server__read({
path: "Assets/Scripts/Player.cs",
startLine: 10,
endLine: 50
})
3. Basic Editing Flow
// Small changes (within 80 characters) → snippet
mcp__unity-mcp-server__edit_snippet({
path: "Assets/Scripts/Player.cs",
instructions: [{
operation: "replace",
anchor: { type: "text", target: "if (health < 0)" },
newText: "if (health <= 0)"
}]
})
// Large changes (method body) → structured
mcp__unity-mcp-server__edit_structured({
path: "Assets/Scripts/Player.cs",
symbolName: "PlayerController/TakeDamage",
operation: "replace_body",
newText: "{\n health -= damage;\n OnDamaged?.Invoke(damage);\n}"
})
Core Concepts
Code Index
unity-mcp-server provides a code index via built-in C# LSP. Output is 5x more compact than standard tools, optimizing LLM context.
| Tool | Purpose | Comparison |
|---|---|---|
find_symbol |
Symbol search | 5x smaller output |
find_refs |
Reference search | 3x smaller output |
search |
Code search | Instant response |
namePath (Symbol Path)
Symbols are identified by hierarchical path within file:
// Simple class
PlayerController
// Nested member
PlayerController/TakeDamage
PlayerController/health
// Deep nesting
OuterClass/InnerClass/Method
Scope Specification
Narrow search scope for better performance:
assets- Assets/ onlypackages- Packages/ onlyembedded- Embedded packages onlyall- All scope (default)
Tool Selection Guide
80-Character Rule
The criterion for choosing an editing tool is "whether the diff is within 80 characters"
When to use edit_snippet
Condition: Diff within 80 characters, 1-2 line changes
// ✅ Remove null guard
{ operation: "delete", anchor: { type: "text", target: "if (x == null) return;\n" }}
// ✅ Minor condition fix
{ operation: "replace", anchor: { type: "text", target: "if (x > 10)" }, newText: "if (x > 20)" }
// ✅ Insert log statement
{ operation: "insert", anchor: { type: "text", target: "Process();\n" }, newText: "Debug.Log(\"Processing\");\n" }
When to use edit_structured
Condition: Method body replacement, class member addition
// ✅ Replace method body
{
symbolName: "Player/Move",
operation: "replace_body",
newText: "{\n transform.position += direction * speed * Time.deltaTime;\n}"
}
// ✅ Add member to class
{
symbolName: "Player",
operation: "insert_after",
newText: "\n private float _jumpForce = 5f;\n"
}
Decision Flowchart
Is the change within 80 characters?
├─ YES → edit_snippet
└─ NO → Is it entire method/property replacement?
├─ YES → edit_structured (replace_body)
└─ NO → Is it adding to class?
├─ YES → edit_structured (insert_after)
└─ NO → Split into multiple snippets
Common Workflows
TDD Cycle (RED-GREEN-REFACTOR)
1. RED: Write the test
// Create test file
mcp__unity-mcp-server__create_class({
path: "Assets/Tests/PlayerTests.cs",
className: "PlayerTests",
namespace: "Tests",
usings: "NUnit.Framework,UnityEngine"
})
// Add test method
mcp__unity-mcp-server__edit_structured({
path: "Assets/Tests/PlayerTests.cs",
symbolName: "PlayerTests",
operation: "insert_after",
newText: `
[Test]
public void TakeDamage_ReducesHealth()
{
var player = new Player(100);
player.TakeDamage(30);
Assert.AreEqual(70, player.Health);
}
`
})
2. GREEN: Minimal implementation
// Add implementation
mcp__unity-mcp-server__edit_structured({
path: "Assets/Scripts/Player.cs",
symbolName: "Player",
operation: "insert_after",
newText: `
public void TakeDamage(int damage)
{
Health -= damage;
}
`
})
3. REFACTOR: Improve code
// Check compilation state
mcp__unity-mcp-server__get_compilation_state({ includeMessages: true })
// Check impact before refactoring
mcp__unity-mcp-server__find_refs({
name: "TakeDamage",
container: "Player"
})
Create New Class
// 1. Create class file
mcp__unity-mcp-server__create_class({
path: "Assets/Scripts/Enemies/Enemy.cs",
className: "Enemy",
namespace: "Gam
Установить unity-csharp-editing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobFAQ
Что делает скилл unity-csharp-editing?
Supports Unity C# script editing, searching, and refactoring. Enables TDD cycle code editing, symbol navigation, reference searching, and structured editing. Use when: C# editing, script search, symbol search, refactoring, code indexing, class creation, method addition
Как установить скилл unity-csharp-editing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл unity-csharp-editing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic