技术债优先级 Prompt:12 个比 backlog 更靠谱的模板

按 影响 × 工作量 × 衰减风险 给技术债排序——不再按"谁最大声"决定。12 个 Prompt 模板。

每个 backlog 都有”tech debt”标签下挂着 50 张没人动的 ticket。好的优先级 Prompt 要按影响、工作量、衰减风险打分,最后输出本季度真正要做的 5 件事。

适合哪些场景

写季度技术债计划的 tech lead、要不要投一整个 sprint 做清理的创业者、为重构争取预算的工程师。

什么时候不建议这样写 Prompt

别拿它正当化 rewrite——那是另一场对话。也别在没业务上下文(营收 / 截止 / 招聘)的情况下用。

Prompt 结构公式

每个优先级 Prompt 都要带这六个要素:

  • 角色:AI 扮演谁(SRE / Release Captain / staff 工程师 / QA Lead)。
  • 上下文:技术栈 / 分支 / 失败日志 / diff / dashboard URL。
  • 目标:一个具体可交付物——根因、checklist、计划、ticket 列表、runbook。
  • 限制:AI 不能做什么(别自动修、别瞎造文件路径)。
  • 输出格式:编号清单、markdown 表格、JSON、unified diff、可运行代码。
  • 示例 / 信号:1-2 条”好输出”示例,或反例。

这套 Prompt 适合用在哪

  • 季度技术债 triage
  • 上线前硬化清单
  • 向产品负责人讲清单价值
  • 降低 onboarding 摩擦
  • 债务成本-延迟模型

12 个可直接复制的 Prompt 模板

1. impact × effort × decay 打分

Score each debt item: (a) IMPACT (1-5): user-visible / dev-velocity / risk, (b) EFFORT (S / M / L weeks), (c) DECAY (Stable / Growing / Compounding). Final score = IMPACT × DECAY weight ÷ EFFORT. Output a ranked table. Treat any "Compounding + L effort" specially — those eat the future.

2. “为什么是现在”过滤

For each debt item, answer: "What changes in the next 90 days that makes this urgent?" (e.g., hiring 3 backend devs, launching to enterprise, EU rollout, framework EOL). Drop items whose answer is "nothing".

3. 相关项打包

Cluster these {nItems} debt items into themes. For each theme: top 1-2 items + bundled cleanup that can ride along. Bundling cuts overhead — but only if items share files / mental model. Don't bundle unrelated items.

可替换变量: nItems

4. sunset 候选

Identify code / features eligible for sunset: (1) Low usage + high maintenance cost, (2) Replaced internally but never removed, (3) Behind a feature flag that's been on for > 12 months. Output: candidates + a decommission plan.

5. 入职摩擦债务

Audit debt that slows new-hire onboarding: (1) Undocumented build steps, (2) Magic env vars, (3) Local dev requires manual seed, (4) "Just ask {person}" knowledge. Prioritise the items that block a new hire in the first week.

6. 速度影响债务

Audit debt that slows weekly velocity: (1) Tests > 10 min, (2) PRs that need 3+ approvals due to ownership ambiguity, (3) Build flake > 5%, (4) Areas of code requiring "specialist" review. Output top 3 + ROI estimate.

7. 风险导向债务

Audit debt that creates production risk: (1) Single points of failure, (2) Manual deploy steps, (3) No rollback for X service, (4) Logs missing for critical path, (5) Off-team-owned code blocking incident response. Severity-rank.

8. 成本-延迟模型

For 5 candidate debts, estimate cost-of-delay: (a) Pain today (hours / quarter), (b) Pain in 1 year if untouched, (c) Fix cost. Output ROI = (FuturePain - TodayPain) / FixCost. Recommend top 3 to fund this quarter.

9. 给老板看的叙事

Take these 3 prioritized items and write a 200-word narrative for a product / business audience: (1) Each item in plain language, (2) Business consequence if untouched, (3) Engineering investment + outcome, (4) Why now. No jargon.

10. 反打包:别把清理塞进 feature PR

Audit the last 10 feature PRs for hidden cleanup. List places where cleanup was bundled, making the PR harder to review. For each: extract the cleanup into a follow-up ticket. Output ticket drafts.

11. 债务冻结计划

We can't fix this quarter — design a debt FREEZE plan: (1) Areas we'll stop adding to until cleaned up, (2) Compatibility shims to keep new features off the bad code, (3) Comms to the team. Output a 1-page plan.

12. 复盘 → 债务 ticket

Convert this post-mortem into 1-3 debt tickets: title, problem, acceptance criteria, owner, decay class. Don't re-litigate the incident — focus on prevention.

容易踩的坑

  • 把声音大当优先级——最不爽的工程师不总是对的。
  • 没估工作量——每条看起来都”重要”。
  • 没衰减模型——Compounding 类无声但费钱。
  • 一季度想做 > 5 件——一件也做不利索。
  • 没业务叙事——老板不懂的他不会出钱。
  • 清理塞进 feature PR——两边都看不清。
  • 换掉的代码不退役——永远阴魂不散。

优化技巧

  • 显式追踪 DECAY,Stable 可以等、Compounding 不能。
  • 每季度最多 5 件,再多就是许愿。
  • 相关项打包;feature 和 cleanup 不能同 PR。
  • 把成本-延迟模型让管理层看见。
  • 季度重排——上下文会变。
  • 每件一个 owner、一个截止时间。
  • 优先级:sunset > rewrite > refactor > 容忍。

实操加深

使用这些 prompt 时,不要只替换一个主题词就直接交付。围绕「技术债优先级 Prompt:12 个比 backlog 更靠谱的模板」先补齐受众、渠道、长度、语气、参考样例、禁止样式和成功标准,再让模型输出 2 个不同版本做横向比较。好的结果应该能被另一个人直接复用,而不是只有顺滑但空泛的表达。

如果输出看起来像通用模板,下一轮要增加一个真实场景、一个反例和一个可检查指标,例如点击率、转化动作、字数、平台限制或品牌禁区。这样改出来的内容才更像可用资产,而不是一次性的灵感草稿。

FAQ

  • 技术债该投多少时间?: 常见 15-25% 产能;legacy 重就上调,新项目下调。
  • 让 AI 直接定优先级?: AI 打分、人定夺。AI 看不到招聘和客户承诺。
  • Compounding 是什么意思?: 修晚了显著更贵的债——比如不断加宽的 schema、依赖的废弃库。
  • 没即时营收怎么说服老板?: 用成本-延迟模型——换算成研发工时或风险敞口。
  • 每个 sprint 都让所有人做债务吗?: 不必——轮值或留一个”fixer”槽。
  • 什么时候才 rewrite?: 几乎从不。先试 sunset / refactor。rewrite 是 3 年绕路。

相关阅读

标签: #Prompt #编程 #技术债 #重构