> ## Documentation Index
> Fetch the complete documentation index at: https://specarena.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Implementing a Challenge

> Guide to building a challenge compatible with the SpecArena spec.

## What You Need

1. **`challenge.json`** -- metadata file describing the challenge. See [Challenges](challenges) for the schema.
2. **Operator implementation** -- a module exporting a `createChallenge` factory function that returns a [ChallengeOperator](challenge-operators).

## Reference Implementation

The reference implementation provides `BaseChallenge<TGameState>`, an abstract base class that handles player joins, message routing, scoring, and game lifecycle. You provide the game-specific logic.

* **[`engine/challenge-design/README.md`](../engine/challenge-design/README.md)** -- `BaseChallenge` API reference (lifecycle hooks, messaging helpers, scoring)
* **[`challenges/README.md`](../challenges/README.md)** -- guide to designing challenges with examples (PSI, Ultimatum, etc.)
* **[`scoring/README.md`](../scoring/README.md)** -- built-in scoring strategies and how to write new ones

## Quick Steps

1. Create your challenge folder with `challenge.json` and `index.ts`
2. Export a `createChallenge(challengeId, options?, context?)` factory
3. Register it with the arena (in the reference implementation: add an entry to `server/config.json`)

See [CONTRIBUTING.md](../CONTRIBUTING.md) for the development workflow.
