agentleFS
ggbdpqggbdpq/agent-skills/skills/.curated/minimal-diff-fix/SKILL.md

minimal-diff-fix

Skill1 starsChanged 5 months agoMITView on GitHub

最小改动修复与轻量回归。Use when fixing a clear bug, startup failure, field mapping bug, Android compatibility issue, local environment blocker, ffmpeg or task-state bug, controlled console debugging, or when the user asks to only change necessary files, avoid refactors, keep the diff small, or get the path running first.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write tests only when they first prove the current bug exists by failing.

    line 18

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

最小改动修复

使用定位

只解决当前目标的直接阻断点。优化目标是最小可审阅 diff,改到阻断解除就停下。

如果目标是模块蓝图、目录规范、文档体系迁移或新 skill 提炼,切到对应 skill。

铁律

  • Fail fast and loudly. Do not add fallback logic unless the user explicitly requires fallback behavior.
  • Let exceptions and real errors surface early. Do not absorb business-layer errors just to make the UI look calmer.
  • Write tests only when they first prove the current bug exists by failing. Do not expand scope with test infrastructure when the user's goal is immediate unblocking.

直接阻断链

动手前把候选改动分三类:

分类判断处理
required不做它,当前目标仍失败本轮实现
optional更整洁、更完整,但当前不阻断列为后续
off-scope重构、文档、脚本、相邻问题、测试基建本轮不做

受控诊断打点

当用户只要求调试、排查、找原因、看为什么、debug 或加 console 时,先进入诊断模式:

  1. 只在用户指定文件、直接调用方或一层被调方加最少 console。
  2. 统一使用 [DEBUG-myshow] 前缀,必要时只补紧邻的 eslint-disable-next-line no-console。
  3. 禁止在诊断模式下改业务分支、返回值、异常处理、请求参数、状态写入、依赖版本或目录结构。
  4. 用户贴新日志时,只调整诊断点继续缩小范围,直到根因链路足够清楚。
  5. 用户说已找到原因、OK、明白了、调试结束、删 console,或转入梳理机制时,先删除 [DEBUG-myshow] 及对应 eslint 注释,再继续下一步。

诊断输出只说明复现路径、应该看哪些 Console 或 Network 证据、下一轮需要贴回哪些日志。只有用户明确要求修复时,才从诊断模式切回最小改动修复。

Test-first 流程

  1. 抽取最小失败现象。
  2. 找到可独立运行的函数、样式、配置、schema、route 或 contract。
  3. 先写会失败的轻量测试,确认失败原因和 Bug 对齐。
  4. 只改 required 文件。
  5. 只运行相关测试,再按风险补人工验收。
  6. 报告未改事项和原因。

常见判断

场景最小修复点
字段缺失或展示异常先查接口事实、类型、mapper,再改消费层
任务状态异常先定位 route schema、service、worker、processor、repository、storage 或 CLI
样式兼容问题只改触发问题的 selector 和组件
环境变量、代理、员工缓存、ffmpeg 缺失先说明前置条件,未经要求不写绕过逻辑
README、脚本、依赖名不一致不阻断当前路径时不顺手统一

反模式

  • 不顺手清理。
  • 不为了小修复新增大型测试体系。
  • 不把一个 Bug 修成通用框架。
  • 不捕获异常后发明新 UI 状态解释它。
  • 不改脚本名、依赖版本或目录结构来显得更整齐。
  • 不把真实外部接口混进普通轻量测试,除非目标就是集成验收。

输出格式

  1. 结论摘要
  2. 根因链路
  3. 修改文件清单
  4. 必须改的原因
  5. 测试命令和结果
  6. 未改事项

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.