Build Scale Browser Game
Goal
Ship incremental game improvements without monolithic code or regressions. Keep domain rules deterministic, boundaries explicit, and every change testable and documented.
Use This Workflow
- •Define the increment.
- •Classify as
feature,refactor,scalability, orstability. - •Capture expected player impact and non-goals in 3-6 lines.
- •Map boundaries before coding.
- •Read
references/modular-architecture.md. - •List impacted modules and contracts (types, API, events).
- •Avoid cross-feature imports through internal folders.
- •Implement contract-first.
- •Update schemas/types first.
- •Implement gameplay rules in pure domain functions.
- •Wire infrastructure adapters last.
- •Add confidence.
- •Add or update unit tests for rules.
- •Add integration/API tests for state transitions.
- •Verify idempotency for write endpoints and worker handlers.
- •Update documentation.
- •Update product and technical docs in
docs/. - •Add migration notes for schema/event changes.
- •Document rollout and rollback triggers.
- •Run quality gates.
- •Run lint, typecheck, and tests.
- •Run changed-feature smoke checks.
- •Fix failures or record justified exceptions.
Non-Negotiable Engineering Rules
- •Keep business rules in a domain layer (
packages/game-rulesstyle). - •Keep shared contracts in one schema package used by client and server.
- •Prefer additive schema changes; deprecate before removal.
- •Guard risky economy/progression changes behind feature flags.
- •Keep worker handlers idempotent and observable.
- •Pair user-visible behavior changes with tests and docs.
Expansion Patterns
For new gameplay systems:
- •Build one vertical slice first (one action, one event branch, one outcome path).
- •Instrument metrics before broad content expansion.
- •Scale content only after loop stability is verified.
For cross-cutting refactors:
- •Introduce compatibility wrappers.
- •Migrate callers module by module.
- •Remove old paths only after parity tests pass.
For scalability work:
- •Set SLO target first.
- •Benchmark baseline.
- •Implement smallest change that moves p95/p99.
- •Re-run benchmark and record deltas.
Use Bundled Resources
- •
references/modular-architecture.md: layering, folder layout, and dependency rules. - •
references/expansion-checklist.md: release-safe checklist for each increment. - •
scripts/scaffold_module.ps1: scaffold a new feature module for web app code.
Example scaffold command:
powershell
powershell -ExecutionPolicy Bypass -File skills/build-scale-browser-game/scripts/scaffold_module.ps1 -RootPath . -ModuleName heat-system
Done Criteria
Mark work done only when:
- •Code, tests, and docs are updated together.
- •Migration and rollback impact is explicit.
- •Observability exists for new critical runtime paths.
- •No unauthorized module coupling was introduced.