naming-conventions

Naming rules for a Godot 4 game written mainly in C#. Godot is a game engine, and these rules explain how to name classes, scenes, nodes, scripts, and user-interface code.

In plain words
What is it for?
Use them when creating or renaming Godot C# classes, scene files, UI scripts, managers, commands, and related game components.
Why use it?
They make existing and new game code easier to understand by showing each item’s role from its name and keeping naming consistent.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/yoruto/prd-kit/naming-conventions
Clone the repo
git clone --depth 1 https://github.com/Yoruto/prd-kit
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,142 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02142
Opus 5 $0.00000 $0.01071
Sonnet 5 $0.00000 $0.00428
Haiku 4.5 $0.00000 $0.00214

Measured 2d ago against content hash 7debd9dd5dca, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

naming-conventions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

examples/godot-csharp/naming-conventions.mdc · 195 lines

How it starts

The opening of the file, as written. The whole thing — 195 lines — stays where its author put it; the contents beside it link to each section on GitHub.

命名规范

prd-kit 说明:本文件为可选 Stack Profile。请与 framework.mdc 及核心规则 00-prd-kit.mdcprd-workflow.mdc 一并使用。以下「存量 / 本仓库」指采用此 profile 的目标游戏项目,路径请按你仓库实际调整。

游戏与场景逻辑使用 C#,命名统一为 C# 风格addons/** 下的 GDScript 插件可沿用 Godot 惯用写法;本文件以 C# 规则为主,插件脚本见文末简短对照。

存量与目标: 下列规则为 目标规范。仓库中已有文件名或符号(如 ToolUIEnums.Tool)若不一致,后续重构对齐,新代码应优先符合本文件。


1. 类型、类、场景、节点 — PascalCase

类、脚本类名、场景资源、场景树节点均使用 PascalCase

public partial class Player : CharacterBody2D
{
    // 场景中节点命名应有意义,避免保留默认泛名
    // 好: GetNode<ProgressBar>("HealthBar")
    // 差: GetNode<Sprite2D>("Sprite2D") — 应改为语义化名称
}

场景文件:Player.tscn,而非 player.tscn


2. UI 脚本 — 目标后缀 View

任何直接依赖 Godot UI 控件ControlPanelVBoxContainerButtonLabel 等)的脚本,目标命名为 *View

目标命名 存量 / 待重命名示例
ShopView ShopUI
ToolView ToolUI
ResourceView ResourceUI
PlantInfoView PlantInfo
DialogView Dialog
FishingGameView FishingGame(含 UI 逻辑时)
ShopButtonView ShopButton(若主要为 UI 控件逻辑)

非 View 的 UI 相关类型保留原后缀:

UIManager       — 管理器
OpenViewCommand — 命令

3. 脚本用途后缀(C#)

每个类型名使用且仅使用一种后缀,便于从文件名识别职责:

后缀 用途 示例
View 依赖 UI 节点的场景脚本 ShopViewBagView
Manager 子系统管理 UIManagerSaveManager
Command 单一用户动作 OpenViewCommand
Data 配置或纯数据 ItemDataPlantData
Resource / Res 自定义 Resource 子类 PlantResource(与项目现有 PlantResource.cs 一致时可优先 Resource
Service 领域服务 WeatherService
Controller 输入或流程控制 Player 可与 Controller 组合命名视项目习惯
Component 可复用行为节点脚本 HealthComponent
State 状态机状态 FishingState
System Autoload / 全局入口 EventSystem
Factory 创建逻辑 ItemFactory
Helper 静态工具 MathHelper

不要混用多个后缀(例如 ShopViewManager)。


4. 常量 — C_ 前缀 + 可读形式

目标(C#): 使用前缀 C 后接 PascalCase 片段,表达清晰且避免全大写下划线与常规 C# 公共常量风格冲突过大:

Read the full file on GitHub · 195 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 195 lines · 0 tokens per session scan A 7debd9dd5dca

Subscribe to this mod's changes

naming-conventions is a cursor rule published in the GitHub repository Yoruto/prd-kit (2 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,142 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.