The brief below is the canonical product spec all three agents were handed. It lives in the repo at
go-glm/specs/requirements.mdand is included verbatim here.
Build "GoTour" — an interactive Go syntax & toolchain tutorial
Audience & tone
The learner is an experienced software engineer (10+ yrs, polyglot). Skip CS fundamentals — no explanations of compilers, static typing, pointers-as-a-concept, concurrency theory, etc. Each lesson should answer "how does Go specifically spell this?" in 2–4 sentences plus a runnable example. Highlight Go's idioms and gotchas (e.g., nil maps panic on write, slice aliasing, for loop variable capture pre/post-1.22, value vs pointer receivers, zero-value usefulness, comma-ok idiom, defer evaluation timing).
Stack
- Vite + React 18 + TypeScript + Tailwind CSS
- Monaco Editor (
@monaco-editor/react) with thegolanguage registered for syntax highlighting - react-router-dom for lesson routing (
/lesson/:slug) - zustand for global state (current lesson, progress map)
- Node 20+, package manager: pnpm
Code execution architecture
Use the public Go Playground compile endpoint. It blocks browser CORS, so:
- Dev: add a Vite proxy in
vite.config.tsmapping/api/compile→https://play.golang.org/compile. - Prod: ship a tiny
server/Express (or Fastify) app exposingPOST /api/compilethat proxies to the same endpoint. Include aDockerfileand a README section on deploying the proxy. - Request format:
POSTwithContent-Type: application/x-www-form-urlencoded, bodyversion=2&body=<urlencoded source>&withVet=true. - Response shape:ts
type PlaygroundResponse = { Errors: string; Events: Array<{ Message: string; Kind: "stdout" | "stderr"; Delay: number }>; Status: number; IsTest: boolean; TestsFailed: number; VetErrors?: string; VetOK?: boolean; }; - Render
ErrorsandVetErrorsin red, replayEventshonoringDelay(nanoseconds) so streamed output feels real. Show a "Run" button (Cmd/Ctrl+Enter) and a "Reset" button that restores the original snippet.
Persistence
Use localStorage keyed under gotour:v1:
progress:Record<lessonSlug, "unstarted" | "in-progress" | "complete">editorDrafts:Record<lessonSlug, string>so edits survive reloadscheckpointScores:Record<checkpointId, { correct: number; total: number; lastAttempt: ISOString }>
Sidebar shows a checkmark next to completed lessons and a progress bar per section. A "Reset progress" button in the footer clears the namespace.
Information architecture
Single-page app, three-pane layout on lg+ screens:
┌──────────────┬───────────────────────────┬──────────────────┐
│ Sidebar │ Lesson prose (markdown) │ Monaco editor │
│ (sections + │ + inline mini-snippets │ + Run output │
│ lessons) │ │ + Reset │
└──────────────┴───────────────────────────┴──────────────────┘On md collapse to two panes (prose above editor); on mobile, stack vertically.
Top bar: GoTour logo, search (filters lesson titles + content), keyboard-shortcut hint, theme toggle (light/dark, default dark).
Lesson content (author all of these — full reference tour)
Lessons live as MDX or as typed objects in src/content/lessons.ts. Each lesson has: slug, title, section, body (markdown), starterCode, expectedOutputHint?, checkpoint?. Aim for ~150–400 words of prose per lesson plus one runnable snippet.
Section A — Language fundamentals
- Hello, world & program structure (
package main,import,func main) go runvsgo build(brief, links to toolchain section)- Variables:
var,:=, multiple assignment, blank identifier - Constants &
iota(incl. bit-flag pattern, expression repetition rule) - Basic types, zero values, type conversions (no implicit conversion)
- Strings, runes, bytes; UTF-8 iteration with
range - Numeric types, overflow, untyped constants
Section B — Control flow
if(incl. init statement)for(the only loop: 3-clause, while-style, infinite,range)- Loop variable capture (pre-1.22 vs 1.22+ semantics)
switch(no fallthrough by default, expression-less, multi-value cases)type switchdefer(LIFO, argument evaluation timing, common gotchas in loops)goto, labels, labeledbreak/continue
Section C — Composite types
- Arrays (fixed length, value semantics)
- Slices (header layout,
appendgrowth, three-index slicing,copy, aliasing pitfalls) - Maps (zero value is nil, comma-ok, deletion, iteration order)
- Structs (composite literals, field tags, anonymous fields, comparability)
- Pointers (no arithmetic,
new, taking address of composite literal)
Section D — Functions
- Functions, multi-return, named returns, naked
return - Variadic functions, slice-spread with
... - First-class functions & closures
- Methods, value vs pointer receivers, method sets, addressability
Section E — Interfaces & polymorphism
- Interfaces, implicit satisfaction, the empty interface (
any) - Type assertions, comma-ok form, type switches revisited
- Embedding (struct embedding, interface embedding, method promotion)
- Common stdlib interfaces:
error,Stringer,io.Reader/Writer
Section F — Generics
- Type parameters, type inference
- Constraints,
comparable,~underlying-type approximation, type sets - When not to reach for generics
Section G — Errors, panic, recover
- The
errorinterface, sentinel errors,errors.Is/errors.As - Wrapping with
fmt.Errorf("...: %w", err) panic/recoverand when each is appropriate
Section H — Concurrency
- Goroutines (cost, scheduler hand-wave, lifecycle)
- Channels: unbuffered vs buffered, send/receive semantics
close,rangeover channels, nil channel behaviorselect(incl. default case, timeouts withtime.After)sync:Mutex,RWMutex,WaitGroup,Once,Condsync/atomicand the memory model in one paragraphcontext.Context— cancellation, deadlines, values (with anti-patterns)
Section I — Packages & project layout
- Packages, exported vs unexported (capitalization rule)
init()order, package-level variable initializationinternal/directories, import paths,go.modmodulepath//go:embed
Section J — Reflection & low-level
reflectbasics (TypeOf,ValueOf, kind vs type)unsafe.Pointerandunsafe.Sizeof(mention, don't encourage)cgo(one-paragraph awareness page)- Build tags (
//go:build) and conditional compilation
Section K — Toolchain
go run,go build, output paths,-ogo installandGOBINgo mod init/tidy/get/why/graph/replace/vendorgo workmulti-module workspacesgo test: table tests, subtests witht.Run,-runregex,t.Parallelgo test: benchmarks, examples, fuzzing (go test -fuzz)go test -race,-cover,-coverprofile,go tool covergo fmt/gofmt/goimportsgo vetand common analyzersgo docand pkg.go.dev conventionsgo generatedirectivesgo env,GOPATH,GOMODCACHE,GOPROXY,GOPRIVATE,GOFLAGS- Cross compilation:
GOOS/GOARCHmatrix,CGO_ENABLED=0 -ldflags(stamping versions),-trimpath, build modesgo tool pprofandgo tool trace(CPU/heap profiling cheatsheet)
Checkpoints
After each section, insert a checkpoint lesson with 3–5 multiple-choice or fill-in-the-blank questions targeting idiomatic Go gotchas (not trivia). Examples:
- "What does this snippet print?" with a slice-aliasing trap
- "Which receiver type should
Scaleuse?" — pointer, because it mutates - "What happens when you send on a closed channel?" — panic
Score persists in localStorage. A passing score (≥80%) marks the section complete.
Search
Client-side fuzzy search over {title, section, body} with Fuse.js. Cmd/Ctrl+K opens a command palette.
Visual design
Dark-first, IDE-adjacent. Mono font for code (JetBrains Mono via @fontsource). Accent color: Go's gopher cyan #00ADD8. Subtle, not playful. Generous whitespace, prose width capped at ~72ch. Code panes use Monaco's vs-dark (dark) and vs (light). No emoji decoration.
Project structure
.
├── package.json
├── pnpm-lock.yaml
├── vite.config.ts # incl. /api/compile dev proxy
├── tailwind.config.ts
├── postcss.config.js
├── tsconfig.json
├── index.html
├── src/
│ ├── main.tsx
│ ├── App.tsx
│ ├── routes.tsx
│ ├── components/
│ │ ├── Layout.tsx
│ │ ├── Sidebar.tsx
│ │ ├── LessonView.tsx
│ │ ├── CodeRunner.tsx # Monaco + Run + output replay
│ │ ├── Checkpoint.tsx
│ │ ├── CommandPalette.tsx
│ │ └── ProgressBar.tsx
│ ├── content/
│ │ ├── lessons.ts # typed lesson registry
│ │ └── lessons/ # one .ts (or .mdx) per lesson
│ ├── lib/
│ │ ├── playground.ts # POST /api/compile, replay Events
│ │ ├── storage.ts # localStorage helpers
│ │ └── search.ts # Fuse.js wrapper
│ ├── store/
│ │ └── progress.ts # zustand store
│ └── styles/
│ └── globals.css
├── server/
│ ├── package.json
│ ├── src/index.ts # Express proxy for /api/compile
│ └── Dockerfile
└── README.mdAcceptance criteria
pnpm install && pnpm devboots the app atlocalhost:5173with the dev proxy working against the live Go Playground.pnpm build && pnpm previewserves a production build.cd server && pnpm install && pnpm devruns the prod proxy on:8787; document the env varPLAYGROUND_UPSTREAM(defaulthttps://play.golang.org/compile).- Every lesson listed above exists and runs at least one snippet successfully against the Playground (
Hello, worldand beyond — concurrency lessons must produce expected interleaved output). - Cmd/Ctrl+Enter runs the focused snippet; Cmd/Ctrl+K opens search.
- Reload preserves: current lesson, editor draft for that lesson, completion state, checkpoint scores.
- Lighthouse scores: Performance ≥ 90, Accessibility ≥ 95 on a desktop run of the deployed
preview. - All keyboard shortcuts and the lesson list are documented in
README.md. - Zero
anyin non-test TypeScript. ESLint + Prettier configured and clean.
Constraints
- Do not introduce a UI framework beyond Tailwind (no shadcn, no MUI). Build the few components needed by hand.
- Do not server-render. Pure SPA.
- Do not include analytics, auth, or telemetry.
- Comments in code: only where the why is non-obvious. No filler docstrings.
- One commit per section is fine; final state must be working end-to-end.
Deliverables
- The full repo as described.
- A README with: prereqs, dev/prod commands, proxy deployment notes (incl. a one-liner for Fly.io or Render), lesson-content authoring guide, and a list of every lesson slug.
- A short
CONTRIBUTING.mddescribing how to add a new lesson (one file insrc/content/lessons/, register inlessons.ts, optional checkpoint).