Skip to content
Public template

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

RS React — course starters (AI era)

Starter projects for the RS School React course. Each course module has its own branch with a ready-to-run project, the task spec and theory in docs/, and an AI coaching harness: you build the app with an AI assistant coaching you, not writing it for you.

main is the task-less template the module branches are generated from. There is nothing to build on main — pick a module branch below.

Module branches

Branch Task
functional-components Task 1 — Functional Components, State & Testing
routing Task 2 — Routing, SPA
state-management Task 3 — State Management + Context
queries Task 4 — Data Queries
advanced-hooks Task 5 — Advanced Hooks & Patterns
forms Task 6 — Forms
nextjs-ssr-ssg Task 8 — Next.js SSR / SSG

On every module branch:

  • 📋 What to build: docs/TASK.md — requirements, feature/points breakdown, penalties.
  • 📚 What to read: docs/ — curated theory per topic and an index (docs/README.md) mapping each decision to its reading.
  • 🤖 How the AI must help you: AGENTS.md — the coaching contract (canonical source: CLAUDE.md).
  • 📝 Your decision log: CHANGELOG.md — mandatory (missing = -90 points).

How to use this repo

  1. Create your own repository from this template: on GitHub, click Use this template → Create a new repository, and tick Include all branches — otherwise you only get main and none of the module branches.

  2. Clone your repository and install the prerequisites below.

  3. For each module, create your working branch from that module's branch:

    git switch functional-components
    git switch -c functional-components_your-github-account
    pnpm install
  4. Work on your branch, commit, and push it to your repository.

  5. Open a pull request from your branch into the module branch (e.g. functional-components_your-github-account → functional-components) in your repository. That PR is what gets reviewed.

Branch rules

  • Working branches are named {module_name}_{github_account}, where {module_name} is the module branch you started from — e.g. functional-components_my-shiny-github-acc → functional-components.
  • Pull requests go into the module branch only — never into main.
  • Don't merge one module's work into another module's branch; each module starts from its own branch.

Prerequisites

  • Node.js 24 (LTS) — the version CI uses. .nvmrc pins it, so nvm use / fnm use picks it up.
  • pnpm — install it once with corepack enable or from https://pnpm.io/installation. Other package managers are blocked (only-allow pnpm).

Quick start

pnpm install     # install dependencies + set up Husky hooks
pnpm dev         # start Vite dev server
pnpm test        # run Vitest (unit/component) once
pnpm coverage    # run unit tests with coverage (statements >= 80% required)
pnpm e2e         # run Playwright end-to-end tests (builds + serves the app)
pnpm lint        # Oxlint
pnpm format      # Oxfmt (check); pnpm format:fix to write
pnpm build       # type-check + production build

First E2E run: pnpm exec playwright install chromium downloads the browser once.

