api-test-generator
Skill2 starsChanged 5 days agoMITView on GitHub
Generates comprehensive API integration tests (using Jest/Supertest, Pytest, etc.) from existing backend repositories, ORM schemas, and router/controller files. Use when a user wants to test their newly provisioned data platform or backend services.
- Deletes or force-pushes
2 other projects use a version of this.
Adopted by
Most recently taken up by
- godhiraj-code/greenbuild-plugintheir own version, first seen Nov 1, 2026
- nek1987/auto-agent-harnesstheir own version, first seen Oct 11, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- nek1987/auto-agent-harness★ 4same name
- godhiraj-code/greenbuild-plugin★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- cloud-solution-architectSkill
- context7-mcpSkill
- forgeSkill
- frontend-data-consumerSkill
- frontend-design-reviewSkill
- infrastructure-as-code-architectSkill
- ship-to-vpsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
After using the forge skill to scaffold a new backend.
- Distinctive: line 12
When adding new endpoints to an existing service.
- Distinctive: line 13
When refactoring DTOs, Schemas, or ORM models.
- Distinctive: line 14
When generating Postman/Bruno collections for manual API testing.
- Very specific: line 67
If requested, output a JSON collection for Postman or Bruno.
- Distinctive: line 71
Clear state between tests: Use ORM capabilities to truncate tables or rollback transactions before every test case to prevent flakiness.
≈ “Common” is an estimate: at least 1 in 5 of the 383,637 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Test Generator
Generate production-grade integration tests for existing API endpoints and backend services. This skill ensures that newly provisioned schemas and controllers are fully validated against business requirements.
🎯 When to Use
- After using the
forgeskill to scaffold a new backend. - When adding new endpoints to an existing service.
- When refactoring DTOs, Schemas, or ORM models.
- When generating Postman/Bruno collections for manual API testing.
🛠️ Step-by-Step Workflow
1. Analyze the Backend Structure
- Scan the existing codebase to identify the framework (e.g., Express + TS, FastAPI, Spring Boot, .NET).
- Identify the ORM being used (e.g., Prisma, SQLAlchemy, EF Core).
- Locate the router/controller files to extract the exact endpoint paths, HTTP methods, and expected payloads.
2. Set Up the Test Environment
- Generate the necessary test scaffolding (e.g.,
jest.config.jswithts-jestfor TypeScript, orconftest.pyfor Pytest). - Auto-generate test database setup, teardown, and seeding scripts using the existing ORM. Tests should run against an isolated test database (e.g., a local Docker container) and rollback state between tests.
- Provide instructions or a workflow snippet for running the tests (e.g.,
npm run test:e2e).
3. Generate Integration Tests
For every identified endpoint, generate tests that cover:
- Happy Path: 200 OK or 201 Created with valid payloads. Verify the response shape against the API contract.
- Validation Errors: 400 Bad Request triggers by sending missing required fields, incorrect types, or boundary violations.
- Not Found / Edge Cases: 404 Not Found handling for invalid IDs.
- Auth / Permissions (if applicable): 401 Unauthorized or 403 Forbidden checks.
Example TypeScript + Jest + Supertest:
import request from 'supertest';
import { app } from '../src/app';
import { prisma } from '../src/db/prisma';
describe('POST /api/users', () => {
afterAll(async () => {
await prisma.user.deleteMany(); // cleanup
});
it('should create a new user and return 201', async () => {
const res = await request(app)
.post('/api/users')
.send({ email: 'test@example.com', name: 'Test User' });
expect(res.status).toBe(201);
expect(res.body).toHaveProperty('id');
expect(res.body.email).toBe('test@example.com');
});
it('should return 400 if email is missing', async () => {
const res = await request(app)
.post('/api/users')
.send({ name: 'Test User' });
expect(res.status).toBe(400);
});
});4. Provide API Collections (Optional)
If requested, output a JSON collection for Postman or Bruno. This allows the user to easily import the endpoints and play with them manually. Make sure to parameterize base URLs using environment variables like {{baseUrl}}.
⚙️ Best Practices
- Never mock the database for integration tests if it can be avoided. Tests should hit a real test database instance to ensure ORM queries behave exactly as they will in production.
- Clear state between tests. Use ORM capabilities to truncate tables or rollback transactions before every test case to prevent flakiness.
- Use factories. Leverage libraries like
faker.jsorfactory_boyto create realistic test payloads instead of hardcoding'test'everywhere.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

