[CodeTrain](https://codetrain.ai/) / [Docs](https://codetrain.ai/docs/) / The open-source skill

# The open-source CodeTrain skill

CodeTrain is a free, open-source Socratic coding tutor that runs as an Agent Skill inside your own coding agent, tested in Claude Code, OpenCode and Antigravity CLI. It is a folder with a `SKILL.md` file and helper scripts, published under Apache 2.0. You write every line of code yourself. The agent sets small steps, gives hints, reviews what you wrote, and never puts the solution into the lesson.

## Install

You need `python3` (standard library only, nothing to install with pip) and a web browser. Optional: `docker` or `podman`, for running bash steps from the page.

```
$ npx skills add InferHaven/agent-skills
```

```
$ git clone https://github.com/InferHaven/agent-skills
$ cd agent-skills/codetrain
$ ./install.sh
```

`npx skills add` runs the skills CLI from npm, which needs Node.js 22.20 or later. Check yours with `node --version`; on an older Node.js, the `git clone` commands install the same skill into `~/.claude/skills/codetrain` and need no Node.js at all.

Then restart your agent and ask it something, for example "teach me this code" or "give me a practice exercise on recursion". The agent gives you a local link to the lesson page.

## How a lesson goes

1. The agent starts a small local web page and gives you its link.
2. You choose your level, your goal, and how much guidance you want.
3. The agent writes one small step at a time. Each step has a task, hints, and, for Python and JavaScript, test cases.
4. You write the code in the page's editor and press Run. Your code is checked against those tests in your browser.
5. You press Send. The agent reviews your code and either moves you on or asks you to try again.
6. At the end you get a recap, and your progress is saved on your machine.

The tutor never puts your solution into the lesson, even if you ask for it there. If you want the answer written for you, ask your agent directly in its own chat; that is never refused there.

There are two modes. Local code works on your real repository, with edits on your current branch and no commits made for you. Sandbox gives you a throwaway folder for practice.

The tutor can also turn a diff, a commit, a branch or a GitHub pull request into a lesson where you rewrite each change yourself, starting from the code as it was before.

Concepts you struggled with come back for review at widening intervals.

## Which agents it was tested in

The skill was tested in four agents, and the results below are from those runs.

| Agent | Version | Tested | Model in the test | Lesson started | Woke on Send by itself | Reviewed submitted code | Recorded the lesson |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Claude Code | 2.1.291 | 2026-10-06 | `claude-opus-5-5` (account default) | yes, from a plain request | yes | yes | yes |
| OpenCode | 1.18.34 | 2026-10-06 | `opencode/big-pickle` (free) | yes, from a plain request | yes | yes | yes |
| Antigravity CLI | 1.3.0 | 2026-10-06 | `gemini-3.8-flash-high` (default) | yes, from a plain request | yes | yes | yes |
| Codex CLI | 0.128.0 | 2026-10-06 | `openai/gpt-5.1-codex-mini` (earlier skill version) | when named, after one "check it" | no | no | not tested |

Claude Code 2.1.291, OpenCode 1.18.34 and Antigravity CLI 1.3.0 each ran a full lesson from a plain request, with every stage passing without a nudge: the page was served, step 1 was written, submitted code was reviewed, and the end of the lesson was recorded. OpenCode asks before the agent uses `/tmp/codetrain-*`, where lessons live, so allow it. Codex CLI 0.128.0, on an earlier version of the skill with a small model, started a lesson only when the skill was named and after one "check it" in the chat, and did not review submitted code. In an agent that does not wake the tutor by itself when you press Send, as in the Codex test, type "check it" in the agent's chat after Send. Other agents that load Agent Skills were not tested.

## What leaves your machine

The lesson page runs on 127.0.0.1. The skill sends nothing to CodeTrain or InferHaven: no account, no telemetry. Your agent sends what it reads, your code included, to its own model provider, as it does for any task. From your profile the agent gets only a short summary: your level, your languages, number of lessons, streak, number of concepts, last lesson date, latest goal, and concepts due for review. Strengths, notes, other gaps, older goals and past lesson summaries stay on your disk unless you ask the tutor to use them. In the three full test runs, marker words planted in a test profile's strengths, notes, later gaps, older goal and past lesson summary never appeared in the agent's transcript. Python runs in your browser through Pyodide, downloaded from the jsDelivr CDN the first time Python runs. Security and data handling for every mode is at [the security page](https://codetrain.ai/security).

## The skill and the hosted product

CodeTrain also has a hosted product that is not open source: the `codetrain` command-line agent and the managed tutor in the browser. The table below is the honest comparison, and [pricing](https://codetrain.ai/#pricing) has the numbers.

|  | The skill | `codetrain` CLI agent | CodeTrain in the browser |
| --- | --- | --- | --- |
| License or source | Apache 2.0, open source | Free install, not open source | Managed service, not open source |
| Where it runs | Inside your own coding agent | On your machine | In the browser |
| Which model does the tutoring | Your agent's model | CodeTrain's service | CodeTrain's managed models |
| Account | None | CodeTrain account | CodeTrain account |
| Cost | Free; model usage billed by whoever already bills your agent | Uses your CodeTrain plan: free for ten lessons a month with no card, and paid plans | Free plan (ten lessons a month, no card) and paid plans |
| How to start | `npx skills add InferHaven/agent-skills` | `pip install codetrain-cli` | Sign up at [pricing](https://codetrain.ai/#pricing) |

## License and source

The skill is published under Apache License 2.0. The source is at [InferHaven/agent-skills](https://github.com/InferHaven/agent-skills), in the [codetrain folder](https://github.com/InferHaven/agent-skills/tree/main/codetrain).

## Common questions

### Is the skill really free?

Yes. The skill itself costs nothing and has no CodeTrain account. It uses your own agent and that agent's model account, so model usage is billed by whoever already bills your agent.

### Does it send my code anywhere?

The skill itself sends nothing to CodeTrain or InferHaven: no account, no telemetry. Your agent sends what it reads, your code included, to its own model provider, as it does for any task. From your profile the agent gets only a short summary: level, languages, lessons taken, streak, concepts, last lesson date, latest goal, and concepts due for review. The rest of the profile stays on your disk unless you ask the tutor to use it.

### Does it work in Codex, OpenCode or Antigravity CLI?

It was tested in all three, plus Claude Code. Claude Code, OpenCode and Antigravity CLI each ran a full lesson from a plain request: page served, step 1 written, submitted code reviewed, end of lesson recorded. OpenCode asks before the agent uses its lesson folders, so allow that when it asks. In Codex, on an earlier version of the skill with a small model, the lesson started only when the skill was named and after one "check it" in the chat, and the review of submitted code did not happen there. In an agent that does not wake the tutor by itself when you press Send, type "check it" once in the chat after Send. Other agents that load Agent Skills were not tested.

### Will it give me the answer?

No. Before the lesson page shows the tutor's feedback or a hint, it checks each code span, and one that writes out the step you are on is hidden behind a "Show it anyway" button. These are the same rules as CodeTrain's hosted tutor. It is a second lock behind the tutor's instructions, not a proof. If you want the answer written for you, ask your agent directly in its own chat; that is never refused there.

### Can I use it on my own codebase?

Yes. Local code mode works on your real repository, with edits on your current branch and no commits made for you. Sandbox mode gives you a throwaway folder when you would rather practice away from your files.

### How is it different from the hosted product?

The skill is single-player and uses your own agent. The hosted plans add managed models with no setup, cross-device profile sync, and team features like dashboards and onboarding journeys.

[All documentation](https://codetrain.ai/docs/)

---

Source: https://codetrain.ai/docs/open-source-skill/

This is the markdown twin of the page above. Every public CodeTrain page serves one on `Accept: text/markdown`. Start at https://codetrain.ai/llms.txt for the full map, or https://codetrain.ai/developers/ for the API.
