sql-object-impact-analysis
它能做什么
这个工具可以在你修改数据库中的某个部分(例如表或字段)之前,找出所有使用它的地方。它会搜索你的所有程序代码和数据库,告诉你哪些地方可能会出问题。
适用场景
- ✓当你想修改某个表或字段,但不确定会影响哪些地方时。
- ✓当你使用的是老系统,依赖关系很难追踪时。
- ✓当你需要一份关于数据库变更影响范围的报告时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/sql-object-impact-analysis/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“哪些地方用到了 'customers' 表中的 'customer_email' 字段?”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具会先在 SQL 代码中查找直接引用,然后再搜索所有程序代码(例如 C# 或 JavaScript)。它会整理结果,展示哪些内容依赖于你打算修改的对象。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
SQL Object Impact Analysis
You are performing a pre-change dependency trace for a database object (table, column, stored procedure, view, function, or trigger) inside a legacy or unfamiliar codebase. The goal is a single, trustworthy answer to: "If I change this, what else is affected?"
When to use this
Trigger when the user:
- Names a specific table, column, stored procedure, view, or trigger and asks what uses it, what depends on it, or whether it's safe to change/rename/drop
- Is about to modify a schema element in a codebase with no ORM, or a mixed legacy stack (raw SQL + stored procs + hand-written data access code)
- Asks for a "blast radius," "impact analysis," or "dependency trace" of a specific DB object
Do not use this for:
- General SQL performance tuning (use
sql-optimization) - SQL code quality/security review (use
sql-code-review) - Privacy/PII exposure analysis (use
data-breach-blast-radius) - Architecture-level documentation of an entire codebase (use
doc-and-modernize)
Process
Confirm the target object and its exact name(s). Ask if ambiguous (e.g., multiple tables with similar names, or the user says "the customer table" without specifying schema). Get the precise identifier before searching.
Search the SQL layer first:
- Search all
.sqlfiles, stored procedure definitions, views, functions, and triggers in the repo/database scripts folder for direct references to the object name - For a column: check every proc/view/trigger that selects, inserts, updates, or filters on it
- For a table: check every proc/view/trigger that references it, plus foreign key relationships to/from other tables
- For a stored procedure: check every other proc that calls it, and every scheduled job/agent step that invokes it
- Note indirect references too — dynamic SQL (
EXEC(@sql)), synonyms, and views built on views
- Search all
Search the application layer:
- Search all application code (C#, Java, JS/TS, Angular, whatever the repo contains) for:
- Direct SQL strings referencing the object name
- ORM/data-access-layer method or class names that map to it (e.g., a repository method calling the stored procedure)
- API endpoint handlers that ultimately call into the affected data path
- Trace one layer further where reasonable: does a frontend component consume an endpoint that touches this object? Note it, but don't chase every UI consumer exhaustively — flag "further downstream consumers likely exist" if the trail runs cold rather than guessing.
- Search all application code (C#, Java, JS/TS, Angular, whatever the repo contains) for:
Classify each finding by confidence:
- Direct — object name found verbatim in code/SQL
- Indirect — reached via a proc call chain, ORM mapping, or dynamic SQL that couldn't be fully resolved statically
- Uncertain — plausible but unverified (e.g., dynamic SQL construction that couldn't be traced to a literal object name)
- Never present an Uncertain finding as if it were Direct — flag it clearly so the reader knows to verify manually
Produce the report (see Output Format below).
Output Format
Always structure the report as:
- Target Object — exact name, type (table/column/proc/view/trigger), and schema
- Direct SQL Dependents — list of procs/views/triggers/functions that reference it directly, grouped by object type
- Application Code Dependents — list of files/classes/methods that reference it, grouped by layer (data access, API/service, frontend), with file paths
- Indirect / Dynamic References — anything found via dynamic SQL, synonyms, or call chains that couldn't be fully resolved — labeled clearly as needing manual verification
- Risk Summary — one paragraph: is this object narrowly used (low risk) or widely fanned-out (high risk)? Call out anything that touches a scheduled job, external integration, or reporting layer specifically, since those often get missed
- Suggested Verification Steps — concrete next actions before making the change (e.g., "run these two procs against staging data first," "check if the ReportingService endpoint at X depends on this column")
Guidelines
- Never claim a dependency is complete or exhaustive — static text search cannot catch every dynamic SQL construction or reflection-based ORM mapping. State the search method used and its limits explicitly in the report.
…
常见问题
什么是“爆炸半径”?
“爆炸半径”指的是一次变更可能波及的范围。它回答的问题是:如果我改了这里,还会影响到多远的地方,又会影响到哪些内容?
这个工具能找到所有使用该对象的地方吗?
它会尽力找到尽可能多的引用,但在非常复杂的代码或动态写法中,有些引用可能只能靠人工查找。工具会提醒你这一点。
我需要会编程才能使用它吗?
不需要。这个工具也是为非程序员设计的,它会清晰地呈现信息,帮助你做出决策。
详情
作者的原始描述
Before modifying a table, column, stored procedure, view, or trigger in a legacy codebase, trace every place that references it — across other SQL objects (procs, views, triggers) AND application code (C#, Angular/TypeScript, JS, or any language in the repo) — and produce a structured blast-radius report so you know what breaks before you change it. Use when the user asks 'what uses this column/ta
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7433
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。