agentleFS
godhiraj-codegodhiraj-code/greenbuild-plugin/skills/api-test-generator/SKILL.md

api-test-generator

Skill1 starsChanged 28 days agoMITView on GitHub

Generate API test cases and runnable tests (pytest+requests, REST Assured, Playwright request, Postman/Newman) from an OpenAPI spec or endpoint description, plus consumer-driven contract tests with Pact.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never put real tokens or production URLs in code.

    line 42

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

API test generation

  1. Get the spec (OpenAPI, Postman collection, or curl samples) and the team's framework from memory.
  2. Cases per endpoint:
    • happy path
    • required vs optional fields
    • type, format and boundary checks
    • auth: missing, invalid, expired, wrong role
    • 404/409 responses
    • idempotency
    • pagination and filters
    • response schema/contract checks Prioritize by risk (writes, auth, money), and show the table before writing code.
  3. pytest + requests:
import os, uuid, requests
BASE = os.environ["BASE_URL"]
def test_create_user(auth_headers):
    body = {"email": f"qa+{uuid.uuid4().hex[:8]}@example.com"}
    r = requests.post(f"{BASE}/users", json=body, headers=auth_headers, timeout=10)
    assert r.status_code == 201
    assert r.json()["email"] == body["email"]

Validate the schema with jsonschema or pydantic, and clean up the data you created in fixtures. 4. REST Assured (Java):

given().baseUri(System.getenv("BASE_URL")).auth().oauth2(token)
  .contentType(ContentType.JSON).body(payload)
.when().post("/users")
.then().statusCode(201).body("email", equalTo(email))
  .body(matchesJsonSchemaInClasspath("user.json"));
  1. Postman/Newman in CI: npm i -g newman, then newman run collection.json -e staging.json --reporters cli,junit --reporter-junit-export results.xml. Keep tests in the collection's Tests tab (pm.test, pm.expect). Keep env secrets out of git.
  2. Contract testing with Pact (consumer-driven):
    • The consumer test defines its interactions against the Pact mock server (@pact-foundation/pact for JS, pact-python v3 for Python, au.com.dius.pact for JVM), which writes a pact JSON file.
    • Publish to a Pact Broker or PactFlow, and the provider verifies against it in its own CI.
    • Gate deploys with pact-broker can-i-deploy --pacticipant <app> --version <sha> --to-environment production.
    • Contracts test the shape and expectations the consumer depends on, not business logic.
  3. Never put real tokens or production URLs in code. Give the run command, and state that the code was not executed unless you actually ran it.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.