AgentSkillsCN

create

根据自然语言描述,为Unity生成一套完整且具备生产质量的C#脚本。支持MonoBehaviour、ScriptableObject、接口、枚举以及静态实用工具。

SKILL.md
--- frontmatter
name: create
description: Generate a complete, production-quality C# script for Unity from a natural language description. Supports MonoBehaviours, ScriptableObjects, interfaces, enums, and static utilities.
allowed-tools: Bash, Read, Write, Edit, Glob, Grep
argument-hint: <script description, e.g. "third-person character controller with dodge roll">

Generate a Unity C# script based on: $ARGUMENTS

Process

  1. Determine script type — MonoBehaviour, ScriptableObject, interface, enum, static class, or system
  2. Read project CLAUDE.md for coding conventions, namespace patterns, folder structure
  3. Search existing scripts to match project style and avoid duplication
  4. Generate the script following Unity best practices:
    • Proper namespace and using statements
    • SerializeField for inspector-visible fields
    • Clear separation of Unity lifecycle methods
    • Event-driven architecture where appropriate
    • Null checks and defensive coding
    • XML documentation for public API
  5. Write the file to the appropriate project directory
  6. Validate via MCP recompile if available — check for errors
  7. Report what was created, where it was saved, and how to use it

Script Conventions

  • One class per file, filename matches class name
  • PascalCase for classes, methods, properties, events
  • camelCase for private fields (with underscore prefix if project convention)
  • SerializeField + private over public fields
  • Use [Header] and [Tooltip] attributes for inspector UX
  • Prefer composition over inheritance
  • Use events/delegates for decoupling