What's already set up

  • Vite + React 19 + TypeScript (strict, no any, no ts-ignore).
  • Oxlint (.oxlintrc.json — recommended + React/TypeScript/jsx-a11y) as the linter.
  • Oxfmt (.oxfmtrc.json) as the formatter — one unified oxc toolchain with Oxlint.
  • Vitest + React Testing Library + jsdom + jest-dom for unit/component tests (a smoke test is in src/App.test.tsx — replace it with real tests).
  • Playwright for end-to-end tests (config in playwright.config.ts, specs in e2e/; a smoke spec is included). Vitest owns src/**, Playwright owns e2e/** — separate globs.
  • Husky hooks: pre-commit runs verify:harness + lint + format, pre-push runs verify:harness + test. (E2E runs in CI, not in local hooks — browser downloads are heavy.)
  • Per-assistant enforcement hooks (on top of the instruction files below):
    • Claude Code (.claude/settings.json): starts in plan mode, uses the course's Coach output style (.claude/output-styles/coach.md, part of the system prompt), and a UserPromptSubmit hook re-states the coaching contract each turn. Personal overrides go in .claude/settings.local.json (git-ignored).
    • Codex (.codex/config.toml): a UserPromptSubmit hook re-injects the same contract every turn (runs once you trust the project in Codex).
    • Cursor (.cursor/hooks.json): the contract is always applied via .cursor/rules/coaching.mdc; a beforeSubmitPrompt hook additionally blocks if the instruction files have been stripped.
  • Coaching skills (.claude/skills/, mirrored to .agents/skills/) — see below.
  • Playwright MCP, opt-in (.mcp.json, .cursor/mcp.json, .codex/config.toml) — see below.
  • Optional: add MSW yourself if you prefer it over Vitest mocks for the network layer.

Working with your AI assistant

Whichever assistant you use follows the same coaching rules. AGENTS.md is the cross-tool standard baseline — the open agents.md convention read by Codex, OpenCode, Kiro, Windsurf, Amazon Q, Aider, Gemini, Zed, VS Code, and more. The other files below carry the same full rules (not pointers) as redundancy for assistants that prefer their own file:

Assistant Instruction file
Any tool / the standard AGENTS.md
Claude CLAUDE.md (canonical source)
GitHub Copilot .github/copilot-instructions.md
Gemini GEMINI.md
Cursor .cursor/rules/coaching.mdc

Using another assistant? Whatever tool you use, point it at AGENTS.md (or CLAUDE.md) — the same coaching rules apply no matter which file loaded. Convenience hooks (plan-mode default, a per-turn reminder, a tamper tripwire) ship for Claude/Codex/Cursor, but the rules don't depend on them.

The assistant will: not write the whole app; ask you to plan first; at each decision point lay out the options + the criteria to weigh them + what to read in docs/, then let you choose and justify (it will decline "just build it" and "which is better? / you decide" — it won't hand you the pick); and record every decision in CHANGELOG.md. You own the code and must be able to explain every line.

This repo ships a coaching-harness integrity check (pnpm verify:harness, run by the Husky hooks and CI): it confirms the instruction files and the in-code AI-COACH-RULES notes are present. Removing them is not the assignment — the check will fail your commit, and it's visible in review.

Coaching skills

Slash-command helpers that coach, never implement — they report findings, point to the reading and ask you questions; you make the changes. You run them on purpose (/review, /quiz-me, …); the AI can suggest them but never triggers them by itself.

Always available What it does
/explain [concept] Explains a concept with a small example unrelated to your task + where to read
/options [decision] Options + criteria + reading for a decision — you pick
/review [path] Findings on your changes (severity, rule, reading) — no rewrites
/test-ideas Behaviors worth testing (Given/When/Then) — no test code
/debug-coach Hypotheses + what to inspect — not the fix
/quiz-me, /defend Self-check and a mock cross-check on your own code
/log-decision Drafts the CHANGELOG.md entry from your words

Topic skills (/hooks-review, /routing-review, /state-review, /query-review, /a11y-review, /composition-review, /forms-review, /rsc-review, /e2e-review, …) ship on the module branches whose task needs them (none on main) and are switched on in .claude/settings.json → skillOverrides. If a branch ships one that is off, turn it on for yourself in the git-ignored .claude/settings.local.json:

{ "skillOverrides": { "a11y-review": "on" } }

Skills used for a step are noted in CHANGELOG.md. Assistants other than Claude Code read the same skills from .agents/skills/; the coaching rules are written into each skill, so they apply there too.

Browser MCP (Playwright, opt-in)

Lets your assistant open the running app to inspect it — accessibility tree, console, network — so it can help you debug and explore role-based locators. It is off until you enable it, pinned to one version, headless, and configured with --codegen none.

  • Claude Code: asks for approval the first time (.mcp.json).
  • Cursor: enable playwright under Settings → MCP (.cursor/mcp.json).
  • Codex: shipped with enabled = false; run codex -c mcp_servers.playwright.enabled=true to opt in.
  • VS Code / Copilot: discovers .mcp.json in trusted workspaces; disable it for yourself via MCP: List Servers.

It will not write your E2E tests — those are graded work. Playwright's test agents (npx playwright init-agents: planner / generator / healer) are not allowed here, and the harness check fails if their files appear.

Creating a module branch from main (course authors)

  1. Branch off main: git switch main && git switch -c <module> — the branch name is the module name (students' branches are <module>_<github-account>). Add the branch to the table at the top of this README on main.
  2. package.json: set name (rs-react-<module>) and aiCoaching.task (e.g. "Task 3") — the mirror headers read this label.
  3. docs/TASK.md: paste the task spec from react/modules/tasks/. Make every relative link absolute (theory modules → https://github.com/rolling-scopes-school/tasks/tree/master/react/modules/<topic>), and replace the "Fresh repository; dedicated branch; first commit only README.md" requirement with this repo's workflow (branch <module>_<github-account> from <module>, PR into <module>, never main). Add one theory file per topic (copied from react/modules/<topic>/README.md) and fill the decision → reading table in docs/README.md.
  4. CLAUDE.md: set the H1, §1 context (the app being built), and §4 task-specific decision points (options + criteria + reading — never a recommended pick). Then run pnpm instructions:sync.
  5. scripts/verify-harness.mjs: add the theory file(s) to docsFiles.
  6. Topic skills: add the task's topic skills to .claude/skills/ (keep the COACH-SKILL preamble and disable-model-invocation: true), switch them on in .claude/settings.json → skillOverrides, and run pnpm instructions:sync to mirror them into .agents/skills/.
  7. Tasks without E2E (1, 7): remove @playwright/test, playwright.config.ts, e2e/, the e2e* scripts, the CI browser/E2E steps, and playwright.config.ts from sentinelFiles.
  8. Rename the placeholder heading (index.html title, src/App.tsx, both smoke tests), set the CHANGELOG.md title, then run pnpm install && pnpm verify:harness && pnpm lint && pnpm format && pnpm test.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages