Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)40k · #7051

api-breaking-change-detector

Skill này làm gì

Agent này so sánh mã “backend” (nơi dữ liệu được tạo và quản lý) với mã “frontend” (phần người dùng nhìn thấy và tương tác) để tìm vấn đề trước khi chúng gây lỗi.

Khi nào nên dùng

  • ✓Khi bạn thay đổi thứ gì đó trong “backend” và muốn biết nó có làm hỏng “frontend” không.
  • ✓Khi bạn muốn đảm bảo “frontend” và “backend” “nói cùng một ngôn ngữ”.
  • ✓Trước khi phát hành phiên bản mới của chương trình, để kiểm tra mọi thứ vẫn hoạt động cùng nhau.

Liên kết skill

https://github.com/github/awesome-copilot/blob/main/skills/api-breaking-change-detector/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/github/awesome-copilot/blob/main/skills/api-breaking-change-detector/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Kiểm tra xem thay đổi trong controller C# của tôi có làm hỏng frontend không.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent phân tích cách dữ liệu được gửi và nhận trong “backend”, rồi tìm các chỗ tương ứng trong mã “frontend”. Nếu phát hiện khác biệt, nó sẽ cảnh báo bạn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

API Breaking Change Detector

You are cross-referencing a C# Web API's actual contract (controllers, DTOs, route definitions) against its TypeScript/JavaScript consumers to find contract drift — in both directions — before it reaches production.

When to use this

Trigger when the user asks to:

  • Check whether a DTO/controller change will break frontend or client applications
  • Verify the client and backend API contract are still in sync
  • Audit a specific endpoint, or the whole API surface, for breaking changes before a release

Do not use this for:

  • Generating new API code from an OpenAPI spec (see openapi-to-application-code)
  • Scaffolding new endpoints with OpenAPI docs (see aspnet-minimal-api-openapi)
  • Comparing two OpenAPI spec files directly — this skill reads source code, not exported specs

Process

  1. Discover Global JSON & Naming Policies:

    • Check Program.cs or Startup.cs for active JSON options (e.g. JsonNamingPolicy.CamelCase, PropertyNamingPolicy, or Newtonsoft CamelCasePropertyNamesContractResolver).
    • Default to camelCase for TypeScript/JavaScript field mapping if global camelCase is configured, unless overridden by an explicit [JsonPropertyName("...")] attribute on the C# property.
    • Ignore C# properties annotated with [JsonIgnore].
  2. Identify the C# contract surface. For each Controller action in scope:

    • Route: Base [Route("...")] + action [HttpGet("...")] / [HttpPost("...")]. Normalize route parameters (e.g. {id:int} or {id:guid} $\rightarrow$ {id}).
    • Request DTO: Extract property names, types, and requirement rules:
      • Required if: annotated with [Required], [BindRequired], has the C# 11 required modifier (public required string X), or is a non-nullable value type (int, Guid, bool) without a default value.
      • Optional if: nullable (string?, int?), or has a default initializer.
    • Response DTO: Property names, types, and nullability.
    • Explicit Status Codes: [ProducesResponseType(statusCode)] attributes and explicit StatusCode(...) return paths.
  3. Find the matching TypeScript/JavaScript consumer (with Normalized URL Matching):

    • Auto-generated client match (high confidence): look for generated client files (NSwag/OpenAPI Generator output) and match by generated method/interface name directly.
    • Hand-written service/client match (medium confidence):
      • Search TypeScript/JavaScript files for HTTP client calls (fetch, axios, Angular HttpClient, ky, etc.) whose normalized URL pattern matches the controller's route.
      • Normalize template strings and concatenations (e.g., ${this.apiUrl}/users/${id} or baseUrl + '/users/' + userId $\rightarrow$ /users/{id}).
      • Match normalized routes against C# routes regardless of variable naming in TypeScript/JS.
    • No match found: report as "no client consumer located" rather than guessing — do not assume an endpoint is unused just because a match wasn't found statically.
    • Label every finding with which of these three methods was used to locate it.
  4. Compare backend → frontend/client (breaks the client):

    • A DTO property renamed or removed that the TypeScript/JS interface or object model still expects
    • A new required request field the client never sends
    • A response status code the client doesn't handle (e.g. controller now returns 409 Conflict, but client error handler only handles 400/500)
    • A response field's type changed (e.g. long $\rightarrow$ string, or non-nullable $\rightarrow$ nullable) in a way the client type assumes differently
  5. Compare frontend/client → backend (stale/dead client code vs. silent bugs):

    • Harmless dead field: Client sends a payload property the backend ignores without error.
    • Silently broken bug (High Severity): Client logic reads a response property that the backend no longer returns (resulting in undefined at runtime and potential application failures).
  6. Produce the report (see Output Format). This skill does not modify code.

Output Format

  1. Scope Audited — Controllers, DTOs, and TypeScript/JavaScript files audited, along with detected JSON naming policies (e.g. camelCase enabled via Program.cs).

…

Câu hỏi thường gặp

“Breaking changes” là gì?

Đó là những thay đổi làm gián đoạn việc giao tiếp giữa “backend” và “frontend”, khiến chương trình ngừng hoạt động đúng.

API “contract” là gì?

Đó là thỏa thuận về cách “backend” và “frontend” trao đổi thông tin, xác định dữ liệu nào được mong đợi và dữ liệu nào sẽ được gửi.

Agent có tìm được lỗi trong mọi loại “frontend” không?

Có, nó tìm các mẫu giao tiếp trong nhiều ngôn ngữ và thư viện frontend phổ biến như JavaScript và TypeScript.

Chi tiết

Mô tả gốc của tác giả

Cross-references C# Web API controllers/DTOs against their TypeScript/JavaScript consumers (React, Angular, Vue, Svelte, Node.js, or hand-written/auto-generated HTTP clients like Fetch, Axios, NSwag) to catch contract drift in both directions: backend changes that break client applications (renamed/removed JSON keys, new required parameters, status code shifts) and frontend code sending fields the

repo: github/awesome-copilot

Độ phổ biến

Sao GitHub
40k
Vị trí xếp hạng
#7051
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự