Skip to content

77 game-dev skills for AI coding agents — Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox. Portable SKILL.md Agent Skills (the format Anthropic launched as Claude Skills), with a router that loads the right skill for your engine and task. Runs in Claude Code, Cursor, Kiro, Codex, Copilot, Gemini CLI and more.

feat(other-engines): add Bevy, pygame, and Roblox skills

AbhishekBarali17ad887bf06ed
diff --git a/skills/other-engines/bevy-ecs/SKILL.md b/skills/other-engines/bevy-ecs/SKILL.md
new file mode 100644
index 0000000..24e1be2
--- /dev/null
+++ b/skills/other-engines/bevy-ecs/SKILL.md
@@ -0,0 +1,208 @@
+---
+name: bevy-ecs
+description: >
+ Structure a Bevy app around its Entity Component System: build the App with
+ plugins, define Component/Resource types, write systems with Query/Res/Commands,
+ filter and order systems, and use the Time resource for frame-rate-independent
+ motion. Use when building or debugging a Bevy game in Rust — when the user
+ mentions Bevy, ECS, App::new, add_systems, Query, Commands, components/systems,
+ or a Cargo.toml depending on bevy.
+license: Apache-2.0
+compatibility: Bevy 0.16+ (Rust; ECS API verified through 0.19)
+metadata:
+ engine: bevy
+ category: other-engines
+ difficulty: advanced
+---
+
+# Bevy ECS
+
+Structure a Bevy game in Rust around the Entity Component System: the `App` and
+plugins, components and resources, systems with queries, scheduling, and
+frame-rate-independent updates. Pins **Bevy 0.16+** (code verified against 0.19;
+Bevy moves fast — match your `Cargo.toml`).
+
+## When to use
+
+- Use when wiring a Bevy `App`, defining `Component`/`Resource` types, writing
+ systems that query entities, ordering/filtering systems, or fixing
+ borrow-conflict panics and frame-dependent movement.
+- Use when `Cargo.toml` depends on `bevy` and code calls `App::new()`,
+ `add_systems`, `Query`, or `Commands`.
+
+**When *not* to use:** this is the ECS core. Deep rendering, custom shaders/
+pipelines, UI layout, and audio are separate concerns. For engine-agnostic AI or
+procedural algorithms, pair with `game-ai` / `procedural-gen`.
+
+## Core workflow
+
+1. **Pin the version.** Bevy's API changes every minor release. Set
+ `bevy = "0.16"` (or your target) in `Cargo.toml` and treat the matching docs as
+ truth. Enable `dynamic_linking` in dev for faster iterative builds.
+2. **Build the `App`.** `App::new().add_plugins(DefaultPlugins)` gives windowing,
+ input, rendering, time, etc. Register systems into schedules: `Startup` (once)
+ and `Update` (every frame).
+3. **Model data as components, globals as resources.** `#[derive(Component)]` for
+ per-entity data; `#[derive(Resource)]` for one-of-a-kind data (score, settings,
+ the `Time` clock).
+4. **Write systems as plain functions.** Parameters declare data access: `Query<...>`
+ for entities, `Res<T>`/`ResMut<T>` for resources, `Commands` for deferred
+ spawn/despawn. Systems run in parallel when their accesses don't conflict.
+5. **Drive motion by `time.delta_secs()`** so speed is frame-rate independent.
+6. **Order only what must be ordered** with `.chain()` or explicit constraints;
+ gate systems with `run_if`. Group related setup into `Plugin`s. Build with
+ `cargo run` and read the panics — Bevy reports conflicting queries at startup.
+
+## Patterns
+
+### 1. Cargo.toml + minimal App
+
+```toml
+# Cargo.toml — pin the version; the API differs across minor releases.
+[dependencies]
+bevy = "0.16"
+# Dev-only: faster recompiles. (Add the matching dynamic linking setup per the book.)
+# bevy = { version = "0.16", features = ["dynamic_linking"] }
+```
+
+```rust
+// main.rs
+use bevy::prelude::*;
+
+fn main() {
+ App::new()
+ .add_plugins(DefaultPlugins) // window, input, render, time, ...
+ .add_systems(Startup, setup) // runs once at startup
+ .add_systems(Update, move_players) // runs every frame
+ .run();
+}
+```
+
+### 2. Components, resources, and spawning
+
+```rust
+#[derive(Component)]
+struct Player;
+
+#[derive(Component)]
+struct Velocity(Vec2);
+
+#[derive(Resource)]
+struct Score(u32);
+
+fn setup(mut commands: Commands) {
+ commands.insert_resource(Score(0));
+
+ // Camera2d is a component with required components (no *Bundle since 0.15);
+ // spawning it pulls in Transform, Camera, etc. automatically.
+ commands.spawn(Camera2d);
+
+ // Spawn an entity as a tuple of components.
+ commands.spawn((
+ Player,
+ Velocity(Vec2::new(150.0, 0.0)),
+ Transform::from_xyz(0.0, 0.0, 0.0),
+ ));
+}
+```
+
+### 3. A system with a query + the Time resource
+
+```rust
+// Iterate every entity that has BOTH Velocity and Transform; mutate Transform.
+fn move_players(time: Res<Time>, mut query: Query<(&Velocity, &mut Transform)>) {
+ for (velocity, mut transform) in &mut query {
+ // delta_secs() is f32 seconds (renamed from delta_seconds() in 0.16).
+ transform.translation += velocity.0.extend(0.0) * time.delta_secs();
+ }
+}
+```
+
+### 4. Query filters (With / Without / Changed)
+
+```rust
+// Only entities tagged Player (the Player component itself isn't read).
+fn aim_player(mut q: Query<&mut Transform, With<Player>>) { /* ... */ }
+
+// Disjoint two mutable Transform queries so they don't conflict at runtime.
+fn separate(
+ mut players: Query<&mut Transform, With<Player>>,
+ mut enemies: Query<&mut Transform, Without<Player>>,
+) { /* ... */ }
+
+// React only when Health changed since last run (change detection).
+fn on_health_change(q: Query<&Health, Changed<Health>>) {
+ for health in &q { /* update the HUD, etc. */ }
+}
+```
+
+### 5. Resources: read and write
+
+```rust
+fn add_points(mut score: ResMut<Score>) {
+ score.0 += 10; // ResMut = write access
+}
+
+fn show_score(score: Res<Score>) {
+ info!("score: {}", score.0); // Res = read access
+}
+```
+
+### 6. Ordering, run conditions, and plugins
+
+```rust
+fn main() {
+ App::new()
+ .add_plugins((DefaultPlugins, GameplayPlugin))
+ // .chain() forces order: damage resolves before death is checked.
+ .add_systems(Update, (apply_damage, check_deaths).chain())
+ // run_if gates a system on a condition each frame.
+ .add_systems(Update, spawn_wave.run_if(wave_timer_finished))
+ .run();
+}
+
+struct GameplayPlugin;
+impl Plugin for GameplayPlugin {
+ fn build(&self, app: &mut App) {
+ app.insert_resource(Score(0))
+ .add_systems(Startup, setup)
+ .add_systems(Update, (move_players, add_points));
+ }
+}
+```
+
+## Pitfalls
+
+- **`delta_seconds()` not found** → it was renamed to `time.delta_secs()` (and
+ `elapsed_secs()`) in 0.16. Using the old name fails to compile.
+- **Movement speed scales with frame rate** → multiply per-frame changes by
+ `time.delta_secs()`. Never assume a fixed frame time.
+- **Panic: "conflicting accesses" / "&mut T and &mut T"** → two `Query`s in one
+ system both write the same component, or one reads while another writes overlapping
+ entities. Make them disjoint with `With`/`Without`, or use `ParamSet`.
+- **`Camera2dBundle`/`SpriteBundle` not found** → bundles were removed (0.15+).
+ Spawn the components directly (`Camera2d`, `Sprite`, `Transform`); required
+ components fill in the rest.
+- **"trait `Component` is not implemented"** → you forgot `#[derive(Component)]`
+ (or `#[derive(Resource)]` for a resource).
+- **Spawned entity not visible to a later query in the same frame** → `Commands` are
+ deferred and applied at the next sync point. Read the entity in a subsequent system,
+ not the one that spawned it.
+- **System order assumed but not enforced** → systems run in parallel by default.
+ If `B` must follow `A`, add `(A, B).chain()` or an explicit ordering constraint.
+- **Copy-pasting older Bevy snippets** → APIs shift between minor versions (e.g.
+ the buffered-event API was reworked after 0.16). Verify against the docs for
+ *your* pinned version; don't mix versions.
+
+## References
+
+- For schedules and `SystemSet` ordering, `States`/`OnEnter`/`OnExit`, change
+ detection, `Commands` lifecycle and sync points, `ParamSet` for conflicting
+ queries, and a version note on the events/observers API, read
+ `references/queries-and-scheduling.md`.
+
+## Related skills
+
+- `game-ai` — FSMs/behavior trees/steering as portable concepts to implement in ECS.
+- `procedural-gen` — noise/RNG/generation algorithms to drive from systems.
+- `pygame-core` / `love2d-core` — lighter-weight engines for smaller projects.
diff --git a/skills/other-engines/bevy-ecs/references/queries-and-scheduling.md b/skills/other-engines/bevy-ecs/references/queries-and-scheduling.md
new file mode 100644
index 0000000..b75cf92
--- /dev/null
+++ b/skills/other-engines/bevy-ecs/references/queries-and-scheduling.md
@@ -0,0 +1,160 @@
+# Bevy queries & scheduling detail (0.16+)
+
+Depth behind the ECS skill: query filters and access, schedules and ordering,
+states, change detection, and the `Commands` lifecycle. Verify any borderline API
+against the docs for your pinned Bevy version — minor releases move things.
+
+## Query anatomy
+
+A `Query<D, F>` has a **data** part `D` (what you read/write) and an optional
+**filter** part `F` (which entities, without fetching their data).
+
+```rust
+// Data: read Name, write Transform. Filter: must have Player, must NOT have Frozen.
+Query<(&Name, &mut Transform), (With<Player>, Without<Frozen>)>
+```
+
+Common filters:
+
+- `With<T>` / `Without<T>` — entity has / lacks a component (no data fetched).
+- `Added<T>` — `T` was added since this system last ran.
+- `Changed<T>` — `T` was added or mutably accessed since last run (change detection).
+- `Or<(...)>` — combine filters disjunctively.
+
+Optional and entity access in the data part:
+
+```rust
+Query<(Entity, &Transform, Option<&Velocity>)> // Entity id; Velocity may be absent
+```
+
+### Single-entity access
+
+For a query you expect to match exactly one entity (e.g. the player), `single()`
+and `single_mut()` return a `Result` in 0.16+ (they replaced the older
+`get_single`/panicking `single`):
+
+```rust
+fn read_player(q: Query<&Transform, With<Player>>) {
+ if let Ok(transform) = q.single() {
+ // exactly one Player matched
+ }
+}
+```
+
+Iterating with `for x in &query` is always valid and the safest default.
+
+## Avoiding conflicting access
+
+Two systems can run in parallel only if their data accesses don't conflict. Two
+queries **within one system** that both mutably touch the same component will panic
+at startup. Fixes:
+
+1. **Disjoint with filters** — `With<Player>` vs `Without<Player>` guarantees the
+ sets never overlap, so both can be `&mut`.
+2. **`ParamSet`** — when sets *can* overlap, access them one at a time:
+
+```rust
+fn swap(mut set: ParamSet<(
+ Query<&mut Transform, With<A>>,
+ Query<&mut Transform, With<B>>,
+)>) {
+ for mut t in &mut set.p0() { /* ... */ }
+ for mut t in &mut set.p1() { /* ... */ }
+}
+```
+
+## Schedules and ordering
+
+Built-in schedules you'll use most:
+
+- `Startup` — once, before the first `Update`.
+- `Update` — every frame.
+- `FixedUpdate` — fixed timestep; use it for physics/gameplay that needs
+ determinism (read `time.delta_secs()` here too; it's the fixed step).
+- `PreUpdate` / `PostUpdate` — around `Update` for setup/teardown ordering.
+
+Ordering within a schedule:
+
+```rust
+// Explicit pairwise order.
+app.add_systems(Update, (input, movement, collision).chain());
+
+// Named constraints.
+app.add_systems(Update, movement.before(collision));
+app.add_systems(Update, camera_follow.after(movement));
+```
+
+### System sets
+
+Group systems into a `SystemSet` to order whole phases and attach shared run
+conditions:
+
+```rust
+#[derive(SystemSet, Debug, Clone, PartialEq, Eq, Hash)]
+enum GameSet { Input, Logic, Render }
+
+app.configure_sets(Update, (GameSet::Input, GameSet::Logic, GameSet::Render).chain());
+app.add_systems(Update, read_input.in_set(GameSet::Input));
+app.add_systems(Update, (move_units, resolve).in_set(GameSet::Logic));
+```
+
+### Run conditions
+
+```rust
+app.add_systems(Update, pause_menu.run_if(in_state(AppState::Paused)));
+app.add_systems(Update, autosave.run_if(on_timer(Duration::from_secs(30))));
+```
+
+## States
+
+`States` model app-wide modes (menu, playing, paused). Use `OnEnter`/`OnExit`
+schedules for transition logic and `in_state` to gate `Update` systems.
+
+```rust
+#[derive(States, Default, Debug, Clone, PartialEq, Eq, Hash)]
+enum AppState { #[default] Menu, Playing }
+
+app.init_state::<AppState>()
+ .add_systems(OnEnter(AppState::Playing), spawn_level)
+ .add_systems(OnExit(AppState::Playing), cleanup_level)
+ .add_systems(Update, gameplay.run_if(in_state(AppState::Playing)));
+
+// Transition from a system:
+fn start(mut next: ResMut<NextState<AppState>>) { next.set(AppState::Playing); }
+```
+
+## Change detection
+
+`Changed<T>` / `Added<T>` filters and the `Ref<T>`/`Mut<T>` wrappers let systems
+react only to modified data — cheaper than recomputing every frame. Note: writing
+through a `&mut T` marks it changed even if the value is identical; guard with a
+value check if that matters.
+
+## Commands lifecycle
+
+`Commands` queue structural changes (spawn, despawn, insert/remove components,
+insert resources). They are **deferred** and applied at the next sync point
+(end of the schedule stage), so:
+
+- An entity spawned this frame is not in queries until a later system/stage.
+- `commands.entity(e).despawn()` removes the entity; in 0.16+ this also removes its
+ children (the old explicit `despawn_recursive` was folded in).
+
+```rust
+fn spawn_bullet(mut commands: Commands) {
+ let id = commands.spawn((Bullet, Transform::default())).id();
+ commands.entity(id).insert(Velocity(Vec2::Y * 500.0));
+}
+```
+
+For immediate, exclusive access to the whole `World` (one-off setup, complex
+queries), use an exclusive system `fn(&mut World)` — it can't run in parallel, so
+use sparingly.
+
+## Events / messages — version caution
+
+Bevy's buffered-event and observer APIs were reworked around 0.16→0.17 (including
+naming changes for buffered "messages" vs observer "events"). If you need
+event-style communication between systems, look up the exact `EventReader`/
+`EventWriter` (or message/observer) API for your pinned version rather than
+copying an example from a different release.
diff --git a/skills/other-engines/pygame-core/SKILL.md b/skills/other-engines/pygame-core/SKILL.md
new file mode 100644
index 0000000..9f0ecc7
--- /dev/null
+++ b/skills/other-engines/pygame-core/SKILL.md
@@ -0,0 +1,192 @@
+---
+name: pygame-core
+description: >
+ Structure a pygame (pygame-ce) game in Python: the init/event/update/draw loop,
+ delta-time movement, Surface/Rect blitting, keyboard/mouse input, and
+ Sprite/Group management with collision. Use when building or debugging a pygame
+ game — when the user mentions pygame, pygame-ce, the game loop, blit, Surface,
+ Rect, sprite groups, or clock.tick. Targets pygame-ce.
+license: Apache-2.0
+compatibility: pygame-ce 2.5+ (verified 2.5.7) / pygame 2.6; Python 3.10+
+metadata:
+ engine: pygame
+ category: other-engines
+ difficulty: beginner
+---
+
+# pygame Core
+
+Build the foundation of a pygame game in Python: the main loop, delta-time
+movement, drawing with `Surface`/`Rect`, input, and `Sprite`/`Group` management.
+Targets **pygame-ce 2.5+** (the actively maintained community fork; same
+`import pygame`).
+
+## When to use
+
+- Use when starting a pygame game, fixing the loop, frame-rate-dependent speed,
+ input handling, blitting, or sprite/group collision.
+- Use when code does `import pygame` and the project depends on `pygame-ce`
+ (or `pygame`).
+
+**When *not* to use:** Python language questions unrelated to pygame. 3D rendering
+(pygame is 2D). For cross-engine save/load use `save-systems`; for rebindable input
+architecture see `input-systems`.
+
+## Core workflow
+
+1. **Install pygame-ce, not legacy pygame.** `pip install pygame-ce` — it's the
+ maintained fork and imports as `pygame`. Don't install both in one environment.
+2. **Init and open a window.** `pygame.init()`, `screen =
+ pygame.display.set_mode((w, h))`, `clock = pygame.time.Clock()`.
+3. **Run one loop: events → update → draw → flip.** Pump the event queue every
+ frame (`for event in pygame.event.get()`), update state, redraw, then
+ `pygame.display.flip()`.
+4. **Make it frame-rate independent.** Get `dt = clock.tick(60) / 1000` (seconds)
+ and scale all motion by `dt`. Keep positions as floats; blit at integer rects.
+5. **Handle input two ways:** event-based (`KEYDOWN`/`MOUSEBUTTONDOWN`, for discrete
+ actions) and polled (`pygame.key.get_pressed()`, for held movement).
+6. **Organise objects with `Sprite` + `Group`.** Subclass `pygame.sprite.Sprite`
+ with `image`/`rect`; `group.update(dt)` and `group.draw(screen)` handle the
+ batch. Run it and watch the window before assuming it works.
+
+## Patterns
+
+### 1. Minimal game loop (the skeleton)
+
+```python
+import pygame
+
+pygame.init()
+screen = pygame.display.set_mode((800, 600))
+pygame.display.set_caption("My Game")
+clock = pygame.time.Clock()
+
+running = True
+while running:
+ dt = clock.tick(60) / 1000 # cap at 60 FPS; dt = seconds since last frame
+ for event in pygame.event.get(): # MUST drain the queue or the OS thinks it hung
+ if event.type == pygame.QUIT:
+ running = False
+
+ # update game state here, scaled by dt ...
+
+ screen.fill((18, 18, 28)) # clear each frame
+ # draw everything here ...
+ pygame.display.flip() # present the frame
+
+pygame.quit()
+```
+
+### 2. Delta-time movement (frame-rate independent)
+
+```python
+from pygame.math import Vector2
+
+pos = Vector2(100, 100) # keep position as floats
+speed = 220 # PIXELS PER SECOND, not per frame
+
+# inside the loop, after computing dt:
+keys = pygame.key.get_pressed()
+direction = Vector2(
+ keys[pygame.K_RIGHT] - keys[pygame.K_LEFT],
+ keys[pygame.K_DOWN] - keys[pygame.K_UP],
+)
+if direction.length_squared() > 0:
+ direction = direction.normalize() # equal speed on diagonals
+pos += direction * speed * dt # RIGHT: dt-scaled
+screen.blit(player_img, (round(pos.x), round(pos.y))) # blit at integer pixels
+```
+
+### 3. Input: events vs polling
+
+```python
+for event in pygame.event.get():
+ if event.type == pygame.QUIT:
+ running = False
+ elif event.type == pygame.KEYDOWN: # discrete press: jump, menu, pause
+ if event.key == pygame.K_SPACE:
+ jump()
+ elif event.key == pygame.K_ESCAPE:
+ running = False
+ elif event.type == pygame.MOUSEBUTTONDOWN:
+ shoot_at(event.pos) # event.pos = (x, y)
+
+# Polled state (read once per frame) for continuous/held input:
+keys = pygame.key.get_pressed()
+if keys[pygame.K_a]:
+ move_left(dt)
+```
+
+### 4. A Sprite subclass + a Group
+
+```python
+class Player(pygame.sprite.Sprite):
+ def __init__(self, x, y):
+ super().__init__()
+ # convert() once at load makes blits much faster; _alpha keeps transparency.
+ self.image = pygame.image.load("player.png").convert_alpha()
+ self.rect = self.image.get_rect(center=(x, y))
+ self.pos = pygame.math.Vector2(self.rect.center)
+ self.speed = 240
+
+ def update(self, dt): # Group.update(dt) calls this per sprite
+ keys = pygame.key.get_pressed()
+ self.pos.x += (keys[pygame.K_RIGHT] - keys[pygame.K_LEFT]) * self.speed * dt
+ self.rect.center = (round(self.pos.x), round(self.pos.y))
+
+all_sprites = pygame.sprite.Group()
+all_sprites.add(Player(400, 300))
+
+# in the loop:
+all_sprites.update(dt) # calls each sprite's update(dt)
+all_sprites.draw(screen) # blits each sprite at its rect
+```
+
+### 5. Collision detection
+
+```python
+# Sprite vs group: e.g. player picking up coins (True = remove collided coins).
+collected = pygame.sprite.spritecollide(player, coins, dokill=True)
+score += len(collected)
+
+# Group vs group: bullets vs enemies (kill both on hit).
+hits = pygame.sprite.groupcollide(bullets, enemies, True, True)
+
+# Plain rect overlap (no sprites needed):
+if player.rect.colliderect(door_rect):
+ open_door()
+```
+
+## Pitfalls
+
+- **Window freezes / "not responding"** → you didn't pump the event queue. Call
+ `pygame.event.get()` (or `pygame.event.pump()`) every frame.
+- **Speed differs on faster machines** → you moved by a fixed amount per frame.
+ Scale by `dt = clock.tick(fps) / 1000` and use pixels-per-second values.
+- **Sub-pixel movement snaps/jitters** → `rect` coordinates are integers; store the
+ true position as a `Vector2` of floats and assign `rect.center = round(...)` each
+ frame.
+- **Blits are slow / framerate drops** → call `.convert()` (opaque) or
+ `.convert_alpha()` (transparent) on loaded images once; un-converted surfaces blit
+ far slower.
+- **Nothing appears** → you forgot `pygame.display.flip()` (or `update()`), or you
+ drew before `screen.fill(...)` so it was cleared away.
+- **Wrong draw order** → pygame uses painter's order; later blits cover earlier ones.
+ Draw background first, sprites last.
+- **`pip install pygame` got the old one** → for the maintained fork use
+ `pip install pygame-ce`; having both installed causes import conflicts.
+- **Diagonal movement is faster** → normalise the direction vector before scaling by
+ speed.
+
+## References
+
+- For `Group` variants (`GroupSingle`, `LayeredUpdates` for z-order), pixel-perfect
+ collision with `mask`, slicing a spritesheet, simple animation, sound/music, and
+ text rendering, read `references/sprites-and-collision.md`.
+
+## Related skills
+
+- `love2d-core` — the same loop concepts in LÖVE/Lua.
+- `bevy-ecs` — a heavier ECS engine when a project outgrows pygame.
+- `input-systems` / `save-systems` — engine-agnostic input and persistence.
+- `platformer` / `roguelike` — genre templates that pair with pygame.
diff --git a/skills/other-engines/pygame-core/references/sprites-and-collision.md b/skills/other-engines/pygame-core/references/sprites-and-collision.md
new file mode 100644
index 0000000..33b16d7
--- /dev/null
+++ b/skills/other-engines/pygame-core/references/sprites-and-collision.md
@@ -0,0 +1,133 @@
+# pygame sprites, collision & media (pygame-ce 2.5+)
+
+Depth behind the pygame-core skill: group variants, pixel-perfect collision,
+spritesheets, animation, and audio/text.
+
+## Group variants
+
+`pygame.sprite` ships several containers; pick by need:
+
+| Class | Use for |
+|-------|---------|
+| `Group` | the general case; `update(*args)` + `draw(surface)` |
+| `GroupSingle` | a slot holding at most one sprite (e.g. the player) |
+| `LayeredUpdates` | groups that draw by a per-sprite `_layer` (z-order) |
+| `RenderUpdates` | tracks dirty rects for partial-screen redraws |
+
+```python
+from pygame.sprite import LayeredUpdates
+world = LayeredUpdates()
+world.add(background, layer=0)
+world.add(player, layer=10) # higher layer draws on top
+world.add(ui, layer=20)
+world.update(dt)
+world.draw(screen)
+```
+
+A sprite removes itself from **all** groups with `self.kill()`. Membership is
+two-way: `group.has(sprite)`, `sprite.groups()`.
+
+## Collision functions
+
+`spritecollide` and `groupcollide` use rect overlap by default. The optional
+`collided` callback swaps in a more precise test:
+
+```python
+import pygame
+from pygame.sprite import collide_rect, collide_circle, collide_mask
+
+# Circle collision (set sprite.radius, or it's derived from the rect):
+pygame.sprite.spritecollide(player, rocks, False, collide_circle)
+
+# Pixel-perfect via masks (see below):
+pygame.sprite.spritecollide(player, spikes, False, collide_mask)
+```
+
+Other helpers: `pygame.sprite.collide_rect_ratio(0.75)` (shrunken rect),
+`spritecollideany` (fast boolean-ish "any hit"), and `Rect` methods
+`colliderect`, `collidepoint`, `collidelist`, `collidelistall`.
+
+## Pixel-perfect collision with masks
+
+Rect collision is generous; for tight hitboxes build a `Mask` from each sprite's
+alpha and test overlap:
+
+```python
+class Bullet(pygame.sprite.Sprite):
+ def __init__(self, image, pos):
+ super().__init__()
+ self.image = image.convert_alpha()
+ self.rect = self.image.get_rect(center=pos)
+ self.mask = pygame.mask.from_surface(self.image) # build once
+
+# collide_mask uses each sprite's .mask:
+if pygame.sprite.collide_mask(bullet, enemy):
+ enemy.kill()
+```
+
+Rebuild the mask if the sprite's image changes (e.g. each animation frame), or
+keep a per-frame list of masks.
+
+## Slicing a spritesheet
+
+```python
+def load_frames(path, frame_w, frame_h):
+ sheet = pygame.image.load(path).convert_alpha()
+ cols = sheet.get_width() // frame_w
+ rows = sheet.get_height() // frame_h
+ frames = []
+ for r in range(rows):
+ for c in range(cols):
+ rect = pygame.Rect(c * frame_w, r * frame_h, frame_w, frame_h)
+ frames.append(sheet.subsurface(rect)) # view into the sheet, no copy
+ return frames
+```
+
+## Simple frame animation
+
+```python
+class AnimatedSprite(pygame.sprite.Sprite):
+ def __init__(self, frames, fps, pos):
+ super().__init__()
+ self.frames = frames
+ self.frame_time = 1 / fps
+ self.timer = 0.0
+ self.index = 0
+ self.image = frames[0]
+ self.rect = self.image.get_rect(center=pos)
+
+ def update(self, dt):
+ self.timer += dt
+ while self.timer >= self.frame_time:
+ self.timer -= self.frame_time
+ self.index = (self.index + 1) % len(self.frames)
+ self.image = self.frames[self.index]
+```
+
+## Audio
+
+```python
+pygame.mixer.init() # or rely on pygame.init()
+jump_sfx = pygame.mixer.Sound("jump.wav") # short SFX, fully loaded
+jump_sfx.set_volume(0.5)
+jump_sfx.play()
+
+pygame.mixer.music.load("theme.ogg") # streamed music (one track at a time)
+pygame.mixer.music.set_volume(0.3)
+pygame.mixer.music.play(loops=-1) # -1 = loop forever
+```
+
+Prefer `.ogg`/`.wav`; keep many short effects as `Sound`, and long tracks on the
+single `music` stream.
+
+## Text
+
+```python
+font = pygame.font.Font(None, 36) # None = default font; or a .ttf path
+# Antialiased text is slow to render — cache the Surface, re-render only on change.
+label = font.render(f"Score: {score}", True, (255, 255, 255))
+screen.blit(label, (10, 10))
+```
+
+Re-rendering text every frame is a common performance trap; render once and re-blit,
+re-rendering only when the string changes.
diff --git a/skills/other-engines/roblox-datastores/SKILL.md b/skills/other-engines/roblox-datastores/SKILL.md
new file mode 100644
index 0000000..6ff7ec7
--- /dev/null
+++ b/skills/other-engines/roblox-datastores/SKILL.md
@@ -0,0 +1,201 @@
+---
+name: roblox-datastores
+description: >
+ Persist player data in Roblox with DataStoreService: GetDataStore, GetAsync/
+ SetAsync/UpdateAsync/IncrementAsync wrapped in pcall, load-on-join and
+ save-on-leave plus BindToClose, retries, and OrderedDataStore leaderboards. Use
+ when saving or loading persistent data in a Roblox experience — when the user
+ mentions DataStore, DataStoreService, GetAsync, SetAsync, UpdateAsync, save player
+ data, or leaderboards. For general Luau scripting use roblox-luau.
+license: Apache-2.0
+compatibility: Roblox (current engine) DataStoreService; server-side Scripts only
+metadata:
+ engine: roblox
+ category: other-engines
+ difficulty: intermediate
+---
+
+# Roblox DataStores
+
+Persist data across sessions in Roblox with `DataStoreService`: loading on join,
+saving on leave and shutdown, safe updates, retries, and ordered stores for
+leaderboards. Server-side only.
+
+## When to use
+
+- Use to save/load player progress (coins, inventory, levels), build persistent
+ leaderboards, or fix data loss, overwrites, and throttling.
+- Use when server code calls `DataStoreService`, `GetDataStore`, `GetAsync`,
+ `SetAsync`, `UpdateAsync`, or `GetOrderedDataStore`.
+
+**When *not* to use:** general scripting, services, remotes, the client/server
+split → `roblox-luau`. High-frequency temporary state (matchmaking, per-round) →
+memory stores (a different service). Engine-agnostic persistence theory →
+`save-systems`.
+
+## Core workflow
+
+1. **Enable Studio access once.** File → Game Settings → Security → *Enable Studio
+ Access to API Services* (use a test place; Studio hits live data). DataStores
+ work only from server `Script`s, never `LocalScript`s.
+2. **Get a store, then read/write by key.** `DataStoreService:GetDataStore("Name")`;
+ key per player is usually `"Player_" .. player.UserId`.
+3. **Wrap every call in `pcall`.** `GetAsync`/`SetAsync`/`UpdateAsync` are network
+ calls that can fail; an unguarded failure errors the thread and risks data loss.
+4. **Load on `PlayerAdded`, save on `PlayerRemoving`, and also `BindToClose`.** A
+ leaving player and a shutting-down server both need a final save.
+5. **Prefer `UpdateAsync` for read-modify-write** (multi-server safe) over `SetAsync`
+ (blind overwrite). On a failed load, do **not** overwrite with defaults — abort
+ the save so you don't wipe good data.
+6. **Use `OrderedDataStore` for ranked data** (leaderboards) via `GetSortedAsync`.
+ Test by joining, changing data, rejoining, and confirming it persisted.
+
+## Patterns
+
+### 1. Load on join (pcall-guarded)
+
+```lua
+local DataStoreService = game:GetService("DataStoreService")
+local Players = game:GetService("Players")
+local store = DataStoreService:GetDataStore("PlayerData")
+
+local DEFAULT = { Coins = 0, Level = 1 }
+
+Players.PlayerAdded:Connect(function(player)
+ local key = "Player_" .. player.UserId
+ local ok, data = pcall(function()
+ return store:GetAsync(key)
+ end)
+
+ if not ok then
+ -- Load FAILED (network). Do not treat as a new player; flag so we never save
+ -- over their real data with defaults.
+ warn("Load failed for", player.Name, data)
+ player:SetAttribute("DataLoaded", false)
+ return
+ end
+
+ player:SetAttribute("DataLoaded", true)
+ local profile = data or DEFAULT -- nil == genuinely new player
+ applyToLeaderstats(player, profile)
+end)
+```
+
+### 2. Save with UpdateAsync (multi-server safe)
+
+```lua
+-- UpdateAsync reads the latest value, then writes what the callback returns.
+-- The callback MUST NOT yield (no task.wait, no further Async calls inside it).
+local function savePlayer(player)
+ if player:GetAttribute("DataLoaded") == false then return end -- never overwrite on a bad load
+ local key = "Player_" .. player.UserId
+ local newData = gatherDataFor(player) -- a plain table of serializable values
+
+ local ok, err = pcall(function()
+ store:UpdateAsync(key, function(old)
+ -- merge/decide here; return nil to cancel the write
+ return newData
+ end)
+ end)
+ if not ok then warn("Save failed for", player.Name, err) end
+end
+```
+
+### 3. Save on leave AND on shutdown
+
+```lua
+Players.PlayerRemoving:Connect(savePlayer)
+
+-- BindToClose runs when the server shuts down; save everyone still in.
+-- It has a limited time budget, so save in parallel and yield until done.
+game:BindToClose(function()
+ local players = Players:GetPlayers()
+ local remaining = #players
+ if remaining == 0 then return end
+ for _, player in players do
+ task.spawn(function()
+ savePlayer(player)
+ remaining -= 1
+ end)
+ end
+ while remaining > 0 do task.wait() end
+end)
+```
+
+### 4. Retry with backoff (transient failures)
+
+```lua
+local function withRetry(fn, attempts)
+ attempts = attempts or 3
+ for i = 1, attempts do
+ local ok, result = pcall(fn)
+ if ok then return true, result end
+ if i < attempts then task.wait(2 ^ i) end -- 2s, 4s, ... backoff
+ end
+ return false
+end
+
+local ok, data = withRetry(function() return store:GetAsync(key) end)
+```
+
+### 5. Increment a counter
+
+```lua
+-- IncrementAsync is a convenience for integer read-modify-write (still wrap it).
+local ok, newTotal = pcall(function()
+ return store:IncrementAsync("Visits_" .. player.UserId, 1)
+end)
+```
+
+### 6. Leaderboard with OrderedDataStore
+
+```lua
+local boards = DataStoreService:GetOrderedDataStore("Coins")
+
+-- Write a player's score (call when it changes, not every frame).
+pcall(function() boards:SetAsync("Player_" .. player.UserId, coins) end)
+
+-- Read the top 10, descending.
+local ok, pages = pcall(function()
+ return boards:GetSortedAsync(false, 10) -- ascending=false → highest first
+end)
+if ok then
+ for rank, entry in ipairs(pages:GetCurrentPage()) do
+ print(rank, entry.key, entry.value) -- entry.value is the number
+ end
+end
+```
+
+## Pitfalls
+
+- **Unhandled failure wipes progress** → always `pcall` Async calls; on a failed
+ *load*, mark the session and refuse to *save* so defaults never overwrite real data.
+- **`SetAsync` race between servers** → two servers writing the same key can clobber
+ each other. Use `UpdateAsync` for read-modify-write so each write sees the latest.
+- **Yielding inside the `UpdateAsync` callback** → the callback can't call
+ `task.wait` or other Async functions; compute the new value beforehand and return it.
+- **No `BindToClose` save** → players in the server at shutdown lose unsaved progress;
+ add `game:BindToClose` and wait for saves to finish within its budget.
+- **Throttling / "too many requests"** → respect per-key and per-minute limits; don't
+ save on every value change. Batch and save on a timer / on leave. `GetAsync` is
+ cached briefly, so immediate re-reads may be stale.
+- **Storing non-serializable values** → only JSON-serializable data persists: numbers,
+ strings, booleans, and tables with string/number keys. `Instance`s, `Vector3`,
+ `CFrame`, and functions do not — serialize them to plain tables first.
+- **Testing without API access** → DataStores silently can't be used in Studio until
+ *Enable Studio Access to API Services* is on (and they don't work from a
+ `LocalScript`).
+- **`DataStoreKeyInfo` is nil for ordered stores** → `OrderedDataStore` doesn't
+ support versioning/metadata; use a regular `DataStore` when you need those.
+
+## References
+
+- For session locking (preventing duplicate data across servers), versioning/
+ metadata with `DataStoreSetOptions`, ordered-store pagination
+ (`AdvanceToNextPageAsync`), the key error codes and request limits, and
+ Right-to-be-Forgotten compliance, read `references/sessions-and-limits.md`.
+
+## Related skills
+
+- `roblox-luau` — services, instances, events, and the server/client model.
+- `save-systems` — engine-agnostic serialization, slots, and migration.
diff --git a/skills/other-engines/roblox-datastores/references/sessions-and-limits.md b/skills/other-engines/roblox-datastores/references/sessions-and-limits.md
new file mode 100644
index 0000000..2b60cb2
--- /dev/null
+++ b/skills/other-engines/roblox-datastores/references/sessions-and-limits.md
@@ -0,0 +1,101 @@
+# Roblox DataStores: sessions, limits & metadata (current engine)
+
+Depth behind the DataStores skill: session locking, versioning/metadata, ordered-
+store pagination, request limits, and compliance.
+
+## Session locking (preventing duplicate / clobbered data)
+
+Players can occasionally be in two servers briefly (teleports, rejoin races). Two
+servers loading and later saving the same key can lose writes. A *session lock*
+makes a key owned by one server at a time:
+
+1. On load, `UpdateAsync` the key to stamp it with this server's `JobId` and a
+ timestamp, but only if it's unlocked or the lock is stale (older than, say, the
+ `BindToClose` budget).
+2. If it's locked by a live server, retry a few times, then either kick the player
+ or load read-only.
+3. On save/leave, clear the lock as part of the same `UpdateAsync`.
+
+`UpdateAsync` is the right primitive because its callback sees the current value, so
+the check-and-set is atomic per request. (Production code often uses a vetted
+open-source profile/session library that implements this correctly; if you roll your
+own, test the teleport and rapid-rejoin cases.)
+
+## Versioning & metadata
+
+Regular `DataStore` keys support versioning and metadata; `OrderedDataStore` does
+not (`DataStoreKeyInfo` is always `nil` there).
+
+```lua
+local DataStoreService = game:GetService("DataStoreService")
+local store = DataStoreService:GetDataStore("PlayerData")
+
+-- Attach UserIds (for content tracking) and custom metadata on write.
+local options = Instance.new("DataStoreSetOptions")
+options:SetMetadata({ schema = 2, region = "eu" })
+pcall(function()
+ store:SetAsync(key, data, { player.UserId }, options)
+end)
+
+-- Read returns a second value, the DataStoreKeyInfo.
+local ok, value, keyInfo = pcall(function() return store:GetAsync(key) end)
+if ok and keyInfo then
+ print(keyInfo.Version, keyInfo.CreatedTime, keyInfo.UpdatedTime)
+ print(keyInfo:GetUserIds(), keyInfo:GetMetadata())
+end
+```
+
+Important: when you set metadata or UserIds, you must re-supply them on every write
+or they're cleared. List past versions with `ListVersionsAsync` and fetch one with
+`GetVersionAsync` to recover from a bad write.
+
+A `schema`/version number stored alongside the data lets you **migrate** old saves:
+on load, if `data.schema < CURRENT`, transform the table forward before use.
+
+## Ordered stores: full pagination
+
+```lua
+local boards = DataStoreService:GetOrderedDataStore("Coins")
+local ok, pages = pcall(function()
+ return boards:GetSortedAsync(false, 50) -- descending, page size 50
+end)
+if ok then
+ while true do
+ for rank, entry in ipairs(pages:GetCurrentPage()) do
+ -- entry.key (the data key), entry.value (the number)
+ end
+ if pages.IsFinished then break end
+ pages:AdvanceToNextPageAsync() -- yields; wrap loops in pcall in production
+ end
+end
+```
+
+`GetSortedAsync(ascending, pageSize, minValue?, maxValue?)` — page size caps how
+many entries `AdvanceToNextPageAsync` fetches per request.
+
+## Request limits & throttling
+
+- Requests are subject to per-minute budgets that scale with the number of players;
+ exceeding them queues requests and eventually drops them.
+- `GetAsync` results are cached for a short window — an immediate re-read returns the
+ cached value, not necessarily the freshest. Disable caching only if you truly need
+ to (it costs extra requests).
+- Practical rules: save on leave / `BindToClose` and on a periodic timer (e.g. every
+ 60–120s), **not** on every value change. Coalesce many small changes into one
+ write. Use `UpdateAsync` so concurrent writers don't clobber.
+- Treat every Async call as fallible: `pcall` + bounded retry with backoff. See the
+ official *Error codes and limits* page for the exact numeric limits, which change
+ over time.
+
+## Right to be forgotten (RTBF)
+
+You're responsible for deleting a user's data on request. Implement a removal path
+(e.g. `RemoveAsync` on every store keyed by that `UserId`, plus any ordered-store
+entries) and the Open Cloud DataStore API can perform deletions from outside the
+game. Keep the list of stores/keys a player touches so deletion is complete.
+
+## Open Cloud (out-of-game access)
+
+The Open Cloud DataStore API lets trusted external tools read/write the same stores
+with scoped API keys — useful for admin dashboards, moderation, and bulk migration.
+Treat the API key as a secret; never embed it in client or game code.
diff --git a/skills/other-engines/roblox-luau/SKILL.md b/skills/other-engines/roblox-luau/SKILL.md
new file mode 100644
index 0000000..19ff657
--- /dev/null
+++ b/skills/other-engines/roblox-luau/SKILL.md
@@ -0,0 +1,199 @@
+---
+name: roblox-luau
+description: >
+ Script a Roblox experience in Luau: get services, create and parent Instances,
+ connect events, run server Scripts vs client LocalScripts, and communicate across
+ the client/server boundary with RemoteEvents/RemoteFunctions (server-authoritative).
+ Use when building or debugging Roblox Studio scripts — when the user mentions
+ Roblox, Luau, services, RemoteEvent, Instance.new, PlayerAdded, or client vs
+ server. For saving player data use roblox-datastores.
+license: Apache-2.0
+compatibility: Roblox (current engine) / Luau; server-authoritative model
+metadata:
+ engine: roblox
+ category: other-engines
+ difficulty: beginner
+---
+
+# Roblox Luau Scripting
+
+Script a Roblox experience in **Luau**: services, `Instance`s, events, the
+server/client split, and secure cross-boundary communication. Targets the current
+Roblox engine and Studio.
+
+## When to use
+
+- Use when writing Roblox scripts: getting services, creating/parenting instances,
+ connecting events, deciding server vs client, or wiring `RemoteEvent`/
+ `RemoteFunction` communication.
+- Use when the project has `Script`/`LocalScript`/`ModuleScript` objects, `.rbxl(x)`
+ places, or a Rojo `*.project.json`, and code calls `game:GetService(...)`.
+
+**When *not* to use:** persisting data across sessions → `roblox-datastores`.
+Generic Lua questions unrelated to the Roblox API. Engine-agnostic input/save
+architecture → `input-systems` / `save-systems`.
+
+## Core workflow
+
+1. **Get services with `game:GetService("Name")`.** Common ones: `Players`,
+ `Workspace`, `ReplicatedStorage` (shared client+server), `ServerScriptService`
+ (server-only code), `ServerStorage`, `RunService`, `UserInputService` (client).
+2. **Know where code runs.** A `Script` runs on the **server**; a `LocalScript`
+ runs on a **client** (in `StarterPlayerScripts`, `StarterGui`, or the player's
+ character). A `ModuleScript` is shared code you `require`.
+3. **Create instances deliberately.** `local p = Instance.new("Part")`, set its
+ properties, then set `p.Parent` **last** (parenting triggers replication).
+4. **React with events.** `:Connect` to signals like `Players.PlayerAdded`,
+ `part.Touched`, or `RunService.Heartbeat`. Disconnect when done to avoid leaks.
+5. **Cross the client/server boundary with Remotes — and never trust the client.**
+ Clients request via `RemoteEvent:FireServer(...)`; the server validates and
+ applies. The server is authoritative for all game state.
+6. **Test in Studio** with Play / Play Here / server+client Start; use the Output
+ window and the server/client view toggle to confirm where code ran.
+
+## Patterns
+
+### 1. Server Script: react to players joining (leaderstats)
+
+```lua
+-- ServerScriptService/Leaderboard.server.luau (a Script = runs on the server)
+local Players = game:GetService("Players")
+
+local function onPlayerAdded(player: Player)
+ local stats = Instance.new("Folder")
+ stats.Name = "leaderstats" -- this name makes it show on the leaderboard
+
+ local coins = Instance.new("IntValue")
+ coins.Name = "Coins"
+ coins.Value = 0
+ coins.Parent = stats
+
+ stats.Parent = player -- parent LAST
+end
+
+Players.PlayerAdded:Connect(onPlayerAdded)
+```
+
+### 2. Create and configure an instance
+
+```lua
+local Workspace = game:GetService("Workspace")
+
+local part = Instance.new("Part")
+part.Size = Vector3.new(4, 1, 4)
+part.Position = Vector3.new(0, 10, 0)
+part.Anchored = true -- won't fall under gravity
+part.BrickColor = BrickColor.new("Bright blue")
+part.Parent = Workspace -- set Parent last so it replicates once, fully
+```
+
+### 3. Connect an event (and disconnect to avoid leaks)
+
+```lua
+local debounce = false
+local connection
+connection = part.Touched:Connect(function(hit: BasePart)
+ local character = hit.Parent
+ local humanoid = character and character:FindFirstChildOfClass("Humanoid")
+ if not humanoid or debounce then return end
+ debounce = true
+ humanoid.Health -= 10
+ task.wait(1) -- task.wait, NOT the deprecated wait()
+ debounce = false
+end)
+
+-- Later, when the part is removed or the round ends:
+-- connection:Disconnect()
+```
+
+### 4. Client → server with a RemoteEvent (validate on the server!)
+
+```lua
+-- ReplicatedStorage: create a RemoteEvent named "BuyItem" (in Studio or via code).
+-- CLIENT (LocalScript): request a purchase. The client can lie — this is only a request.
+local ReplicatedStorage = game:GetService("ReplicatedStorage")
+local buyItem = ReplicatedStorage:WaitForChild("BuyItem") -- wait: may not have replicated yet
+buyButton.MouseButton1Click:Connect(function()
+ buyItem:FireServer("sword") -- send the item id only; never the price/result
+end)
+```
+
+```lua
+-- SERVER (Script): the ONLY place the transaction is decided.
+local ReplicatedStorage = game:GetService("ReplicatedStorage")
+local buyItem = ReplicatedStorage:WaitForChild("BuyItem")
+local PRICES = { sword = 100, shield = 75 }
+
+buyItem.OnServerEvent:Connect(function(player: Player, itemId)
+ -- TRUST NOTHING from the client. Validate types and values.
+ if type(itemId) ~= "string" then return end
+ local price = PRICES[itemId]
+ if not price then return end -- unknown item
+ local coins = player.leaderstats.Coins
+ if coins.Value < price then return end -- can't afford
+ coins.Value -= price -- server applies the change
+ grantItem(player, itemId)
+end)
+```
+
+### 5. A per-frame loop with RunService
+
+```lua
+local RunService = game:GetService("RunService")
+-- Heartbeat fires every frame AFTER physics; dt is seconds since the last step.
+RunService.Heartbeat:Connect(function(dt)
+ spinner.CFrame *= CFrame.Angles(0, math.rad(90) * dt, 0) -- 90deg/sec, frame-independent
+end)
+```
+
+### 6. Shared code in a ModuleScript
+
+```lua
+-- ReplicatedStorage/GameConfig (a ModuleScript) — usable by server and client.
+local GameConfig = {}
+GameConfig.MaxHealth = 100
+function GameConfig.damageFor(weapon: string): number
+ return ({ sword = 25, bow = 15 })[weapon] or 0
+end
+return GameConfig
+```
+
+```lua
+local GameConfig = require(game:GetService("ReplicatedStorage"):WaitForChild("GameConfig"))
+print(GameConfig.MaxHealth)
+```
+
+## Pitfalls
+
+- **Trusting the client is an exploit** → clients can send any arguments to a
+ `RemoteEvent`/`RemoteFunction`. Validate every argument's type and range on the
+ server and keep the server authoritative over health, currency, and inventory.
+- **`LocalScript` doesn't run where you put it** → LocalScripts run in
+ `StarterPlayerScripts`, `StarterCharacterScripts`, `StarterGui`, or tools — not in
+ `Workspace` or `ServerScriptService`. Server `Script`s belong in
+ `ServerScriptService`/`Workspace`.
+- **Deprecated globals** → use `task.wait`/`task.spawn`/`task.delay`, not the old
+ `wait()`/`spawn()`/`delay()` (worse scheduling and throttling).
+- **Parenting first, then setting properties** → set properties first and `Parent`
+ last so the instance replicates once in its final state.
+- **`nil` on the client right after join** → objects stream/replicate over time; use
+ `parent:WaitForChild("Name")` instead of indexing directly on the client.
+- **Connections never disconnected** → long-lived `:Connect` handlers leak and can
+ fire on destroyed objects; store the connection and `:Disconnect()` (or use
+ `Instance:GetAttributeChangedSignal`/`:Once` where appropriate).
+- **Using a RemoteFunction where a RemoteEvent fits** → `RemoteFunction` blocks
+ waiting for a return and a malicious/slow client can stall the server; prefer
+ one-way `RemoteEvent`s unless you genuinely need a reply.
+
+## References
+
+- For the full client/server model (replication, `RemoteFunction` vs `RemoteEvent`,
+ `:WaitForChild` timing, `BindableEvent` for same-context messaging, attributes,
+ `CollectionService` tags, and `:Once`/connection cleanup), read
+ `references/client-server.md`.
+
+## Related skills
+
+- `roblox-datastores` — persist player data across sessions (server-only).
+- `save-systems` — engine-agnostic persistence concepts.
+- `game-ai` / `input-systems` — portable AI and input patterns to implement in Luau.
diff --git a/skills/other-engines/roblox-luau/references/client-server.md b/skills/other-engines/roblox-luau/references/client-server.md
new file mode 100644
index 0000000..71d8ad0
--- /dev/null
+++ b/skills/other-engines/roblox-luau/references/client-server.md
@@ -0,0 +1,102 @@
+# Roblox client/server model & communication (current engine)
+
+Depth behind the Luau skill: how code is split across machines, the messaging
+primitives, replication timing, and tags/attributes.
+
+## Where code runs
+
+| Container | Runs on | Use for |
+|-----------|---------|---------|
+| `ServerScriptService` | server | authoritative game logic (`Script`) |
+| `ServerStorage` | server | assets/data the client must never see |
+| `ReplicatedStorage` | both | remotes, `ModuleScript`s, shared assets |
+| `StarterPlayerScripts` | client | persistent client logic (`LocalScript`) |
+| `StarterCharacterScripts` | client | per-character client logic |
+| `StarterGui` | client | UI scripts |
+
+The server simulates the authoritative world; each client renders its own view and
+sends input. Roblox always filters client→server replication, so a client cannot
+directly change server-owned state — it can only ask via a remote.
+
+## RemoteEvent vs RemoteFunction
+
+Both live in `ReplicatedStorage` so both sides can find them.
+
+- **RemoteEvent** — fire-and-forget, one-way, asynchronous.
+ - Client→server: `remote:FireServer(args)` → server handles `remote.OnServerEvent:Connect(function(player, args) ... end)`. The `player` is injected by the engine and is trustworthy; everything after it is not.
+ - Server→client: `remote:FireClient(player, args)` or `remote:FireAllClients(args)` → client handles `remote.OnClientEvent:Connect(function(args) ... end)`.
+
+- **RemoteFunction** — request/response, the caller **yields** for a return value.
+ - Client→server: `local result = remote:InvokeServer(args)`; server defines `remote.OnServerInvoke = function(player, args) return ... end`.
+ - Prefer `RemoteEvent` for most things. A `RemoteFunction` invoked **on a client by the server** is dangerous: a malicious client can never return or can error, hanging the server. Only invoke client→server, validate, and consider timeouts.
+
+### Security checklist for every server handler
+
+1. Validate argument **types** (`type(x) ~= "number"` → reject).
+2. Validate argument **ranges/identity** (does this item exist? can this player afford it? do they own the thing they're acting on?).
+3. Rate-limit if the action is expensive (track last-call time per player).
+4. Never send secret data (prices, loot tables, other players' private data) to the
+ client "to be returned"; decide it on the server.
+
+## BindableEvent / BindableFunction
+
+For messaging **within the same machine** (server-to-server scripts, or client-to-
+client), use `BindableEvent`/`BindableFunction`. They do not cross the network and
+carry no security boundary — don't use them to replace remotes.
+
+## Replication timing & WaitForChild
+
+When a client starts, the data model streams in over time, so a child you expect
+may not exist yet. On the client, use:
+
+```lua
+local remote = ReplicatedStorage:WaitForChild("BuyItem") -- yields until it exists
+local gui = player:WaitForChild("PlayerGui"):WaitForChild("HUD")
+```
+
+`WaitForChild` accepts an optional timeout; without one it warns after ~5 seconds.
+On the server, instances you created exist immediately, so direct indexing is fine.
+
+## Connections & cleanup
+
+`:Connect` returns an `RBXScriptConnection`. Long-lived connections that are never
+disconnected leak and can fire on destroyed instances:
+
+```lua
+local conn = part.Touched:Connect(onTouch)
+-- when done:
+conn:Disconnect()
+
+-- One-shot: auto-disconnects after the first fire.
+part.Touched:Once(onTouchOnce)
+
+-- Clean up everything tied to a player on leave:
+Players.PlayerRemoving:Connect(function(player) cleanupFor(player) end)
+```
+
+## Attributes & CollectionService tags
+
+- **Attributes** store typed metadata directly on an instance and replicate to
+ clients: `part:SetAttribute("Damage", 25)`, `part:GetAttribute("Damage")`, and
+ `part:GetAttributeChangedSignal("Damage"):Connect(...)`. Good for designer-tweakable
+ values without extra `Value` objects.
+- **CollectionService tags** group instances by string tag for data-driven systems:
+
+```lua
+local CollectionService = game:GetService("CollectionService")
+for _, door in CollectionService:GetTagged("Door") do
+ setupDoor(door)
+end
+CollectionService:GetInstanceAddedSignal("Door"):Connect(setupDoor)
+```
+
+Tags + attributes together let you build behavior systems that pick up any tagged
+instance (placed by designers in Studio) without hard-coding references.
+
+## Studio testing
+
+- **Play** — your avatar in a combined server+client session.
+- **Run** — server simulation with no player.
+- **Start (Local Server)** — separate server + N client windows; the only way to
+ properly test replication and remotes. Use the Server/Client view toggle and the
+ Output window to confirm which side a message came from.