| name | sysdesign-impl |
| description | Scaffold a minimum-viable implementation of a designed system. Activated when the user is ready to write code. Reads sdd.md (or falls back to mock-interview.md), determines the smallest component subset that lets the design's NFRs be testable (NOT a full production build โ single-region, in-memory or single-container infra, no CDN, no multi-region), asks the user for the language/framework stack (default Spring Boot + PostgreSQL + Kafka per project's existing skill set), then scaffolds <topic>/source/ with per-service directories, a docker-compose.yml that brings everything up locally, and test-results/ scaffolding for functional / load / failure tests. The point is verification of design assumptions, not production. |
| triggers | ["๊ตฌํํ์","๊ตฌํํด๋ณด์","๊ตฌํ ์์","์ฝ๋ ๋ง๋ค์ด","์ฝ๋ ์ง๋ณด์","์ต์ ๊ตฌํ","MVI ๋ง๋ค","mvi ๋ง๋ค","minimum viable implementation","implementation ์์","implementation ๋ง๋ค","์์ค ์ค์บํด๋","์ค์บํด๋ฉ ํด์ค","scaffold","ํ๋กํ ํ์
๋ง๋ค","prototype ๋ง๋ค","์ต์ ์ด์","๋์ ๊ฐ๋ฅํ ์ต์"] |
| allowed-tools | Read, Write, Edit, Glob, Grep, Bash |
sysdesign-impl โ Phase 6 (Minimum-Viable Implementation)
You are scaffolding the smallest runnable system that lets the user verify
design decisions from the SDD. Not production. Not 100M-DAU-ready. Just enough
to:
- Run end-to-end via
docker-compose up
- Run functional tests (API behaves as designed)
- Run small-scale load tests (NFR shape verifiable, even if absolute numbers smaller)
- Inject one or two failure scenarios
Operating procedure
Step 0. Identify active topic
TOPIC=$(cat .omx/state/active-sysdesign-topic.txt 2>/dev/null)
If empty โ ask user. Confirm: "ํ์ฌ ํ์ฑ: <TOPIC>. ์ด ํ ํฝ ๊ตฌํ ์ค์บํด๋ฉํ๋ค."
Step 1. Read the design
Try in order:
<TOPIC>/System-Design-Document/sdd.md โ preferred
<TOPIC>/System-Design-Document/mock-interview.md โ fallback (warn user: "SDD ์์ด mock-interview๋ง ๋ณด๊ณ ์งํ. ADR / Risk / Rollout ์ ๋ณด ์์. ๊ณ์ ๊ฐ๋ ๋ผ?")
- Neither โ abort: "๋์์ธ ๋ฌธ์ ์์. sysdesign-design ๋จผ์ ."
Step 2. Decide MVI subset
This is the hardest step. The full design has many components; the MVI has
only what's needed to test the design's most consequential decisions.
Use this framework to decide what's IN vs OUT:
| Component class | IN MVI | OUT MVI |
|---|
| Application services | ALL services that own a distinct domain (per design) | none |
| Database | 1 instance of the chosen engine (no replicas) | Replication, sharding, multi-master |
| Cache | 1 Redis (or Memcached) instance โ only if cache is a load-bearing decision in the design | Cache cluster, multi-tier, CDN |
| Message queue | 1 Kafka broker (or RabbitMQ) โ only if async/event-driven was a load-bearing decision | Multi-broker cluster, multi-region replication |
| Load balancer | nginx in compose (or skip โ clients hit services directly for tests) | HA LB pair, GeoDNS |
| API Gateway | Skip unless explicitly tested | (always) |
| CDN | Skip โ not testable in compose | (always) |
| Multi-region | Skip โ single-region | (always) |
| Service discovery | Skip if โค3 services (compose hostnames suffice) | ZooKeeper / Consul / etcd |
| Auth/SSO | Stub (hardcoded token) โ unless the SDD explicitly designs auth | Production OAuth/OIDC |
| Observability | docker-compose include Prometheus + Grafana only if NFR includes specific metric SLOs | Full APM, distributed tracing |
| Background jobs | 1 worker per job type | Auto-scaling, priority queues |
Concrete examples (drawn from sysdesign-question-bank/problems/):
- chat-system MVI: 2 chat servers (WebSocket) + 1 Kafka + 1 Cassandra (or Postgres for simplicity) + nginx. Skip: presence pub/sub fan-out, push notifications, ZooKeeper.
- url-shortener MVI: 1 web service + 1 Postgres + 1 Redis. Skip: replicas, CDN, analytics pipeline.
- news-feed MVI: 1 post service + 1 fan-out worker + 1 feed service + 1 Postgres + 1 Redis + 1 Kafka. Skip: graph DB for friends (use Postgres table), CDN for media.
- rate-limiter MVI: 1 API gateway service + 1 Redis. Skip: distributed Redis, multi-region.
Propose the MVI to user as a table:
"SDD์์ ์ค๊ณํ ์ปดํฌ๋ํธ ์ค MVI์๋ ๋ค์๋ง ํฌํจ:
| Component | In MVI? | Why / Why not |
|---|
| chat-server-A, chat-server-B | โ | ํต์ฌ โ WebSocket + ๋ฉ์์ง ๋ผ์ฐํ
๊ฒ์ฆ |
| Kafka (1 broker) | โ | ๋ฉ์์ง ํ ๊ฒฐ์ ๊ฒ์ฆ (async fan-out) |
| Cassandra | โ โ Postgres๋ก ๋์ฒด ์ถ์ฒ | ๋จ์ผ ๋
ธ๋ ์ด์ ๋จ์ํ. Cassandra์ wide-row ํน์ฑ ๊ฒ์ฆ์ด ํต์ฌ NFR์ด๋ฉด ๊ทธ๋๋ก ๊ฐ๋ ๋จ |
| ์๋ฆผ ์๋น์ค | โ | offline ํธ์๋ ๋ณ๋ ํ๋ก์ฐ โ MVI ์ธ |
| ZooKeeper | โ | 2๊ฐ ์๋ฒ๋ compose ํธ์คํธ๋ช
์ผ๋ก ์ถฉ๋ถ |
์ด๋๋ก ๊ฐ๋ ๋ผ? ์ถ๊ฐ/์ ์ธํ ๊ฑฐ ์์ด?"
Step 3. Stack selection
Default stack (per AGENTS.md skills bias toward Spring Boot):
- Language/framework: Spring Boot 3 / Java 21
- DB: PostgreSQL (or Cassandra/MongoDB if SDD demands it)
- Cache: Redis
- Queue: Kafka
- Container: docker-compose
- Build: Gradle
- Test: JUnit 5 + Testcontainers + k6 (load) + Toxiproxy (failure injection)
Ask user:
"Stack ๊ธฐ๋ณธ์ Spring Boot 3 / Postgres / Redis / Kafka / docker-compose / k6.
๋ฐ๊ฟ ๊ฑฐ ์์ด? (Node, Go, Python ๊ฐ๋ฅ)"
User may pick stack โ adjust scaffolding accordingly. Do not add stack-specific
scaffolding before user confirms.
Step 4. Scaffold
For each IN-MVI service, create <TOPIC>/source/<service-name>/:
<TOPIC>/source/<service-name>/
โโโ build.gradle (or package.json / go.mod / pyproject.toml)
โโโ Dockerfile
โโโ src/main/... (entrypoint + minimum API per SDD)
โโโ src/test/... (1 unit test, 1 integration test stub)
If existing .codex/skills/new-feature or domain-modeling / layer-architecture
skills apply (Spring Boot + DDD + TDD), follow their conventions. Otherwise apply
project-wide conventions from AGENTS.md:
- DDD layered: api โ application โ domain โ infra
- TDD: write 1 failing test first (RED), then implement to GREEN
- Domain layer infra-free
- per-topic isolation (no shared code with other topics)
- AI ์์ฑ ํฐ ๊ธ์ง (no TODO comments / boilerplate explanation)
Create <TOPIC>/source/docker-compose.yml:
version: "3.9"
services:
service-a:
build: ./service-a
ports: ["8080:8080"]
depends_on: [postgres, kafka]
postgres:
image: postgres:16
environment:
POSTGRES_DB: <topic>
POSTGRES_PASSWORD: dev
ports: ["5432:5432"]
kafka:
image: confluentinc/cp-kafka:latest
Create <TOPIC>/test-results/ scaffolding:
<TOPIC>/test-results/
โโโ functional-test.md (template: API checks)
โโโ load-test.md (template: k6 script + result summary)
โโโ failure-test.md (template: chaos scenarios)
โโโ reports/
Step 5. NFR test mapping
For each NFR in SDD ยง9, generate a corresponding test stub. Examples:
| NFR | Test type | Stub |
|---|
| p99 < 100ms | Load test (k6) | k6 run --vus 100 --duration 60s scripts/p99.js + assertion p(99) < 100 |
| 99.99% availability | Failure test | Toxiproxy: kill DB for 30s, verify circuit breaker engages, no 5xx storm |
| 12K RPS sustained | Load test | k6 ramp to 12000 RPS for 5 min |
| Fan-out delivery <1s | Functional test | Post message, assert all subscribers receive within 1s |
Write these as test scripts, not just docs. Place under <TOPIC>/source/<service>/load-tests/ or <TOPIC>/test-results/scripts/.
Step 6. Smoke run + report
cd "$TOPIC/source"
docker-compose up -d --build
sleep 10
docker-compose ps
curl -fsS http://localhost:8080/healthz || echo "service not healthy yet"
docker-compose down
Report to user:
"โ MVI ์ค์บํด๋ฉ ์๋ฃ.
<TOPIC>/source/ โ {N๊ฐ ์๋น์ค} + docker-compose.yml
<TOPIC>/test-results/ โ functional / load / failure ํ
ํ๋ฆฟ
- ์ค๋ชจํฌ ๊ฒฐ๊ณผ: ๋ชจ๋ ์๋น์ค up, /healthz 200 OK
๋ค์ ๋จ๊ณ (์๋):
cd <TOPIC>/source && docker-compose up
- functional ํ
์คํธ ์คํ
- k6 load ํ
์คํธ โ NFR ์ถฉ์กฑ ๊ฒ์ฆ
- ๊ฒฐ๊ณผ โ
<TOPIC>/test-results/{type}.md ์ ๊ธฐ๋ก
- SDD 'Findings vs Assumptions' ์น์
์
๋ฐ์ดํธ (์ค์ธก์ด ๊ฐ์ ๊ณผ ๋ค๋ฅธ ๋ถ๋ถ)"
Step 7. Mark topic as "shipped"
source/ ์ ์ค์ ํ์ผ์ด ๋ค์ด๊ฐ์ผ๋ ํ ํฝ์ด shipped ์ํ๋ก ์๋ ๋ถ๋ฅ๋ฉ๋๋ค
(cleanup-logs.mjs๊ฐ source/ ๋น์ด์๋์ง๋ก shipped ํ์ ). conversation-log/
๋ ๋ค์ SessionStart๋ถํฐ shipped ๋ณด์กด ์ ์ฑ
(3์ผ)์ด ์ ์ฉ๋ฉ๋๋ค.
ํ ํฝ์ ๋ค๋ฅธ ํ ํฝ์ผ๋ก ๊ฐ์ํ ์ค๋น๊ฐ ๋๋ค๋ฉด .omx/state/active-sysdesign-topic.txt
๋ ์ฌ์ฉ์๊ฐ ์ sysdesign-design ํธ์ถํ๋ฉด ์๋ ๋ฎ์ด์จ์ง๋๋ค โ ๋ณ๋ ์ก์
๋ถํ์.
Hard rules
| Rule | Why |
|---|
| MVI๋ production์ด ์๋. CDN / multi-region / replica / HA cluster๋ ์๋ OUT. | ์ค์ฝํ ํญ์ฃผ ๋ฐฉ์ง. ๊ฒ์ฆ ๊ฐ๋ฅํ ์ต์๊ฐ ๋ชฉ์ . |
| Stack์ ์ฌ์ฉ์ ํ์ธ ํ์๋ง ์ค์บํด๋ฉ ์์. | Default ๊ฐ์ ์ผ๋ก ์ฝ๋ ์๋ฐฑ ์ค ์ฐ๋ฉด ์์ค. |
| ๋ชจ๋ NFR์ ๋์๋๋ test stub์ด ์์ด์ผ ํจ. NFR ๊ฒ์ฆ ๋ชป ํ๋ฉด MVI ๊ฐ์น ์์. | SDD โ test traceability. |
<topic>/source/ ์ธ ๋ค๋ฅธ ๊ณณ (์: ๋ค๋ฅธ ํ ํฝ dir, .codex/) ์ ๋ ์ ๊ฑด๋๋ฆผ. | per-topic isolation. |
| docker-compose๊ฐ ๋ ์ผ๋ง "์ค์บํด๋ฉ ์๋ฃ". ์ ๋จ๋ฉด in_progress. | "๋์ ๊ฐ๋ฅํ ์ต์" ์ ์ ์ถฉ์กฑ. |
| ๊ธฐ์กด sysdesign-* ์ธ ์คํฌ (domain-modeling / layer-architecture / tdd-patterns / event-driven / saga-pattern)์ด stack์ ๋ง์ผ๋ฉด ๊ทธ ์ปจ๋ฒค์
๋ฐ๋ฆ. | DRY + ํ๋ก์ ํธ ์ผ๊ด์ฑ. |