This repository is a scaffold for the Scribble lab.
This lab starts from a runnable but intentionally incomplete Scribble-style guessing game with a minimal REST backend and an in-memory room system. The work is a brownfield enhancement: inspect the starter, produce Spec Kit artifacts, implement the missing behavior incrementally, validate against acceptance criteria, and reflect on the AI-assisted workflow.
Granular, meaningful commits are encouraged so implementation decisions remain easy to assess.
| Item | Details |
|---|---|
| Project type | Brownfield enhancement |
| Tech model | Frontend + minimal REST backend, in-memory store, manual room refresh in the starter; polling added by learners |
| Difficulty | Intermediate |
| Prerequisites | Comfort reading an existing codebase. |
It already provides:
frontend/: Vite + React + TypeScript clientbackend/: Node.js + Express + TypeScript service- starter routes and screens for Start, Create Room, Join Room, Lobby, and Game
- starter room API with in-memory state
- starter seed data:
- words:
rocket,pizza,castle,guitar,sunflower - roles:
drawer,guesser
- words:
It does not implement the required room and gameplay features described in the business scenarios below.
The current UI uses Scribble branding and presentational copy, but the supported behavior is still the scaffold described in this document.
Before starting, confirm the following are available:
- Node.js 18+ and npm 9+
- Git installed and configured
- A modern browser for testing multi-player flows
- A code editor (VS Code recommended)
- Access to a Spec Kit-compatible AI coding assistant
- Spec Kit CLI installed and verified
You should be comfortable with TypeScript, React components and hooks, REST APIs, command-line usage, and reading an existing codebase without immediately rewriting it.
- Fork this repository to your own GitHub account
- Clone your fork locally and work from it
- Create a branch (e.g.,
assignment,scribble-lab, or similar) - Commit your artifacts and implementation changes as you progress
- When the lab is complete, raise a Pull Request from your branch to
mainon your fork - Include your email, role, and follow the PR template provided
Keep commits granular and meaningful. The PR diff is what reviewers will assess.
By the end of this lab you should be able to:
- Inspect an existing codebase before writing new code
- Write a constitution that constrains AI-assisted development
- Write a feature specification with explicit acceptance criteria and edge cases
- Resolve ambiguity through structured clarification
- Produce a technical plan tied to real files and a real state model
- Decompose work into ordered, testable tasks
- Implement incrementally and validate each slice against the spec
- Critically review AI-generated output before committing it
- Produce a clear reflection report
The current branch is scaffold-only.
Implemented today:
- app shell and page routing
- branded landing page and cleaned starter UI
- create room flow
- join room by code flow
- fetch room snapshot flow
- in-memory room storage on the backend
- lobby participant display from the latest fetched snapshot
- game screen placeholders for canvas, guess input, scoreboard, and results
- basic light UI styling
Not implemented yet:
- host behavior or host-only permissions
- automatic lobby polling
- start game flow
- drawer assignment
- secret word visibility rules
- drawing interaction
- clear canvas action
- guess submission and synced history
- scoring
- result state
- restart flow
Backend endpoints currently available:
GET /healthPOST /roomsPOST /rooms/:code/joinGET /rooms/:code
The backend stores all room data in memory only. Restarting the backend clears all rooms.
cd backend
npm install
npm run devThe backend runs on http://localhost:3001.
cd frontend
npm install
npm run devThe frontend runs on http://localhost:5173.
If needed, point the frontend at a different backend with VITE_API_URL.
Use this to confirm the starter works from a clean clone:
- Start the backend and confirm
http://localhost:3001/healthreturns{ "ok": true }. - Start the frontend and open
http://localhost:5173. - Confirm the Start screen shows
Create RoomandJoin Room. - Create a room and confirm you land on the Lobby screen.
- Open another tab, join the same room, and use the Lobby refresh button to load the latest participant list.
- Open the Game screen and confirm the canvas, guess input, scoreboard, and result areas are placeholders only.
- Treat any start-page marketing copy as presentational only; use this README for actual supported scope.
Within each feature group, follow this loop:
- Discovery: read the relevant starter files and document gaps and assumptions.
- Specify: update the spec with acceptance criteria.
- Clarify: resolve ambiguity before planning.
- Plan: update state model changes, file-level changes, and data flow.
- Tasks: decompose the plan into ordered, testable work.
- Implement: complete one meaningful slice at a time and commit it.
- Validate: verify the acceptance criteria with two browser tabs.
- Move forward only after the current scenario passes.
Maintain these artifacts throughout the lab:
- discovery notes with at least 3 incomplete behaviors, at least 2 assumptions, and relevant files
/speckit.constitutioncovering engineering principles, AI usage rules, and review discipline/speckit.specifyfiles updated incrementally by feature group with acceptance criteria/speckit.planupdated incrementally with state model, data flow, and file-level plan/speckit.tasksupdated incrementally with ordered tasks and dependencies
Given a player wants to host or join a drawing game, When they create or join a room via a unique code, Then the creator is automatically the host; invalid/empty codes are rejected with clear feedback; rooms are fully isolated; the lobby refreshes via polling (~2s); and only the host can start the game once at least 2 players are present.
Given a game is starting and player names are trimmed (empty/whitespace-only rejected with a message), When the first round begins, Then the host (or first player) becomes the clearly-identified drawer, and the secret word (deterministically selected from the starter list) is visible only to the drawer.
Given a round is active with a drawer and guessers (all scores start at 0), When the drawer draws/clears the canvas and guessers submit their guesses, Then the drawing is visible on the drawer's screen; guesses are trimmed, case-insensitively compared, and empty ones rejected; the guess history is synced to all players via polling; correct guesses score 100 (incorrect add 0).
Given a round has ended, When the result state is displayed and the host restarts, Then all players see the correct word, final scores, and full guess history; on restart, everyone returns to the lobby with players preserved and all round state cleared.
Work through the scenarios in order and complete each checkpoint before moving to the next one.
| Group | Scenario | What You Should Have By The End |
|---|---|---|
| 1. Room setup and lobby | Scenario 1 | Host tracking on room creation, join validation with clear error messages, verified multi-room isolation, automatic lobby polling within about 2 seconds, host-only start with 2-player minimum |
| 2. Game start and drawer flow | Scenario 2 | Player name validation (trim, reject empty), drawer assignment, deterministic secret word selection, drawer-only word visibility |
| 3. Gameplay interaction | Scenario 3 | Interactive drawing canvas, clear canvas, guess submission with validation, synced guess history via polling, deterministic scoring |
| 4. Result, restart, and final validation | Scenario 4 | Shared result state visible to all players, clean restart to lobby with players preserved and round state cleared |
Complete a minimum of 4 specify iterations.
- Constitution: workflow rules, coding standards, deterministic game-rule principles, AI usage rules, self-review, and testing expectations
- Specification: room lifecycle and isolation, lobby polling cadence, start-game preconditions, drawer assignment, word selection, drawing and clear behavior, guess validation, guess history sync, scoring, result contents, restart reset, edge cases, and acceptance criteria
- Plan: findings, relevant files and endpoints, frontend and backend state model, data flow, implementation sequence, testing strategy, and risks
- Tasks: discovery, artifact, backend, frontend, game logic, testing, documentation, and review work
The following items are intentionally out of scope for this lab.
Do not build them, and do not include them in your spec, plan, or tasks.
- WebSockets or real-time sync
- databases or persistent storage
- authentication, accounts, or sessions
- deployment, hosting, CI, or Docker work
- new state-management or routing libraries beyond what the starter ships
- multiple rounds, drawer rotation, timers, countdowns, speed bonuses, or drawer bonuses
- custom or random word packs
- spectator mode
- moderation features such as kick or mute
- room passwords or invite links
- rewriting the starter from scratch
- unjustified top-level dependencies
- unrelated refactors
Why these boundaries matter: They keep the lab at a focused, medium level of difficulty. Out-of-scope work rarely improves the outcome and often creates drift between the spec, plan, tasks, and implementation.
Artifacts are graded for internal consistency, traceability to implementation, and quality of reasoning, not for rigid wording or template mimicry.
| Area | What Good Looks Like |
|---|---|
| Discovery | ≥3 gaps + ≥2 assumptions documented; relevant files listed |
| Spec Kit artifacts | Constitution, spec, plan, tasks committed and internally consistent |
| Working game flow | Two browsers can join a room, play one round, see synced result, restart |
| Edge cases & validation | Empty/invalid inputs, case-insensitive guess, multi-room isolation handled |
| Implementation alignment | Code behavior matches the spec; deviations are documented |
| Reflection | Reflection explains decisions, AI usage, tradeoffs |
| Submission clarity (code optional for product roles) | Submission is easy to review |
Provide a brief reflection report in an .md file. Use these prompts as a starting point:
- What did the starter app already have?
- What did you add?
Spec Kit is the focus of this lab. The game is the vehicle. Each commit should remain explainable and traceable to your spec.
Run both builds before handing off changes:
cd backend
npm run buildcd frontend
npm run build- If the frontend cannot reach the backend, verify the backend is running on port
3001. - If the backend port is already in use, run
PORT=<new-port> npm run dev. - If local commands are missing, rerun
npm installin the relevant app directory.