Skip to content

marcoemrich/EXACT-Coding-Exercises

Repository files navigation

EXACT Coding - Exercises

Exercise setup for the EXACT Coding workshop: EXample-guided, AI-Collaborative & Test-driven Development.

Workshop

Test-Driven, AI-Assisted Development for Maintainable Code.

This hands-on workshop introduces EXACT Coding -- a pragmatic workflow for AI-assisted development focusing on readability, refactorability, and maintainability. Participants work in pairs and groups of three (driver + two navigators) through short modules with extensive exercises.

Topics

  • Test-Driven Development (TDD)
  • Example Mapping
  • Mob/Ensemble Programming
  • AI Tools (Claude Code and Cursor)
  • EXACT Coding Workflow

Trainers

Ferdi Ade & Marco Emrich

Setup

There are two ways to set up the project: using the Dev Container (recommended) or a local installation.

Option A: Dev Container (recommended)

The repo includes a Dev Container configuration with Node.js, Claude Code, and a restrictive firewall pre-installed.

Prerequisites

API Key Configuration

Option 1: Direct API key -- set the environment variable on your host before opening the container:

export ANTHROPIC_API_KEY="sk-ant-..."

Option 2: Portkey proxy -- configure in ~/.claude/settings.json on your host:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.portkey.ai",
    "ANTHROPIC_AUTH_TOKEN": "dummy",
    "ANTHROPIC_CUSTOM_HEADERS": "x-portkey-api-key: <your-key>"
  }
}

The container automatically mounts ~/.claude/ from your host, so your settings are available inside the container.

Starting the Dev Container

  1. Open the project folder in VS Code (File -> Open Folder, not as workspace)
  2. VS Code will prompt: "Reopen in Container" -- click it
  3. Or manually: Ctrl+Shift+P -> "Dev Containers: Reopen in Container"
  4. Wait for the container to build (first time takes a few minutes)

After startup, run npm install in the terminal, then verify with the checks below.

Option B: Local Installation

Prerequisites

  • Node.js (v20 or higher)
  • npm
  • Claude Code (npm install -g @anthropic-ai/claude-code)

Installation

npm install

Running Tests

npm test

Watch Mode

npm run test:watch

Verify Your Setup

Run the following checks to make sure everything is working (both local and Dev Container).

1. Node.js installed?

node --version
# Expected: v20 or higher (e.g. v24.9.0)

2. Claude Code installed and API key configured?

claude -p "respond with: setup ok"
# Expected: "setup ok" (or similar short response)

If this hangs or returns an authentication error, your API key is not configured correctly. See the Claude Code docs for setup instructions.

3. Dependencies installed and tests passing?

npm install
npm test

Expected test output:

 ✓ src/example.spec.ts (1 test)

 Test Files  1 passed (1)
      Tests  1 passed (1)

If all checks pass, you're ready for the workshop!

Claude Code Configuration

This repo ships with a preconfigured .claude/ directory that enforces the EXACT Coding workflow when using Claude Code. The configuration consists of Rules, Agents, and Commands.

Rules (.claude/rules/)

Rules are loaded automatically into Claude's context at startup. They define the guardrails for the entire session.

File Purpose
tdd.md Core TDD workflow -- mandates the use of specialized agents for every TDD phase
human-in-the-loop.md Checkpoint rules -- Claude must stop after every phase (Red, Green, Refactor) and wait for explicit approval
tdd_with_ts_and_vitest.md TypeScript & Vitest conventions (test file naming, imports, test execution)

Agents (.claude/agents/)

Agents are specialized sub-agents that run in an isolated context. Each agent focuses on exactly one TDD phase, preventing context pollution and enforcing discipline.

Agent Phase Description
test-list Test List Creates it.todo() entries for base functionality, ordered simple to complex
red Red Activates ONE test, makes a prediction (Guessing Game), verifies it fails for the right reason
green Green Implements the minimal code to make the failing test pass (hardcoded returns are fine!)
refactor Refactor Applies the Four Rules of Simple Design and calculates APP mass before/after
code-improvement-scanner Review Analyzes code for readability, performance, and best practice improvements

Commands (.claude/commands/)

Commands are slash commands that can be invoked manually during a Claude Code session (e.g. /red, /green, /refactor). They provide the same functionality as agents but run in the main context instead of an isolated one.

Command Usage
/test-list Create a test list with it.todo() entries
/red Enter Red phase -- activate a test and predict the failure
/green Enter Green phase -- write minimal implementation
/refactor Refactor using Simple Design Rules and APP
/code-review Multi-stage code review (Review -> Evaluation -> Conclusion)

Agents vs. Commands

Agents Commands
Context Isolated (fresh context per phase) Shared (main conversation context)
Invocation Automatic (via rules) Manual (/command-name)
Best for Strict TDD discipline Quick, interactive use

TDD Workflow

The typical EXACT Coding workflow with Claude Code:

  1. Start -- Claude automatically uses the test-list agent to create it.todo() entries
  2. Red -- The red agent activates one test, predicts the failure, verifies it fails
  3. Green -- The green agent writes minimal code to make the test pass
  4. Refactor -- The refactor agent improves the code (naming, duplication, APP mass)
  5. Repeat -- Back to step 2 for the next test

After every phase, Claude stops and asks for approval before continuing (Human-in-the-Loop).

About

Exercise repo for the EXACT Coding workshop -- Example-guided, AI-Collaborative & Test-driven Development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors