跳到正文
Skillpedia
测试40k · #7433

sql-object-impact-analysis

它能做什么

这个工具可以在你修改数据库中的某个部分(例如表或字段)之前,找出所有使用它的地方。它会搜索你的所有程序代码和数据库,告诉你哪些地方可能会出问题。

适用场景

  • ✓当你想修改某个表或字段,但不确定会影响哪些地方时。
  • ✓当你使用的是老系统,依赖关系很难追踪时。
  • ✓当你需要一份关于数据库变更影响范围的报告时。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/sql-object-impact-analysis/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/sql-object-impact-analysis/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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

  1. 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.

  2. Search the SQL layer first:

    • Search all .sql files, 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
  3. 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.
  4. 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
  5. Produce the report (see Output Format below).

Output Format

Always structure the report as:

  1. Target Object — exact name, type (table/column/proc/view/trigger), and schema
  2. Direct SQL Dependents — list of procs/views/triggers/functions that reference it directly, grouped by object type
  3. Application Code Dependents — list of files/classes/methods that reference it, grouped by layer (data access, API/service, frontend), with file paths
  4. Indirect / Dynamic References — anything found via dynamic SQL, synonyms, or call chains that couldn't be fully resolved — labeled clearly as needing manual verification
  5. 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
  6. 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能