360 Secure SkillHub
360 安全技能中心

roblox-architecture

面向 Roblox 项目的架构决策指南,帮助确定功能归属与权威状态、选择最小依赖形态、规划启动与拆解顺序、划分客户端-服务器职责边界,并给出 ECS 等替代方案的适用条件与结构审查要点。

TabooHarmony
热度 0.00
最近更新 2026-10-18 22:40:27
分类:开发依赖:纯提示词应用场景:代码审查 / 概念解释

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add tabooharmony/roblox-brain/roblox-architecture
Metadata
name
roblox-architecture
description
Use when adding, moving, refactoring, or reviewing Roblox feature ownership, code layout, dependencies, startup, or client-server boundaries.
when_to_use
Also when deciding where code goes, splitting a large script, fixing load-order or require cycles, untangling services/controllers, or auditing project structure.
last_reviewed
"2026-10-14T00:00:00.000Z"
sources
["https://create.roblox.com/docs/projects/data-model","https://create.roblox.com/docs/projects/client-server","https://create.roblox.com/docs/scripting/locations","https://create.roblox.com/docs/scripting/security/access-control","https://create.roblox.com/docs/reference/engine/classes/CollectionService","https://raw.githubusercontent.com/Ukendio/jecs/v0.11.0/README.md","original"]

Roblox Architecture

When to Load

Load for ownership, integration, boundaries, startup, or module splits.

Quick Reference

Reuse proven project modules before rebuilding; inspect contracts and failure/cleanup paths. Integration workflow: full.md.

Start from one owner

For each behavior, name:

  • authoritative state and who may mutate it;
  • public operations and callers;
  • Roblox instances, connections, and tasks it owns;
  • persistence or network boundary;
  • startup and teardown conditions.

Group by feature when that keeps one change together. Split server, client, and shared code only where the runtime boundary requires it. Shared code has no secrets or authoritative mutable state.

Use the smallest dependency shape

Direct module calls are the default. Use a signal only when one publisher has genuinely independent observers. Do not add an event bus, dependency container, manager class, or Init/Start ceremony to hide an ordinary dependency.

Keep module top-level work cheap and non-yielding. A small bootstrap owns startup that needs ordering; call it sequentially and fail visibly. Concurrency must be explicit and safe, not automatic task.spawn everywhere.

Bound WaitForChild when a dependency arrives through replication; an unbounded wait turns a missing instance into a silent hang.

Enforce runtime authority

The client presents and predicts; the server validates and decides. Remotes are APIs with types, bounds, ownership, abuse controls, and failure behavior. Route details to roblox-networking and roblox-security.

Split only for evidence

Split when there is a separate lifecycle or authority boundary, a distinct persistence contract, an independently testable pure core, or unrelated reasons to change.

Data-oriented alternative: only on evidence

An ECS earns its cost only when many similar entities update every frame by order-independent logic, or cross-cutting queries replace tangled per-entity scripts; hooks enforce invariants, ordered systems decide. Version-specific pitfalls: full.md "ECS on Roblox".

Review

One canonical owner per mutation, no hidden startup yield or replicated trust decision, explicit cleanup, smallest traceable structure. Tags are discovery, attributes configuration, one owner for attach/remove cleanup.

Details: references/full.md