patch

A planning command for discussing a small patch—one focused code or content change—without applying it. After confirmation, it produces a development summary and a consistently formatted issue description in the chat.

In plain words
What is it for?
Use it to scan recent changes, classify a proposed patch, discuss its scope, and prepare the agreed summary and issue text.
Why use it?
It helps turn a proposed change into a clearly scoped piece of work before implementation. It also keeps patch planning separate from editing files, changing versions, creating tags, or opening issues.

Command for Claude Code

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 commands/awesome-embedded-learning-studio/tutorial_awesomemoderncpp/patch
Clone the repo
git clone --depth 1 https://github.com/Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP

Made for: Claude Code.

Per session 44 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,024 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 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.00044 $0.01024
Opus 5 $0.00022 $0.00512
Sonnet 5 $0.00009 $0.00205
Haiku 4.5 $0.00004 $0.00102

Measured yesterday against content hash 974af4a6f7fe, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

patch 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.

.claude/commands/patch.md · 65 lines

What it actually says

/patch — 小迭代规划(规划者模式)

你现在是规划者,不是执行者。本轮你不修改任何文件、不碰版本号、不建 tag、不调 gh

输入

$ARGUMENTS —— 本轮 patch 的主题或线索。为空时,主动扫描发现候选 patch。

流程

1. 扫描现状

  • 累积计数(累积制核心): 运行 git log $(git describe --tags --abbrev=0)..HEAD --oneline 得到自上次 tag 以来的 patch 提交列表与数量 —— 用户判断"何时升 minor"的依据。
  • 按主题定位相关位置;若涉及内容,读对应 todo/01x-vol*.md 确认这个 patch 服务于哪条 next-step(仅作上下文)。
  • ⚠️ 项目 Python 脚本一律用 .venv/bin/python(有 PreToolUse hook 强制)。
  • 必要时做 web search 核查事实(准确性优先,token 成本其次)。

2. 判定类型并打标(仅用于聊天讨论,不进 Issue)

标签 含义 label 建议
内容 (feat) 写新内容的一个片段。完成一部分内容也算 patch feature
修缮 (fix) 错别字 / 注释错 / 代码缩进或缺行 / 事实性小错 bug
批量 (chore) lint / frontmatter / 404 等机械修复(跨多文件也归此类) documentation
示例 (build) 代码示例编译 / 行为修复 bug
工具链 (chore) 脚本 / CI / 构建配置小修 enhancement

3. 粒度与边界(累积制 —— patch 是开发的原子单位)

  • patch 是所有开发工作的原子单位,涵盖全部类型,包括写新内容的一个片段。不会因为"动了学习路径"或"写的是新内容"就升级 minor。
  • 不设文件数 / 行数硬上限,也不设类型升级线。诉求太大就拆成多个 patch,不升级 minor。
  • 何时升 minor,纯粹由用户手工判定,与 patch 类型无关。

4. 提案 → 讨论 → 确认(核心是讨论)

  • 先用一句话讲清这轮打算做什么,作为讨论起点(类型/进度等上下文口头带过即可,别堆列表)。
  • 与用户来回讨论打磨,直到用户明确确认
  • 保持灵活,不搞死板:不强制列具体文件、不强制验收标准 —— 讲明白就行。
  • 未确认前,不产出 Issue。

5. 确认后,产出两样东西到聊天框(讨论的最终产物)

(a) 本轮确认的开发工作 —— 一句话总结聊定的内容。

(b) 迭代 Issue(Markdown) —— 套用 .claude/templates/iteration-issue.md(极简版:标题 + 一句话 + 一段"本轮打算做什么"),用 ```markdown 代码块包裹。用户微调后自行送 GitHub。

(a)(b) 都必须通俗易懂:用大白话写,少术语、别堆结构化清单,让没参与讨论的人也能一眼看懂这轮要干啥。

输出后停下。

硬约束

  • ❌ 不直接执行任何文件修改。只产出讨论结果。
  • ❌ 不碰版本 bump / CHANGELOG / git tag(用户自理)。
  • 不调 gh issue create,不开 issue
  • ✅ 全程讨论驱动;Issue 仅在用户确认后产出。
  • 输出通俗易懂:用大白话写,别堆术语 —— 用户要能看懂自己收到的 Issue。
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 · 65 lines · 44 tokens per session scan A 974af4a6f7fe

Subscribe to this mod's changes

patch is a command published in the GitHub repository Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP (250 stars, last pushed 2d ago), licensed MIT. It adds 44 tokens to every session and 1,024 once invoked, about $0.0002 per session on Opus 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-08-30.