code-learning

code-learning is a skill for Claude Code from hwl668/Scientific-learning-skills-. It costs 74 tokens per session (1,506 once invoked), scanned A, original, MIT.

A teaching skill for learning real Python code repositories through guided lessons and exercises. It can index supported Python source, inspect symbols and call paths, and save progress between sessions.

In plain words
What is it for?
Use it to study a Python project's architecture, trace how a value moves through the code, practise writing small changes, and resume lessons later.
Why use it?
It gives learners a structured way to understand unfamiliar code without pretending that unverified code relationships or incomplete repository coverage are certain.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions Claude Code; mentions Codex.

Part of the scientific-learning-skills plugin — 11 skills shipped together

Good fit Use it to study a Python project's architecture, trace how a value moves through the code, practise writing small changes, and resume lessons later.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hwl668/scientific-learning-skills-/code-learning
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.

Any agent
npx skills add hwl668/Scientific-learning-skills- --skill code-learning
Clone the repo
git clone --depth 1 https://github.com/hwl668/Scientific-learning-skills-

Made for: Claude Code.

Or install scientific-learning-skills, the plugin that ships this one along with the rest of its 11 skills.

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 code-learning

README.md
[![agentmods](https://agentmods.dev/badge/skills/hwl668/scientific-learning-skills-/code-learning/github.svg)](https://agentmods.dev/skills/hwl668/scientific-learning-skills-/code-learning)
Your own site
<a href="https://agentmods.dev/skills/hwl668/scientific-learning-skills-/code-learning"><img src="https://agentmods.dev/badge/skills/hwl668/scientific-learning-skills-/code-learning/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-learning

Your own site · 80×15
<a href="https://agentmods.dev/skills/hwl668/scientific-learning-skills-/code-learning"><img src="https://agentmods.dev/badge/skills/hwl668/scientific-learning-skills-/code-learning.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,506 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00074 $0.01506
Opus 5.5 $0.00030 $0.00602
Sonnet 5.5 $0.00015 $0.00301
Haiku 4.5 $0.00007 $0.00151

Measured yesterday against content hash ac411f4c9f27, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-learning scanned grade A with 0 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 yesterday.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/code-learning/SKILL.md · 59 lines

How it starts

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

代码学习 agent 的宿主入口

主体是 learning_agent.code_learning 的持久化会话和工具接口;本 Skill 让现有 Codex/Claude Code 宿主调用它。也可独立运行 CLI 的 chat,接支持工具调用的模型。

建立目标与材料

利用用户已给的基础和目标,最多补问一个影响路线的问题。识别四种模式:快速看懂 overview、系统学 systematic、动手带练 practice、考核 assess。用户要求直接解释时直接解释。

在本项目可用的 Python 环境中执行:

python -m learning_agent.code_learning start --repo /path/to/repo --goal "追踪一次训练的数据流" --mode systematic
# 无外部仓库时可用离线案例:start --demo micrograd 或 start --demo nanogpt
python -m learning_agent.code_learning resume SESSION_ID
python -m learning_agent.code_learning lesson SESSION_ID UNIT_ID

命令输出 JSON,先保存返回的 session ID。索引涵盖有界 UTF-8 Python 源文件和明确声明 Python 的 nbformat 4 notebook 代码单元;必须说明 skipped 和语法错误等覆盖缺口。数据集、模型权重、notebook 输出和 markdown 不进入上下文。未知仓库的默认路线是待验证的阅读候选,不声称已经理解完整架构。

工具驱动教学

  1. 用 architecture 读取有源码依据的入口、依赖阅读路线、覆盖缺口;再读源码解释系统要解决什么问题。没有入口依据时明确标为探索候选。
  2. 使用 search(query) 找符号,read_source(path,start,end) 读取源码,trace_calls(path,symbol,direction) 查一跳 incoming/outgoing 调用线索(模块级 symbol 为 <module>)。static_candidate 不等于已验证运行关系;unresolved 不猜测目标。每个代码事实附实际文件和行号;设计动机属于推断时说清楚。
  3. 每轮选一个学习单元:说明输入输出和不变量,追踪一个具体值/张量,再让用户预测、解释或写约 5–10 行有意义的逻辑。准备工作由 agent 完成。
  4. 提问后等待真实作答。把用户原文保存到答案文件,用 submit SESSION TASK --answer-file PATH;不可把 agent 的参考答案冒充学习者作答。
  5. 客观练习由内置校验器判定;开放题用 LearningSession.review 对全部 rubric 提供 met、证据和源码范围。模型/人工评阅与客观测试区分记录。
  6. hint 会标记提示使用;在透露线索或参考答案前调用。错误后给最小修复与变式;用 propose_task 添加来源明确的迁移题。
  7. 用 resume 恢复下一步;用 report 导出真实作答和反馈。只有工具成功后才声称已保存。

可验证的关键代码带练

用 practice_catalog 查匹配当前源码版本的题目,再用 assign_practice(identifier,exercise_id) 追加内置题。它不改变当前模式/重点,必要时再 configure。当前题库覆盖 micrograd 的加法累加、乘法反向、ReLU、平方共享输入和共享路径迁移。材料不匹配时使用开放题,不能伪称已有客观测试。

题目附参数、返回分量和语法约束;学习者写 def solve(...),仍通过人类入口 submit 提交。新解释器仅支持有界标量赋值、+= 等四则更新、四则运算、数值条件表达式和元组返回;不是普通 Python 执行或容器沙箱。不要提交 Value 对象、属性访问、循环或导入。

结果返回第一个失败输入、实际/期望分量及用例类别。返回期望反例会自动记为反馈暴露,之后作答标为 assisted;不能把重试或辅助后通过叫作第一次独立通过。同一会话同一内置练习不能换 ID 重置历史。用 practice_evidence 读取证据和补练建议;类别如 accumulation 表示相关用例失败,不是已证实的认知错因。评阅、源文件 hash 或评分约定变化时不要静默替换历史。

Read the full file on GitHub · 59 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. yesterday First seen · 59 lines · 74 tokens per session scan A ac411f4c9f27

Subscribe to this mod's changes

code-learning is a skill published in the GitHub repository hwl668/Scientific-learning-skills- (15 stars, last pushed 2d ago), licensed MIT. It adds 74 tokens to every session and 1,506 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-31.