codetrain

codetrain is a skill for Claude Code, Codex from InferHaven/agent-skills. It costs 78 tokens per session (4,324 once invoked), scanned E, original, Apache-2.0.

A step-by-step coding tutor that asks you to write the code yourself and reviews each small change. It includes a local web page for the lesson.

In plain words
What is it for?
Use it for guided lessons, practice exercises, code reviews, and learning the changes in a diff or pull request. It can also help identify topics you should revisit.
Why use it?
It helps you learn how code works instead of simply receiving a finished answer. Small steps and feedback make unfamiliar code easier to understand.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/inferhaven/agent-skills/codetrain
Any agent
npx skills add InferHaven/agent-skills --skill codetrain
Clone the repo
git clone --depth 1 https://github.com/InferHaven/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for codetrain

README.md
[![agentmods](https://agentmods.dev/badge/skills/inferhaven/agent-skills/codetrain.svg)](https://agentmods.dev/skills/inferhaven/agent-skills/codetrain)
Your own site
<a href="https://agentmods.dev/skills/inferhaven/agent-skills/codetrain"><img src="https://agentmods.dev/badge/skills/inferhaven/agent-skills/codetrain.svg" alt="Measured on agentmods" height="20"></a>
Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,324 The whole file, excluding the scripts and references it only reads on demand.
Security scan E 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00078 $0.04324
Opus 5 $0.00039 $0.02162
Sonnet 5 $0.00016 $0.00865
Haiku 4.5 $0.00008 $0.00432

Measured 4d ago against content hash bda61443670f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade E, and why

codetrain scanned grade E with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

The scan reads SKILL.md. This mod also ships 13 executable files (app/checkpoint-hook.sh, app/ctl.sh, app/install-permissions.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Tells the agent never to refusehighAnti-refusal

Suppressing the ability to decline removes a core safety control; a later harmful request then succeeds.

stop (the UI shows "say 'arm it' to resume"). **Submit anytime — green OR red;** never refuse

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

work**. Sandbox dir: leave it, or `rm -rf` only if asked.
codetrain/SKILL.md · 272 lines

How it starts

The opening of the file, as written. The whole thing — 272 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CodeTrain

Overview

Turn-by-turn Socratic coding trainer with a beautiful local web UI. The browser is the pretty face; you are the brain. You set tiny steps and review the user's own code — you do not write their solution for them.

Core principle: the user types the code, every time. You ask, nudge, review, and explain. One small step per turn.

When to use

Triggers: "teach me this code", "walk me through this", "hold my hand", "explain step by step", "tutor me", "guide me", "I want to understand X", "give me a practice exercise", "let me learn by doing", "review my weak spots", "drill me", "spaced review", "what should I revisit", "teach me this diff/PR", "walk me through these changes".

Not for: "just fix it", "write this for me", "do the task" — those want a result, not a lesson. If unsure, ask: "Want me to do it, or teach you to?"

Architecture — this file is self-sufficient

A Python-stdlib server serves the web UI and one JSON file (session.json); the browser polls it and renders. You change it each turn with tiny patches. The server never runs user code. Everything you need for a normal session is in THIS file — do NOT read references/session-protocol.md unless you hit a genuine edge case (an unusual field, debugging the server). Reading it every session wastes ~4k tokens.

Paths are relative to $SKILL_DIR (shown when the skill loads; never hardcode /root/…). Requires python3. Prompt-free via app/install-permissions.py (a scoped, auditable allow-list the user runs once). Other references, loaded only when relevant: spaced-repetition.md (review/drill), teach-on-diff.md (PR/diff lessons).

Memory & progress (token-cheap)

CodeTrain remembers the learner across sessions in small files under $HOME/.codetrain/: profile.json (compact — languages+level, goals, strengths, scheduled gaps, notes, streak, totals) and history/<date>-<slug>.md (one summary per finished session).

  • At start, Read ONLY profile.json (Read tool, one small file): greet a returning learner, default their level, suggest a topic, and if any gap is due (due ≤ today) offer a quick review drill (spaced repetition — see references/spaced-repetition.md). Surface it via the profile block + intake intro. Do not read history/ unless resuming a specific past session.
  • At end, write two small files (Write/Edit tools): append history/<date>-<slug>.md and update profile.json (reschedule reviewed gaps + log new ones). First run / no profile: create the dir + a fresh profile.json. Local-only data — no secrets.

Read the full file on GitHub · 272 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 272 lines · 78 tokens per session scan E bda61443670f

Subscribe to this mod's changes

codetrain is a skill published in the GitHub repository InferHaven/agent-skills (2 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 78 tokens to every session and 4,324 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it E with 2 findings (tells the agent never to refuse, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

study-teach

Personalized lecture & explanation sub-skill for a Chinese graduate-exam learner who values step-by-step reasoning, intuitive/visual understanding, strict condition checking, error diagnosis, and exam-oriented transfer. Orchestrated by study-assistant but also usable standalone. Use when the learner wants a…

2362094903-ops/study-assistant-skills · 191 tokens

study-assistant

Study tutor (main orchestrator) for any exam — 考研, 期末考试, certifications. Use whenever the user wants to systematically learn or prepare for an exam from study material. Chinese triggers: uploading a textbook/课件/讲义 with "开始学习" "带我系统过一遍" "复习第X章" "帮我复习"; "继续学习" "上次学到哪了"; "做成思维导图"; uploading/mentioning past exam papers…

2362094903-ops/study-assistant-skills · 275 tokens

study-quiz

Quiz & assessment sub-skill (orchestrated by study-assistant; also usable standalone). Use when the learner uploads past papers/questions ("真题", 历年试卷, 样题), wants AI to search for school-style questions, asks to be tested ("出题" "考我" "测验" "模拟题" "来套模拟卷"), submits answers for grading, or asks to review mistakes. Maintains…

2362094903-ops/study-assistant-skills · 132 tokens

study-feynman

Feynman-technique verification sub-skill (orchestrated by study-assistant; also usable standalone). Use when the user says "费曼检验" "我来讲给你听" "检验我的掌握程度" "看看我学得怎么样", or when a chapter is finished and needs final mastery sign-off. The learner explains a point in their own words; Codex plays a sharp beginner, probes gaps…

2362094903-ops/study-assistant-skills · 106 tokens

study-mindmap

Mind-map sub-skill (orchestrated by study-assistant; also usable standalone). Use whenever a chapter knowledge-point mind map needs to be generated or refreshed — the user says "思维导图" "知识图谱" "脑图", or any knowledge point's mastery/status changed. Renders knowledge.json into a zero-dependency offline-capable interactive…

2362094903-ops/study-assistant-skills · 94 tokens

agent-tutor

Turn any coding agent into a structured personal tutor with a markdown knowledge vault. Interviews the learner to build a personal learning profile (how they think, which explanations they receive best, tone and pace preferences), builds a phased plan shaped by that profile, writes complete lesson notes in the…

Mohamed-El-Sharqawy/agent-tutor · 125 tokens