conventions/programming_gd/code_standards.yaml
Natalie 3dc5a9b321 feat(conventions): codify lilith v0-v4 conventions (py/rust/gd + 7 general)
Mined the egirl->cocotte lineage + the prose agentic configs. Per-language
standards (py/rust/gd) and general conventions: service_architecture,
multi_agent_workflow, error_handling_logging, mcp_server_patterns,
naming_conventions, tenancy_patterns (draft), database_patterns. Captures the
canonical/latest where versions diverged. 14/14 lint:yaml-valid.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 08:42:44 -04:00

34 lines
1.6 KiB
YAML

apiVersion: conventions/v1
version: 0.1.0
updated: "2026-06-29"
name: code_standards
title: GDScript code standards
scope: gd
status: active
summary: Explicit static types everywhere, specific node types, EventBus for cross-system signals, scenes as skeletons, SRP scripts, observable errors. From v2 magic-civilization.
appliesTo: ["**/*.gd"]
rules:
- id: explicit_types
level: must
text: "Explicit type on every var (`var x: Type`); no bare `var x = v`, no inferred `:=`, no `Variant` escapes (except a typed EventBus payload)."
- id: specific_types
level: must
text: Use the specific type (`Node3D`, `AudioStreamPlayer`), never the general (`Node`). Typed arrays always (`Array[String]`, never bare `Array`).
- id: typed_signatures
level: must
text: Every function has typed params and a return type (`-> void` when none).
- id: refcounted_for_logic
level: should
text: "`RefCounted` for pure logic; `Node` only for scene-tree lifecycle. One script = one responsibility (no God Nodes)."
- id: signals
level: must
text: Cross-system communication goes through the EventBus autoload only; intra-tree parent↔child direct signals are fine.
- id: scenes_skeleton
level: should
text: ".tscn is structure/skeleton only; behavior is attached/wired at runtime in _ready()."
- id: observable_errors
level: must
text: "push_error()/push_warning() on failure paths; never silent returns or empty error handlers. Safe-cast with null check + log on mismatch."
- id: no_dead_code
level: must
text: "No `# TODO`, no `# gdlint:ignore`, no unused vars."