Token导航 LogoToken导航TokenDH.com
研究检索external-servicegithub未标认证来源可访问许可证需确认审计提醒

ln-643-api-contract-auditorLN 643 API contract auditor 搜索

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

6,256

周安装

266

GitHub Stars

437

下载量

2,192
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ln-643-api-contract-auditor(LN 643 API contract auditor 搜索)
来源仓库:https://github.com/levnikolaevich/claude-code-skills
仓库路径:skills/ln-643-api-contract-auditor
安装命令:
npx skills add https://github.com/levnikolaevich/claude-code-skills --skill ln-643-api-contract-auditor
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/levnikolaevich/claude-code-skills --skill ln-643-api-contract-auditor

简介

用于辅助 API 设计、接口文档和前后端联调。ln-643-api-contract-auditor 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

  • 适合梳理 endpoint、生成 OpenAPI 草稿或检查字段命名。
  • 使用时需确认业务语义、鉴权方式和错误处理规则。
  • 生成接口文档时应从现有代码或样例中提取事实,避免凭空补字段。
  • 建议结合 schema 和接口样例验证请求响应结构。

SKILL.md

Paths: File paths (shared/, references/, ../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. If shared/ is missing, fetch files via WebFetch from https://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.

API Contract Auditor (L3 Worker)

Type: L3 Worker

Specialized worker auditing API contracts, method signatures at service boundaries, and DTO usage patterns.

Purpose & Scope

  • Audit API contracts at architecture level (service boundaries, layer separation)
  • Check layer leakage, DTO patterns, error contract consistency
  • Return structured analysis with 4 scores (compliance, completeness, quality, implementation)

Out of Scope (owned by ln-623-code-principles-auditor):

  • Code duplication (same DTO shape repeated, same mapping logic, same validation)
  • Report only ARCHITECTURE BOUNDARY findings (wrong layer, missing contract)

Inputs

- pattern: "API Contracts"     # Pattern name
- locations: string[]          # Service/API directories
- adr_reference: string        # Path to related ADR
- bestPractices: object        # Best practices from MCP Ref/Context7
- output_dir: string           # e.g., ".hex-skills/runtime-artifacts/runs/{run_id}/audit-report"

# Domain-aware (optional, from coordinator)
- domain_mode: "global" | "domain-aware"   # Default: "global"
- current_domain: string                   # e.g., "users", "billing" (only if domain-aware)
- scan_path: string                        # e.g., "src/users/" (only if domain-aware)

Workflow

Phase 0: Load References

MANDATORY READ: Load shared/references/two_layer_detection.md for detection methodology. Load references/detection_patterns.md -- language-specific Grep patterns for all 5 rules. MANDATORY READ: Load shared/references/mcp_tool_preferences.md and shared/references/mcp_integration_patterns.md

Use hex-graph first when symbol or reference analysis materially improves contract findings. Use hex-line first for local code reads when available. If MCP is unavailable, unsupported, or not indexed, continue with built-in Read/Grep/Glob/Bash and state the fallback in the report.

Phase 1: Discover Service Boundaries

scan_root = scan_path IF domain_mode == "domain-aware" ELSE codebase_root

1. Find API layer: Glob("**/api/**/*.py", "**/routes/**/*.ts", "**/controllers/**/*.ts", root=scan_root)
2. Find service layer: Glob("**/services/**/*.py", "**/services/**/*.ts", root=scan_root)
3. Find domain layer: Glob("**/domain/**/*.py", "**/models/**/*.py", root=scan_root)
4. Map: which services are called by which API endpoints

Phase 2: Analyze Contracts (5 Rules)

MANDATORY READ: Load skills-catalog/ln-643-api-contract-auditor/references/detection_patterns.md for language-specific Grep patterns per rule.

#RuleSeverityWhat to Check
1Layer LeakageHIGH/MEDIUMService/domain accepts HTTP types (Request, parsed_body, headers)
2Missing DTOMEDIUM/LOW4+ params repeated in 2+ methods without grouping DTO
3Entity LeakageHIGH/MEDIUMORM entity returned from API without response DTO. Downgrade when: internal API with no external consumers -> LOW
4Error ContractsMEDIUM/LOWMixed error patterns (raise + return None) in same service
5Redundant OverloadsLOW/MEDIUMMethod pairs with _with_/_and_ suffix differing by 1-2 params
6Architectural HonestyHIGH/MEDIUMRead-named function (get_/find_/check_/validate_/is_/has_) body contains write side-effects. Exclusions per shared/references/ai_ready_architecture.md

Scope boundary: SKIP DUPLICATION findings (owned by ln-623), REPORT only ARCHITECTURE BOUNDARY findings.

Phase 3: Calculate 4 Scores

Compliance Score (0-100):

CriterionPoints
No layer leakage (HTTP types in service)+35
Consistent error handling pattern+25
Follows project naming conventions+10
No hidden side-effects in read-named functions+10
No entity leakage to API+20

Completeness Score (0-100):

CriterionPoints
All service methods have typed params+30
All service methods have typed returns+30
DTOs defined for complex data+20
Error types documented/typed+20

Quality Score (0-100):

CriterionPoints
No boolean flag params in service methods+15
No opaque return types hiding write actions+10
No methods with >5 params without DTO+25
Consistent naming across module+25
No redundant overloads+25

Implementation Score (0-100):

CriterionPoints
DTOs/schemas exist and are used+30
Type annotations present+25
Validation at boundaries (Pydantic, Zod)+25
API response DTOs separate from domain+20

Phase 3.5: Calculate Score

MANDATORY READ: Load shared/references/audit_worker_core_contract.md and shared/references/audit_scoring.md.

Primary score uses penalty formula (same as all workers):

penalty = (critical x 2.0) + (high x 1.0) + (medium x 0.5) + (low x 0.2)
score = max(0, 10 - penalty)

Diagnostic sub-scores (0-100 each) are calculated separately and reported in AUDIT-META for diagnostic purposes only.

Phase 4: Write Report

MANDATORY READ: Load shared/references/audit_worker_core_contract.md and shared/templates/audit_worker_report_template.md.

Write JSON summary per shared/references/audit_summary_contract.md. In managed mode the caller passes both runId and summaryArtifactPath; in standalone mode the worker generates its own run-scoped artifact path per shared contract.

# Build markdown report in memory with:
# - AUDIT-META (extended: score [penalty-based] + diagnostic score_compliance/completeness/quality/implementation)
# - Checks table (layer_leakage, missing_dto, entity_leakage, error_contracts, redundant_overloads)
# - Findings table (issues sorted by severity)
# - DATA-EXTENDED: issues array with principle + domain fields (for cross-domain aggregation)

IF domain_mode == "domain-aware":
  Write to {output_dir}/643-api-contract-{current_domain}.md
ELSE:
  Write to {output_dir}/643-api-contract.md

Phase 5: Return Summary

Report written: .hex-skills/runtime-artifacts/runs/{run_id}/audit-report/643-api-contract-users.md
Score: 6.75/10 (C:65 K:70 Q:55 I:80) | Issues: 4 (H:2 M:1 L:1)

Critical Rules

MANDATORY READ: Load shared/references/audit_worker_core_contract.md.

  • Architecture-level only: Focus on service boundaries, not internal implementation
  • Read before score: Never score without reading actual service code
  • Scope boundary: SKIP duplication findings (owned by ln-623)
  • Detection patterns: Use language-specific Grep from detection_patterns.md
  • Domain-aware: When domain_mode="domain-aware", scan only scan_path, tag findings with domain

Definition of Done

MANDATORY READ: Load shared/references/audit_worker_core_contract.md.

  • Service boundaries discovered (API, service, domain layers)
  • Method signatures extracted and analyzed
  • All 5 rules checked using detection_patterns.md
  • Scope boundary applied (no duplication with ln-623)
  • 4 scores calculated with justification
  • Issues identified with severity, location, suggestion, effort
  • If domain-aware: findings tagged with domain field
  • Report written to {output_dir}/643-api-contract[-{domain}].md (atomic single Write call)
  • Summary written per contract

Reference Files

  • Detection patterns: references/detection_patterns.md
  • Scoring rules: ../ln-640-pattern-evolution-auditor/references/scoring_rules.md
  • Pattern library: ../ln-640-pattern-evolution-auditor/references/pattern_library.md

Version: 2.0.0 Last Updated: 2026-02-08

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.49%
按下载量换算734

Claude

29.47%
按下载量换算646

Cursor

19.78%
按下载量换算434

Gemini CLI

9.26%
按下载量换算203

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills