agentleFS
Ar9avAr9av/game-exa/skills/world-architect/SKILL.md

world-architect

Skill4 starsChanged 7 months agoMITView on GitHub

Designs tile-based levels for a Phaser game using only the tile IDs and entity IDs from the GDD. Outputs a JSON array of level objects (tilemap + spawns + goal). Use after game-designer has produced a valid GDD and the orchestrator needs level data.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After game-designer produces a valid GDD.

    line 12
  2. Very specific:

    All tile values are integer indices into gdd.tilesetPalette (0-based).

    line 34
  3. Distinctive:

    All other spawns on passable tiles.

    line 36
  4. Very specific:

    Read the GDD from game-state.json.

    line 45
  5. Distinctive:

    Start with the impassable border, then carve out walkable interior, then place obstacles, then place spawns, then place goal.

    line 47
  6. Very specific:

    Run scripts/validate_levels.mjs <levels-file> <gdd-file> before returning.

    line 48
  7. Very specific:

    Every tile value in [0, palette.length).

    line 54
  8. Distinctive:

    All spawn coordinates within bounds and on passable tiles.

    line 56

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

World Architect

Builds levels for the Phaser tilemap loader. Inputs a GDD, outputs a JSON array of levels.

When to use

After game-designer produces a valid GDD. The orchestrator passes the GDD; you produce levels.json.

Output contract

Single JSON array. Each element:

{
  "id":     "<e.g. '1-1'>",
  "theme":  "<matches gdd.levelHints.themes[i]>",
  "size":   [<width>, <height>],         // tiles, must match levelHints.size
  "tiles":  number[][],                   // 2D array of palette indices, [row][col]
  "spawns": [
    { "entity": "<ENTITY_ID>", "x": <col>, "y": <row>, "facing"?: "up"|"down"|"left"|"right" }
  ],
  "goal":   { "kind": "tile" | "entity", "x"?: <col>, "y"?: <row>, "entityId"?: "<ID>" }
}

Hard constraints

  • tiles[][] dimensions match size. Outer rings are impassable tiles.
  • All tile values are integer indices into gdd.tilesetPalette (0-based).
  • Exactly one player spawn per level, on a passable tile, not overlapping any other spawn.
  • All other spawns on passable tiles.
  • Coordinates: (x = column, y = row), origin top-left.
  • Platformer: bottom row solid (impassable). Player one tile above the floor. Sprinkle 2-4 floating platforms.
  • Top-down: open rooms with wall obstacles. Corridors ≥ 2 tiles wide.
  • 2-6 enemies per level.
  • goal: if kind === "tile", must be reachable from spawn; if kind === "entity", that entity must be in spawns.

Process

  1. Read the GDD from game-state.json.
  2. For each levelHints.themes[i] (or count if no themes), build one level.
  3. Start with the impassable border, then carve out walkable interior, then place obstacles, then place spawns, then place goal.
  4. Run scripts/validate_levels.mjs <levels-file> <gdd-file> before returning.
  5. Save to game-state.json under levels, also write public/data/levels.json.

Validation rules (encoded in scripts/validate_levels.mjs)

  • tiles.length === size[1] and every row's length === size[0].
  • Every tile value in [0, palette.length).
  • Exactly one player spawn per level, on a passable tile.
  • All spawn coordinates within bounds and on passable tiles.
  • Border ring is impassable.
  • For platformer: tiles[height-1][*] all impassable.

Examples

See references/level-examples.md for a 16×12 top-down level and a 22×12 platformer level (used by the playtester fixtures).

NPC dialogue (RPG genre)

For top-down-rpg games, after levels are written, run the NPC dialogue generator. It reads NPC entity personality fields from the GDD and generates 6-8 dialogue lines per NPC using Claude Haiku, writing them to public/data/npc-dialogue.json:

node --env-file=~/.all-skills/.env scripts/gen_npc_dialogue.mjs <project-dir>

Game.js loads this file at runtime and falls back to built-in lines if absent. The personality block on each NPC entity drives the dialogue style — ensure the game-designer includes it for best results.

Scripts

  • scripts/validate_levels.mjs <levels-file> <gdd-file> — fails non-zero with reason if invalid.
  • scripts/gen_npc_dialogue.mjs <project-dir> — generates NPC dialogue from personality (RPG).

References

  • references/level-schema.json — JSON Schema.
  • references/level-examples.md — one level per genre with annotation.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.