api-test-patterns

Generate Playwright and Pact API tests for REST and GraphQL endpoints.

5|1|Updated Feb 4, 2026
One-click install
npx skills add https://github.com/latestaiagents/agent-skills --skill api-test-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-test-patterns
Source: https://github.com/latestaiagents/agent-skills/tree/main/plugins/qa-testing/skills/api-testing/api-test-patterns
Command: npx skills add https://github.com/latestaiagents/agent-skills --skill api-test-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @pact-foundation/pact, @playwright/test, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a comprehensive framework and examples for writing reliable API tests, ensuring your endpoints function correctly and meet their contract specifications.

Core Features & Use Cases

  • REST API Testing: Comprehensive examples using Playwright for CRUD operations, authentication, and error handling.
  • GraphQL Testing: Demonstrates querying and mutation testing for GraphQL APIs.
  • Contract Testing: Integrates with Pact for consumer-driven contract testing.
  • Checklists & Best Practices: Provides a detailed checklist and actionable best practices for thorough API testing.
  • Use Case: You need to ensure your new user registration API endpoint correctly handles valid inputs, rejects invalid ones, and returns the expected user data upon successful creation.

Quick Start

Use the api-test-patterns skill to generate Playwright tests for a REST API endpoint that creates a new user.

Frequently Asked Questions about api-test-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write API tests for both REST and GraphQL endpoints?

You can write API tests for REST and GraphQL endpoints using Playwright to cover scenarios like CRUD operations, querying, mutations, and authentication. This approach validates both happy paths and error handling.

What is consumer-driven contract testing and how does Pact work with it?

Consumer-driven contract testing validates API integration points by verifying expectations between services. Pact generates and verifies these contracts, ensuring providers and consumers remain compatible without requiring full end-to-end integration tests.

Can I use Playwright for API testing instead of just browser automation?

Yes, Playwright can be used for API testing to send HTTP requests and validate responses for REST and GraphQL APIs. It handles input validation, authentication, and error handling directly against your endpoints.

What's the best way to test API authentication and input validation?

The best way to test API authentication and input validation is by generating comprehensive test suites that explicitly cover happy paths, invalid inputs, and error handling. This ensures endpoints correctly reject invalid data and secure resources.

How do I handle error handling scenarios when testing GraphQL APIs?

Error handling for GraphQL APIs is managed by testing query and mutation responses for expected failures and edge cases. This validates that the API correctly handles invalid inputs and returns appropriate error structures.

Does contract testing replace integration testing for REST APIs?

Contract testing with Pact complements rather than replaces integration testing by isolating consumer-provider interactions. It verifies that REST API contracts are met, ensuring integration points function correctly without testing the entire system.