A virtual pet web app built with Spec-Driven Development โ where the specification is the primary artifact, and the code follows.
Built for the DeepLearning.AI 7-Day Learner Challenge (Spec-Driven Development with Coding Agents course).
๐ฅ Awarded 3rd place in the DeepLearning.AI 7-Day Spec-Driven Dev Challenge โ try the live demo or watch the walkthrough.
๐ https://nickkoro21.github.io/Tiny-Tamagotchi/
No install, no clone โ just open the link, name your pet, and start caring. State persists in localStorage across reloads.
This project earned 3rd place in the DeepLearning.AI 7-Day Spec-Driven Development Challenge (May 2026), with a final score of 6.48 / 7.00. The reviewer feedback called the submission "a standout submission โ the precision, structural discipline, and edge-case thinking on display here reflect the habits of an experienced spec writer, not a beginner."
The video covers:
- Naming a pet (including an easter-egg name reveal)
- Real-time vitals decay (Hunger / Happiness / Energy at different rates)
- The care loop โ Feed, Play, Rest โ and their cooldowns
- The state machine: Normal โ Sick recovery, then Normal โ Evolved progression
- Personality messages cycling, including combo reactions and milestone pops
- The SDD workflow โ specs driving every feature, not the other way around
The main game view: Hunger / Happiness / Energy bars with live decay, care action buttons, and a cycling personality message above the blob.
Local setup in Setup below โ npm install && npm run dev โ http://localhost:5173.
Three stats (Hunger, Happiness, Energy) on a 0โ100 scale that decay automatically in real time at different rates โ Hunger fastest (~30 s), Happiness mid (~35 s), Energy slowest (~45 s). Visual color feedback shifts from healthy โ warning โ low โ critical as stats drop.
Stat bars shift color as values cross thresholds โ here one stat has dropped into the warning band.
Three actions โ Feed (+30 hunger / +5 happiness), Play (+25 happiness / โ10 energy), Rest (+35 energy / +5 happiness) โ each with its own cooldown (3โ5 s). Pet naming on first launch. State persists via localStorage with JSON export/import backup.
The pet transitions between three visual states with distinct decay modifiers:
| State | Trigger | Decay | Visual |
|---|---|---|---|
| Normal | Default healthy state | ร1.0 | Cyan glow, smooth idle animation |
| Sick | Any stat drops below 20 | ร1.5 | Red glitch effect, distorted shape |
| Evolved | 6+ care actions AND all stats > 70 for 15 s | ร0.7 | Purple glow, shimmer particles, bright eyes |
Evolved pets can regress to Sick if neglected โ there's no direct Evolved โ Normal path. After recovering from Sick, evolution must be re-earned.
The Sick state โ red danger tint, glitch animation, and accelerated decay.
The Evolved state โ purple glow, shimmer particles, and slower decay as the reward for sustained care.
- Tech-themed personality messages cycling every 5 seconds, priority-ranked (milestones > state > combos > low-stat warnings > rare > ambient)
- Context-aware reactions for stat combinations (e.g.,
Hungry + Tired,Full but Sad,All Critical = MAYDAY) - 11 easter-egg names across three themes (case-insensitive):
- Sci-fi (4): HAL, Jarvis, Cortana, R2D2
- Aviation (4): Maverick, Goose, Iceman, Viper
- Personal (3): Nick, Koro, Nick Koro
- Milestone celebrations at 10, 25, 50, and 100 care actions (each shown once)
- Rare random messages (5% chance when all stats > 50)
Name your pet Nick Koro, Maverick, HAL, or any of the 11 recognised names for a themed greeting.
| Layer | Technology | Rationale |
|---|---|---|
| UI Framework | Preact ^10.x | 3 KB runtime, React-compatible API โ lightweight for an MVP |
| Build Tool | Vite ^6.x | Instant dev server, zero-config HMR, fast builds |
| Styling | Vanilla CSS (custom properties) | No framework lock-in, full theme control via CSS variables |
| Testing | Vitest ^3.x | Native Vite integration, Jest-compatible API, first-class ESM |
| Language | JavaScript (ES2022+, JSX) | No transpile cost beyond Vite; modern syntax without a type-checker in the loop |
| Persistence | localStorage + JSON export/import | Client-only โ no backend needed for a single-user MVP |
Why this stack? Each choice was made to minimize MVP complexity while keeping the door open for later upgrades (e.g., swapping Preact for React, or localStorage for IndexedDB). Nothing here blocks scale; everything here accelerates shipping.
TinyTamagotchi/
โโโ specs/ # SDD Constitution
โ โโโ mission.md # Vision, audience, scope
โ โโโ tech-stack.md # Architecture decisions
โ โโโ roadmap.md # Development phases
โโโ feature-01-living-vitals/ # Feature specs (per phase) โ same 3-file SDD structure
โ โโโ feature-plan.md # Task groups, approach, sequence
โ โโโ requirements.md # Functional + non-functional reqs
โ โโโ validation.md # Unit tests + manual checklist
โโโ feature-02-care-loop/
โ โโโ feature-plan.md
โ โโโ requirements.md
โ โโโ validation.md
โโโ feature-03-dynamic-states/
โ โโโ feature-plan.md
โ โโโ requirements.md
โ โโโ validation.md
โโโ feature-04-personal-touches/
โ โโโ feature-plan.md
โ โโโ requirements.md
โ โโโ validation.md
โโโ src/
โ โโโ engine/ # Pure game logic (no UI)
โ โ โโโ gameState.js # State shape + factory
โ โ โโโ vitals.js # Decay + actions + clamps
โ โ โโโ states.js # Normal/Sick/Evolved state machine
โ โ โโโ personality.js # Messages, easter eggs, milestones
โ โโโ components/ # Preact UI components
โ โโโ persistence/ # Save/load (localStorage + JSON)
โ โโโ styles/ # CSS (dark sci-fi theme)
โโโ tests/ # Vitest unit tests
โโโ package.json
# Clone the repo
git clone https://github.com/Nickkoro21/Tiny-Tamagotchi.git
cd Tiny-Tamagotchi
# Install dependencies
npm install
# Start dev server
npm run dev
# โ Open http://localhost:5173
# Run tests
npm run testThis project follows the Spec-Driven Development workflow:
- Constitution โ Define mission, tech stack, and roadmap
- Feature Loop (per feature):
- Plan โ
feature-plan.md - Requirements โ
requirements.md - Validation โ
validation.md - Implement โ write code following specs
- Validate โ run tests, manual checks
- Plan โ
- Replan โ review and update between features
The specs are the primary artifact โ they capture every decision and drive the implementation.
Snapshot of the spec-driven output at submission time:
| Metric | Value |
|---|---|
| Constitution docs | 3 (mission, tech-stack, roadmap) |
| Feature specs | 12 (4 features ร plan / requirements / validation) |
| Total spec files | 15 |
| Unit tests | 129 (6 suites: vitals, actions, states, personality, persistence, gameState) |
| Engine modules | 4 (gameState, vitals, states, personality) |
| Testing levels | 2 (automated Vitest + manual validation checklists per feature) |
| Easter-egg names | 11 (across sci-fi / aviation / personal themes) |
| Milestones | 4 (10 / 25 / 50 / 100 care actions) |
| Dynamic states | 3 (Normal / Sick / Evolved) with distinct decay multipliers |
- Unit tests: 129 tests across 6 suites โ covering vitals decay, care actions, state transitions, personality messages, easter eggs, milestones, and persistence
- Manual validation: Checklists in each feature's
validation.md(message variety, state transitions, easter eggs, responsive layout, persistence round-trips) - Two levels of difficulty: Automated (Vitest) + manual (visual / interaction checks)
npm run testAll 129 tests green โ evidence that the validation strategies in each validation.md are executable and passing.
Clean production build โ no errors, no warnings.
- Challenge: DeepLearning.AI 7-Day Learner Challenge
- Course: Spec-Driven Development with Coding Agents
- Deadline: April 22, 2026 โ 11:59 PM PST
- Paul Everitt โ Developer Advocate at JetBrains, instructor of the Spec-Driven Development with Coding Agents short course. The constitution / feature-loop / replan workflow applied throughout this project is his.
- JetBrains ร DeepLearning.AI โ for building and hosting the course and the accompanying 7-Day Learner Challenge.
- Claude (Anthropic) โ AI pair programmer. Drafted specs, implemented features, and surfaced edge cases under human-in-the-loop review at every step โ true to the SDD ethos that the human is the architect and the agent is the muscle.
Nikolaos Koroniadis
MSc Candidate โ Geography and Applied Geoinformatics
University of the Aegean
MIT โ see LICENSE.






