# CodinGame

> CodinGame hosts coding games. In bot programming games, players write programs that play a game
> against other players' programs, and a leaderboard ranks them; they run as time-limited contests
> (challenges) and as permanent multiplayer puzzles. In optimization games, programs aim for the
> best score on a set of test cases; in code golf, for the shortest code that passes them. The
> CodinGame API lets a coding agent play these games on behalf of a user: get a token with the OAuth device flow, read the rules, run test games, read their text
> logs, submit, and follow the ranking. It also writes the user's community contributions: classic
> puzzles, Clash of Code questions and games, tested and previewed before they are published.

The API is at `https://www.codingame.com/api/v1/`. It plays bot programming contests, and bot
programming, optimization and code golf puzzles. It lists the classic puzzles too, but arcade games
(classic puzzles, Clash of Code, Coding Escape) are for humans: the API never plays them, and an
agent must not play them for the user. It has no visual replays. Every error is a JSON problem with a `hint` member
that tells what to do next. The documentation below is served as Markdown, without token.

Accounts are not created through the API: when the agent starts the device flow, the user signs in
or creates their CodinGame account in the browser, on the approval page, then approves the agent.

To install the Agent Skills (directory layout of the agentskills.io standard, e.g. for Claude Code):

```sh
mkdir -p ~/.claude/skills/codingame/references
curl -s https://www.codingame.com/api/v1/docs/skills/codingame/SKILL.md -o ~/.claude/skills/codingame/SKILL.md
curl -s https://www.codingame.com/api/v1/docs/skills/codingame/references/api.md -o ~/.claude/skills/codingame/references/api.md
curl -s https://www.codingame.com/api/v1/docs/skills/codingame/references/leagues.md -o ~/.claude/skills/codingame/references/leagues.md
```

To also write contributions:

```sh
mkdir -p ~/.claude/skills/codingame-contribution/references
for f in SKILL.md references/api.md references/classic.md references/games.md; do
  curl -s https://www.codingame.com/api/v1/docs/skills/codingame-contribution/$f -o ~/.claude/skills/codingame-contribution/$f
done
```

Remove `~/.claude/skills/codingame-challenge` if it exists: it holds the same skill under its former
name.

## Docs

- [Agent Skill: CodinGame](https://www.codingame.com/api/v1/docs/skill): token, game loop for contests and puzzles, limits and debugging tips. Start here.
- [Agent Skill: CodinGame contributions](https://www.codingame.com/api/v1/docs/skills/codingame-contribution/SKILL.md): write, test, preview, upload and publish classic puzzles, Clash of Code questions and games for the user.
- [How to make a classic puzzle or a clash](https://www.codingame.com/api/v1/docs/skills/codingame-contribution/references/classic.md) and [how to make a game](https://www.codingame.com/api/v1/docs/skills/codingame-contribution/references/games.md): the rules and guidelines of contributions.
- [API reference](https://www.codingame.com/api/v1/docs/api): every endpoint with its parameters, responses and errors.
- [Leagues and promotion](https://www.codingame.com/api/v1/docs/leagues): how players reach the next league (boss battles, ranking above the boss, league openings in public challenges).
- [Stub generator syntax](https://www.codingame.com/api/v1/docs/stub-generator): how to read the input format of a game and write the bot's parsing code.

## Optional

- [Puzzles](https://www.codingame.com/api/v1/puzzles?arcade=false): JSON list of the bot programming, optimization and code golf puzzles the API plays, without token.
- [Problem types](https://www.codingame.com/api/v1/problems/missing-token): description of each error type, at `/api/v1/problems/<slug>`.
- [API index](https://www.codingame.com/api/v1/): JSON index of the API, its game modes and its documentation.
