framework

A project rulebook for building Godot 4 games with C#. It describes how to organize game code into layers, such as screens, UI state, and shared services, and how parts of the game communicate through events.

In plain words
What is it for?
It is for guiding the architecture and naming of Godot game projects, especially their C# gameplay code and user interfaces.
Why use it?
It gives the project a consistent structure, making it easier to know where code belongs and how UI and game systems should interact.

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/framework
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 5,206 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.05206
Opus 5 $0.00000 $0.02603
Sonnet 5 $0.00000 $0.01041
Haiku 4.5 $0.00000 $0.00521

Measured yesterday against content hash 670113ef647d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

framework 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 yesterday.

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/framework.mdc · 726 lines

How it starts

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

项目架构框架

prd-kit 说明:本文件为可选 Stack Profile。请与核心规则 00-prd-kit.mdcprd-workflow.mdc 一并放入 .cursor/rules/;将下列示例中的命名空间 YourGame 换成你的程序集/根命名空间。

与 PRD 联动:用户 @docs/prd/ 或说明「按 PRD 实现」时,须同时遵守本文件与 naming-conventions.mdc;总规则见 00-prd-kit.mdc,工作流见 prd-workflow.mdc

语言与范围

  • 业务与场景脚本 默认 C#(Godot .NET,以你项目中的 .csproj / 文档中声明的 Godot 版本为准)。
  • addons/** 下可为 GDScript(第三方或自研插件);本规范不以 GDScript 作为游戏逻辑示例来源
  • addons/gd_data_bindingGDScript 插件,其 BindingSource 与 C# 游戏脚本 无直接混用;C# UI 以 信号、GetNode、手动更新控件 为主。若日后从 C# 接入专用绑定方案,再单独增补规范章节。

架构总览

项目采用 分层 + 事件驱动 架构,核心分为四层:

┌──────────────────────────────────────────────┐
│                 View 层                       │
│   (UI 展示、用户输入、Godot 节点引用)           │
│   ├── BagView.cs                              │
│   └── ShopView.cs                             │
├──────────────────────────────────────────────┤
│               ViewModel 层                    │
│   (UI 状态数据、POCO 或 RefCounted,           │
│    不依赖 Godot UI 节点)                       │
│   ├── BagViewModel.cs                         │
│   └── ShopViewModel.cs                        │
├──────────────────────────────────────────────┤
│              Manager / Model 层               │
│   (业务数据、游戏逻辑、全局单例)                │
│   ├── BagManager                              │
│   ├── ItemManager                             │
│   └── CharacterManager                        │
├──────────────────────────────────────────────┤
│               基础设施层                       │
│   ├── ServiceLocator(全局服务定位器)         │
│   ├── EventDispatcher(全局事件系统)          │
│   ├── CommandExecutor(命令执行器)            │
│   ├── SceneManager(场景管理)                │
│   ├── ObjectPool(对象池)                    │
│   └── UIManager(UI 生命周期管理)             │
└──────────────────────────────────────────────┘

数据流向:

View 按钮点击 → View 调用 Command → Manager 处理数据 → 发 Event →
ViewModel 更新状态 → View 订阅事件或调用 Refresh 方法 → 控件刷新

(可选:View 直接监听 Manager 发出的 [Signal],按模块复杂度选择,避免过度耦合即可。)

Read the full file on GitHub · 726 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. yesterday First seen · 726 lines · 0 tokens per session scan A 670113ef647d

Subscribe to this mod's changes

framework 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 5,206 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.