跳到正文
cccskills
免费在 GitHub 公开

systematic-debugging

Structured debugging methodology — reproduce, isolate, hypothesize, verify. Covers git bisect, binary search, logging, and minimal reproduction.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md3.4 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Systematic Debugging

Debug methodically instead of randomly changing code.

The Process

1. Reproduce

Before anything else, reproduce the bug reliably:

  • Get the exact steps to trigger the issue
  • Note the expected vs actual behavior
  • Confirm it happens consistently (not intermittent)
  • Record the environment (OS, Node version, browser, etc.)

If you can't reproduce it, you can't fix it. Ask for more details.

2. Isolate

Narrow down where the bug lives:

Binary search the codebase:

  • Comment out half the system → does the bug persist?
  • If yes, the bug is in the remaining half → repeat
  • If no, the bug is in the commented-out half → repeat

Git bisect:

git bisect start
git bisect bad          # current commit is broken
git bisect good <sha>   # this commit was working
# Git checks out the midpoint — test it
git bisect good         # or git bisect bad
# Repeat until it finds the first bad commit
git bisect reset        # when done

Isolate by layer:

  • Is it frontend or backend? (Check network tab)
  • Is it the database? (Query directly)
  • Is it the API? (curl the endpoint)
  • Is it the component? (Render it in isolation)

3. Hypothesize

Form a specific, testable hypothesis:

  • "The bug is caused by X because Y"
  • Not "something is wrong with the data"
  • Good: "The userId is null because the auth middleware doesn't run on this route"

4. Test the Hypothesis

Write the smallest possible test that proves/disproves your hypothesis:

  • Add a console.log or breakpoint at the suspected location
  • Check the value of the suspected variable
  • If your hypothesis is wrong, go back to step 3 with new information
  • If it's right, you've found the bug

5. Fix and Verify

  • Apply the minimal fix
  • Verify the original reproduction steps no longer trigger the bug
  • Check for regressions — did the fix break anything else?
  • Write a test that would have caught this bug

Debugging Tools

ScenarioTool
"It worked before"git bisect
"I don't know where this runs"Add logging at entry/exit of suspect functions
"The data looks wrong"Inspect at each transformation step
"It only fails in production"Compare env vars, check logs, try to reproduce with prod data locally
"It's intermittent"Look for race conditions, timing issues, or uninitialized state
"The error message is useless"Search the codebase for where that error is thrown

Common Bug Patterns

  • Off-by-one: Array indices, pagination, date ranges
  • Null/undefined: Missing optional chaining, uninitialized state
  • Race condition: Async operations completing in unexpected order
  • Stale closure: React useEffect/useCallback capturing old values
  • Type coercion: == vs ===, string vs number comparisons
  • Missing await: Forgetting await on async functions
  • Environment mismatch: Works locally, fails in CI/prod due to different env vars or versions

Rules

  • Never guess — always verify with evidence
  • Fix the root cause, not the symptom
  • If you've spent 15 minutes without progress, step back and re-isolate
  • Document what you tried so you don't repeat failed approaches

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Use Cursor's browser aria snapshots to audit a page for accessibility issues — missing labels, broken tab order, contrast, and ARIA misuse.

中文简介正在准备中。当前显示原文说明。

0xAidan/polymarket-bot-test42026年9月4日 更新

Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay.

中文简介正在准备中。当前显示原文说明。

0xAidan/polymarket-bot-test42026年9月4日 更新

Generate OpenAPI/Swagger documentation for an API, including endpoint schemas, request/response types, and interactive docs UI.

中文简介正在准备中。当前显示原文说明。

0xAidan/polymarket-bot-test42026年9月4日 更新

Add authentication to a web application using NextAuth.js (Auth.js), including OAuth providers, session management, and protected routes.

中文简介正在准备中。当前显示原文说明。

0xAidan/polymarket-bot-test42026年9月4日 更新

Dockerize an application with a production-ready Dockerfile, docker-compose setup, and .dockerignore.

中文简介正在准备中。当前显示原文说明。

0xAidan/polymarket-bot-test42026年9月4日 更新

Set up Playwright end-to-end testing in a project, including test configuration, example tests, and CI integration.

中文简介正在准备中。当前显示原文说明。

0xAidan/polymarket-bot-test42026年9月4日 更新

查看 0xAidan 的全部技能

报告此技能的问题