AGENT SKILL

validating-api-contracts

Validate API contracts using consumer-driven contract testing (Pact, Spring Cloud Contract). Use when performing specialized testing. Trigger with phrases like "validate API contract", "run contract tests", or "check consumer contracts".

License 许可
MIT
最近更新
2025-12-18
Stars
★ 29
Forks
9

01 前言 Front Matter

name
validating-api-contracts
license
MIT
version
1.0.0
description
Validate API contracts using consumer-driven contract testing (Pact, Spring Cloud Contract). Use when performing specialized testing. Trigger with phrases like "validate API contract", "run contract tests", or "check consumer contracts".
allowed-tools
Read, Write, Edit, Grep, Glob, Bash(test:contract-*)

02 资源文件 8

03 SKILL.md 正文

Prerequisites

Before using this skill, ensure you have:

  • Test environment configured and accessible
  • Required testing tools and frameworks installed
  • Test data and fixtures prepared
  • Appropriate permissions for test execution
  • Network connectivity if testing external services

Instructions

Step 1: Prepare Test Environment

Set up the testing context:

  1. Use Read tool to examine configuration from {baseDir}/config/
  2. Validate test prerequisites are met
  3. Initialize test framework and load dependencies
  4. Configure test parameters and thresholds

Step 2: Execute Tests

Run the test suite:

  1. Use Bash(test:contract-*) to invoke test framework
  2. Monitor test execution progress
  3. Capture test outputs and metrics
  4. Handle test failures and error conditions

Step 3: Analyze Results

Process test outcomes:

  • Identify passed and failed tests
  • Calculate success rate and performance metrics
  • Detect patterns in failures
  • Generate insights for improvement

Step 4: Generate Report

Document findings in {baseDir}/test-reports/:

  • Test execution summary
  • Detailed failure analysis
  • Performance benchmarks
  • Recommendations for fixes

Output

The skill generates comprehensive test results:

Test Summary

  • Total tests executed
  • Pass/fail counts and percentage
  • Execution time metrics
  • Resource utilization stats

Detailed Results

Each test includes:

  • Test name and identifier
  • Execution status (pass/fail/skip)
  • Actual vs. expected outcomes
  • Error messages and stack traces

Metrics and Analysis

  • Code coverage percentages
  • Performance benchmarks
  • Trend analysis across runs
  • Quality gate compliance status

Error Handling

Common issues and solutions:

Environment Setup Failures

  • Error: Test environment not properly configured
  • Solution: Verify configuration files; check environment variables; ensure dependencies are installed

Test Execution Timeouts

  • Error: Tests exceeded maximum execution time
  • Solution: Increase timeout thresholds; optimize slow tests; parallelize test execution

Resource Exhaustion

  • Error: Insufficient memory or disk space during testing
  • Solution: Clean up temporary files; reduce concurrent test workers; increase resource allocation

Dependency Issues

  • Error: Required services or databases unavailable
  • Solution: Verify service health; check network connectivity; use mocks if services are down

Resources

Testing Tools

  • Industry-standard testing frameworks for your language/platform
  • CI/CD integration guides and plugins
  • Test automation best practices documentation

Best Practices

  • Maintain test isolation and independence
  • Use meaningful test names and descriptions
  • Keep tests fast and focused
  • Implement proper setup and teardown
  • Version control test artifacts
  • Run tests in CI/CD pipelines

04 同仓库更多 Skills

BbgnsurfTech
BbgnsurfTech/claude-skills-collection

UI 视觉回归测试

testing-visual-regression

使用截图比较检测 UI 组件中的视觉变化。 在检测意外的 UI 更改或像素差异时使用。 用“测试视觉变化”、“比较截图”或“检测 UI 回归”等短语触发。

测试工程师测试与质量保障
★ 29
BbgnsurfTech
BbgnsurfTech/claude-skills-collection

单元测试自动生成

generating-unit-tests

从源代码自动生成全面的单元测试,覆盖正常路径、边界条件和错误情况。 在为函数、类或模块创建测试覆盖时使用。 用“生成单元测试”、“为…创建测试”或“添加测试覆盖”等短语触发。

测试工程师测试与质量保障
★ 29
BbgnsurfTech
BbgnsurfTech/claude-skills-collection

测试报告生成与可视化

generating-test-reports

生成包含指标、覆盖率和可视化内容的全面测试报告。 在执行专项测试时使用。 用“生成测试报告”、“创建测试文档”或“显示测试指标”等短语触发。

测试工程师测试与质量保障
★ 29
BbgnsurfTech
BbgnsurfTech/claude-skills-collection

测试执行编排与协调

orchestrating-test-execution

协调跨多个环境和框架的并行测试执行。 在执行专项测试时使用。 用“编排测试”、“运行并行测试”或“协调测试执行”等短语触发。

测试工程师测试与质量保障
★ 29
BbgnsurfTech
BbgnsurfTech/claude-skills-collection

managing-test-environments

Provision and manage isolated test environments with configuration and data. Use when performing specialized testing. Trigger with phrases like "manage test environment", "provision test env", or "setup test infrastructure".

★ 29
BbgnsurfTech
BbgnsurfTech/claude-skills-collection

generating-test-doubles

Generate mocks, stubs, spies, and fakes for dependency isolation. Use when creating mocks, stubs, or test isolation fixtures. Trigger with phrases like "generate mocks", "create test doubles", or "setup stubs".

★ 29