360 Secure SkillHub
360 安全技能中心

Bugfix Without Diagnosis

该 Skill 是一份软件调试实践指南,指出未先定位根因就直接修补代码的反模式,列举了空值检查、重试循环、吞异常、调条件凑测试等典型症状,并建议先写清根因、解释症状到根因的因果链、优先在上游修复并留下关联注释。

mvogt99
mvogt99
热度 43.46
最近更新 2026-05-11 17:45:50
分类:开发依赖:纯提示词应用场景:调试排错 / 代码审查

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add bugfix-without-diagnosis
Metadata
name
bugfix-without-diagnosis
description
A fix is proposed without first identifying the root cause; the symptom is masked rather than resolved.
emoji
🩹
metadata
{"clawdis":{"os":["macos","linux","windows"]}}

bugfix-without-diagnosis

When a fix goes in without understanding why the bug occurred, the symptom disappears but the cause lingers. It will return under a different shape, or the "fix" will mask a more serious problem upstream.

Symptoms

  • Fix adds a null check without explaining why the value was null.
  • Retry loop wrapped around a flaky call with no investigation into why it was failing.
  • Try/except swallowing a specific exception without stating what conditions produce it.
  • Condition tweaked (> → >=) to make a test pass, with no explanation of the underlying off-by-one.
  • PR description says "fix X" with no "because Y".

What to do

  • Before proposing a fix, write one sentence stating the root cause. If you can't, you don't understand the bug well enough to fix it.
  • Explain how the symptom follows from the cause — the chain of events from "bad thing happened" to "user saw this".
  • Confirm the fix addresses the cause, not just the symptom. A null check is valid only if you know why the value was null and concluded that null is acceptable.
  • Where the cause is upstream, fix it upstream. Only patch downstream if upstream is genuinely out of reach, and say so.
  • Leave a comment linking the symptom to the cause so future readers don't misread the fix as superficial.