Minimal repro first (then ask for help)
Goal: Shrink a bug to the smallest snippet that still fails—before you ask the model—so answers stay focused and safer to paste.
Best for: Beginners drowning in large files; anyone about to paste a whole repo into chat.
A minimal reproduction is the shortest code + steps that still show the bug. It protects secrets (less surface), helps you learn, and stops the model from “fixing” unrelated code.
A minimal repro is the smallest code that still shows the bug. Models patch faster—and you learn whether the bug is real—when the file is tiny.
Why beginners skip this
Dumping the whole repo into chat feels thorough until answers wander. A minimal failing slice focuses the model and proves you understand the bug.
Habit this week (Asia/Shanghai): shrink one real bug to the smallest failing file before you ask for a fix—date the repro path.
Step 1 — Shrink checklist
Do this step with a real artifact open—not from memory.
Before asking:
1) Remove unrelated files/features until the bug remains
2) Hardcode one failing input
3) Note environment (language version, browser/node)
4) Redact secrets
Then paste ≤30 lines if possible.
Step 2 — Ask with repro
Example
Filled prompt
I have a 900-line component with a double-submit bug on slow networks. Ask the model to propose a minimal repro plan (new tiny file or reduce steps) before any patch. Stack: React. Do not invent APIs.
What good output looks like
- Repro plan lists the smallest file/test before any patch
- Scope stays tiny—one failing path, not the monorepo
- No invented APIs or files you did not mention
- Steps you can run locally to confirm the failure still shows
- Patch explicitly deferred until the repro is agreed
Step 3 — If you cannot shrink
Say what you tried. Ask what to delete next—not for a speculative full rewrite.
Scene: help that actually helps
Instead of pasting 2,000 lines, you send 18 lines and an Expected/Actual pair. The explanation names the off-by-one. You understand it before any patch.
Template you can paste forever
Keep this card in your notes. Fill it before every coding ask. If you cannot fill Expected/Actual, you are not ready to ask yet.
Language/runtime:
Expected:
Actual:
Steps:
Snippet (≤30 lines, secrets redacted):
Ask: Step A explain only.
Example
Filled prompt
Bug needs Docker + 3 services in the report.
Shrink ask: single failing unit test name + 8-line setup. Refuse monorepo paste.
What good output looks like
- Explains why the full-app import is not minimal
- Lists five concrete cuts (drop UI shell, stub network, etc.)
- Still withholds patch code in this critique turn
- Each cut keeps the failure still observable when you re-run
- You end with a one-file or one-test target
Save this card
Card: shrink to smallest failing slice → then ask. Whole-repo paste is a red flag.
1. What I shipped: ___ 2. What I refused: ___ 3. What I will never-do again: ___ (date: Asia/Shanghai)
- [ ] Tools/writes paused
- [ ] Refuse-line dated
- [ ] Artifact path saved
- [ ] Next link chosen (or stop)
Before you start
Open the failing test, diff, or ticket for “Shrink a bug to the smallest snippet that.” Keep secrets out of the chat. Have the file path you will name. Guide: code-minimal-repro-first. If you only have a blank practice box, stop and fetch the real job first.
- Goal in one line: ___
- Allowed tools: ___
- Forbidden: ___
- Human approve needed for: ___
How to use this week
This week in code: shrink one bug to the smallest failing slice before asking for a fix. No whole-repo dump on a live artifact—not a blank demo. Write one refuse-line and date the note (Asia/Shanghai). If you only skimmed code-minimal-repro-first, put 25 minutes on the calendar and redo once.
Calendar block (code-minimal-repro-first, optional): 25 minutes once this week—open the guide, run Practice once, date the refuse-line, then stop. No binge-reading counts as practice.
Time-box the shrink
Twenty minutes to minimal. If still huge, cut again before any patch.
Non-minimal is a smell
If your “repro” still boots the full app or imports half the tree, it is a demo, not a repro. Ask the model to critique why it is not minimal and list five concrete cuts—still no patch in that turn.
Example
Filled prompt
Bug spans API+worker+UI in the report.
Shrink ask: one failing unit test name + 8-line setup. Refuse three-service paste.
What good output looks like
- Names files/functions you provided for “Shrink a bug to the smallest snippet that still fa”
- No secrets in logs; no mystery whole-repo rewrite
- Explain-before-patch or minimal repro respected
- Pass/fail: you can restate the change in 3 bullets
Red flag
Merging a patch you cannot reproduce; whole-monorepo paste instead of a failing slice—shrink first.
Pitfalls
| Pitfall | Fix |
|---|---|
| Pasting the monorepo | Shrink first |
| Secrets in repro | Placeholders |
| Skipping explain-then-change | A then B |
Example
Filled prompt
Temptation: skip the habit for code-minimal-repro-first to “save five minutes.”
Job still: Shrink a bug to the smallest snippet that
Do the smallest correct pass: Done visible · one checkable artifact · Unknowns labeled [?].
Boundaries: draft only; no silent send; no invented metrics.
Return: the artifact + the refuse-line you said aloud.
What good output looks like
- Names the shortcut you refused (specific to code-minimal-repro-first)
- Still delivers a checkable artifact for “Minimal repro first”
- Unknowns labeled; draft-only respected
- Pass/fail: refuse-line written and dated (code-minimal-repro-first #4)
Practice now
Live card: one real code change under “Minimal repro first (then ask for help)”—diff-only + test note (Asia/Shanghai).
Today: take one real bug. Cut imports and setup until one file (or one test) still fails. Ask the model for a repro plan before a patch. Apply cuts it suggests only if you can still see the failure.
Today card (copy) — code-minimal-repro-first: 1. Artifact I will produce: ___ 2. Pass/fail check: ___ 3. Refuse-line if tempted to skip verify/send: ___ (date: Asia/Shanghai) 4. One never-do from this guide: ___
- [ ] Artifact path written
- [ ] Refuse example would say "yes"
- [ ] Dated Asia/Shanghai
One sentence takeaway
Shrink to the smallest failing slice before you ask for a fix. This week: one dated minimal-repro path (Asia/Shanghai).
Next
Explain then change · Tests first · Code review checklist · Coding agent boundaries · Code path
Pair with today: open the first Next link (code-explain-then-change) only after you dated a refuse-line for this guide (Asia/Shanghai).
先最小复现(再求助)
目标: 在问模型前,把 bug 缩到仍会失败的最短片段——回答更聚焦,粘贴也更安全。
适合: 被大文件淹没的新手;任何想把整仓贴进聊天的人。
最小复现 = 仍能展示 bug 的最短代码 + 步骤。它减少密钥暴露面,帮你学习,并阻止模型「顺手修」无关代码。
最小复现是仍能展示 bug 的最小代码。文件够小,模型补丁更快——你也能先确认 bug 是否真实。
为什么新手跳过
把整仓丢进对话像很认真,答案却容易飘。先缩成仍会失败的最小切片,模型才聚焦,你也证明自己懂这个 bug。
本周习惯(Asia/Shanghai):求助前把一个真实 bug 缩成最小失败文件,并把复现路径写上日期。
步骤 1——缩小清单
用真实材料做这一步——不要凭记忆。
提问前:
1)删到无关文件/功能,直到 bug 仍在
2)写死一个失败输入
3)注明环境(语言版本、浏览器/node)
4)打码密钥
然后尽可能 ≤30 行再粘贴。
步骤 2——带着复现提问
实例
填好的提示词
这是一份很长的 bug 报告。先向我要:不超过 12 行的复现步骤、期望 vs 实际、失败测试名(如有)。
你还没复述对复现前,先别给补丁。
像样的输出大概长这样
- 复现计划先锁定最小文件/测试,再谈补丁
- 范围很窄——一条失败路径,不是整仓
- 不编造你没提过的 API 或文件
- 有你能本地跑、确认失败仍在的步骤
- 明确等复现达成一致后再给补丁
步骤 3——若缩不小
说你试过什么。问下一步删什么——不要空想式整仓重写。
场景:真有帮助的求助
你没有贴 2000 行,只发了 18 行和期望/实际。解释点名了差一错误。任何补丁前你已经懂了。
可永远粘贴的模板
把这张卡片放进笔记。每次写码提问前填好。若填不出期望/实际,你还没准备好提问。
语言/运行时:
期望:
实际:
步骤:
片段(≤30 行,密钥已打码):
请求:步骤 A 只解释。
实例
填好的提示词
报告里写了 Docker 加三个服务。
缩成:一个失败单测名称 + 八行设置说明。整仓粘贴不行。
像样的输出大概长这样
- 说清为何「导入整个 app」不算最小
- 列出五处具体裁剪(去掉 UI 壳、桩掉网络等)
- 批评轮仍不给补丁代码
- 每处裁剪后失败仍可观察
- 最终落到单文件或单测试目标
保存这张卡
卡片:先缩成最小失败切片 → 再求助。整仓粘贴是红旗。
开始前
打开你真正会用的账号/项目。准备好与「先最小复现(再求助)」相关的真实材料(不要空白练习框)。
默认姿态:在人确认发送/写入之前只出草稿。授予新工具前,先写一条带日期的拒做句(Asia/Shanghai)。
- 一句话目标:___
- 允许的工具:___
- 禁止:___
- 需要人批准:___
本周怎么用
本周挑一个真实缺陷:先缩成可运行的最小失败切片,再解释、再补丁。拒绝「整库神秘改写」。合入前能三句话讲清复现步骤。过/不过注明日期(Asia/Shanghai)。
日历块(code-minimal-repro-first,可选):本周一次 25 分钟——打开本篇、练一次、写上拒做句日期,然后停。贪多读完不算练过。
周中代价检查:若明天丢掉这个习惯,24 小时内会坏在哪?写一行(Asia/Shanghai)。
缩小限时
二十分钟到最小。仍很大就再砍,然后再补丁。
把练习做完
实卡:「先最小复现(再求助)」下一次真实改代码——只要 diff + 测试备注(Asia/Shanghai)。
今天把「先最小复现(再求助)」练完:真实材料、过/不过、一句永不做。注明日期(Asia/Shanghai)。
不够小就是味道不对
如果你的「复现」还要启动全站或导入半棵树,那是演示不是复现。让模型批评为何不够小,并列出五处具体裁剪——该轮仍不要补丁。
红旗
合入说不清的补丁;复现步骤三句话讲不清就不要合。模型提到你仓库里没有的符号——先当幻觉,别当补丁依据。卡上写不清就不继续——先补检查项再跑。
常见坑
| 坑 | 改法 |
|---|---|
| 粘贴整仓 | 先缩小 |
| 复现里有密钥 | 占位符 |
| 跳过先解释再改 | 先 A 后 B |
实例
填好的提示词
任务:Shrink a bug to the smallest
场景要点:缺陷单/diff 打开;练习编号 3/4。
边界:仅草稿;未知 [?];禁止悄悄发送;禁止编造指标。
返回:可检查产出 + 过/不过理由一行。
像样的输出大概长这样
- 约束贴着「先最小复现(再求助)」与 code-minimal-repro-first
- 未知标 [?];不编造负责人/数字
- 不可逆动作前停下
- 一分钟内能打过/不过(code-minimal-repro-first #3)
实例
填好的提示词
任务:Shrink a bug to the smallest
场景要点:缺陷单/diff 打开;练习编号 4/4。
边界:仅草稿;未知 [?];禁止悄悄发送;禁止编造指标。
返回:可检查产出 + 过/不过理由一行。
像样的输出大概长这样
- 约束贴着「先最小复现(再求助)」与 code-minimal-repro-first
- 未知标 [?];不编造负责人/数字
- 不可逆动作前停下
- 一分钟内能打过/不过(code-minimal-repro-first #4)
- [ ] 成品路径已写
- [ ] 拒做例句会说「可以」
- [ ] 已标注 Asia/Shanghai 日期
← Back to home · Learn · Tools · Compare · Start