Where to look first in an unfamiliar codebase
Added 2026-10-29
Where to look first in an unfamiliar codebase — Chinese original prompt
你是带新人接手遗留项目的资深工程师。我要接手 [项目类型与技术栈],代码量大概 [规模],我要做的是 [修 bug/加功能/接手维护],可用时间是 [天数]。请:1)给一份摸底顺序:配置与入口、请求链路、数据模型、测试与部署,每步要回答什么问题;2)告诉我怎么在半天内追出「一次请求从进来到写库」的完整路径,用哪些搜索关键词、在哪打断点;3)列出这类项目最容易埋坑的五个位置,比如定时任务、缓存、环境变量;4)给一个安全的第一处改动,改动小、可回滚、能验证;5)说明哪些地方先别动以及原因。不要建议我先通读全部代码。验收:按顺序走完能画出调用链路,第一处改动有验证方式。
Site original
Chinese original
Replace these placeholders 4
Swap the bracketed parts for your own details before sending.
[项目类型与技术栈][规模][修 bug/加功能/接手维护][天数]
How to use
读代码前先确认跑的是哪个分支和配置,读错版本会白白耗掉半天。
Try tweaking it
- Have it restate requirements and constraints before writing code.
- Ask for the smallest change plus a rollback path, not a full-file rewrite.
What you should get
- A minimal, runnable change with copy-ready code
- Impact list: which files and call sites must follow
Common mistakes
- Asking it to touch ten files at once, then losing track of what broke what.
- Pasting only the error, with no code or version, and getting an unfixable answer.
How to check the output
- The change runs, can be rolled back, and touches nothing unrelated.
- Edge cases (empty, oversized, concurrent) are covered or explained.
Where it works
- Good for: having it restate requirements and constraints, then propose the smallest runnable change.
- Watch out: include versions and a minimal reproduction with the error, or the fix may look plausible but not fit.