Skip to content
Back to skills

New Script

ASecurity

Scaffold a new Unity C# script under unity/Assets/Scripts/ following the project's conventions (SerializeField, headers, no per-frame allocations), and explain exactly which GameObject to attach it to. Use when creating any new MonoBehaviour, ScriptableObject, or utility class.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 26, 2026
ai-agentsgoc#

Security analysis

A100/100

Scanned October 26, 2026

npx -y skills add Faaz17/Agents-and-Skills --skill new-script --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of New Script?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for New Script
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/faaz17-new-script/badge)](https://www.skillsdirectory.com/skills/faaz17-new-script)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: new-script
description: Scaffold a new Unity C# script under unity/Assets/Scripts/ following the project's conventions (SerializeField, headers, no per-frame allocations), and explain exactly which GameObject to attach it to. Use when creating any new MonoBehaviour, ScriptableObject, or utility class.
---

# /new-script — Unity C# Script Scaffold

Create a new C# script that follows `.claude/rules/tech_defaults.md` exactly, and — because the user is a Unity beginner — always explain where it goes and how to wire it up.

## Steps

1. Ask (or infer from context): class name, feature area (Flood / Weather / XR / UI), and what it should do.
2. Confirm the Unity project exists (`unity/Assets/` present). If not, stop — scripts have nowhere to live before Phase 0's Unity project is created.
3. Create the file at `unity/Assets/Scripts/<Feature>/<ClassName>.cs`. Filename **must** match the class name.
4. Follow the template and conventions below.
5. Tell the user, step by step: which GameObject to attach it to, which Inspector fields to fill in, and what they should *see* when they press Play (the eye-verification step).

## Template

```csharp
using System.Collections;

using UnityEngine;

/// <summary>
/// One sentence: what this component does and what it attaches to.
/// </summary>
public class ClassName : MonoBehaviour
{
    [Header("Settings")]
    [SerializeField] private float exampleValue = 1f;

    [Header("References")]
    [SerializeField] private Transform exampleTarget;

    private void Awake()
    {
        // Cache components here — never GetComponent<X>() in Update().
    }

    private void Update()
    {
        // No allocations here: no `new`, no LINQ, no string concat, no Find().
    }
}
```

## Convention checklist (enforce all of these)

- `[SerializeField] private` for Inspector-exposed fields — never bare `public` fields.
- PascalCase class/methods, camelCase fields. One class per file.
- `using` groups: System / UnityEngine / third-party / project — blank-line separated.
- `[Header("...")]` groups in the Inspector.
- No magic numbers — extract to a serialized field or `const`.
- Coroutines need `using System.Collections;` (`IEnumerator`, non-generic).
- Event subscriptions in `Awake()`/`OnEnable()` get mirrored unsubscriptions in `OnDestroy()`/`OnDisable()`.
- Network calls (Phase 4): coroutine + `UnityWebRequest`, never blocking the main thread.

## After creating

Remind the user: **a script does nothing until attached to a GameObject** — and the scene must be saved (Ctrl+S) afterwards.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.