agentleFS
mejbaurbaharmejbaurbahar/software-tester-skills/skills/graphql-testing/SKILL.md

graphql-testing

Skill1 starsChanged 52 days agoMITView on GitHub

Use when testing GraphQL APIs — queries, mutations, subscriptions, schema validation and breaking-change detection, N+1 queries, depth/complexity limits, introspection exposure, authorization per field, batching abuse, and federation contracts.

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:

    Resolver units: call resolvers with mocked context/dataloaders.

    line 17

≈ “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

GraphQL Testing

GraphQL moves risk from URLs to schema + resolvers: one endpoint, client-defined queries, per-field auth.

Test layers

  1. Schema: lint & diff for breaking changes — graphql-inspector diff old.graphql new.graphql, rover subgraph check (federation), graphql-schema-linter.
  2. Resolver units: call resolvers with mocked context/dataloaders.
  3. Operation tests against a running server (in-memory executeOperation or HTTP).
  4. Contract: persisted queries/operations used by real clients must still validate against the new schema (graphql-inspector validate 'src/**/*.graphql' schema.graphql).
  5. Non-functional: complexity, depth, rate limits, N+1, latency.

Operation tests

const res = await server.executeOperation({
  query: `query($id: ID!){ order(id:$id){ id total items{ sku qty } } }`,
  variables: { id: "A-991" } }, { contextValue: ctxFor("alice") });
expect(res.body.singleResult.errors).toBeUndefined();
curl -s $URL/graphql -H 'content-type: application/json' -H "authorization: Bearer $T" \
 -d '{"query":"{ __typename }"}'

Cover: nullability (! fields returning null bubbles up), partial errors (data + errors), input validation/coercion, enums & custom scalars, pagination (Relay cursors: first/after, stable ordering, empty page), mutations return payload + userErrors, idempotency, subscriptions (connect, auth on connect, reconnect, ordering, unsubscribe leak).

Security & abuse checklist

RiskTest
Introspection in prod{__schema{types{name}}} should be disabled/restricted
Depth/complexity DoSDeeply nested & aliased queries must be rejected (depthLimit, cost analysis)
Batching/alias abuse1000 aliases of login → rate-limited (brute force bypass)
Field-level authz (BOLA)User A queries user(id: B){ email } → denied
Mass assignmentExtra input fields ignored/rejected
InjectionSQL/NoSQL via arguments; SSRF via URL args
Verbose errorsNo stack traces / SQL in errors[].extensions
CSRF on GET/multipartContent-type enforcement
Tools: graphql-cop, InQL, clairvoyance (schema recovery when introspection is off), Escape/StackHawk scanners.

Performance

Detect N+1: count DB queries per request (log/APM), require DataLoader batching; test large lists & fan-out; measure p95 by operation name (persisted-query ID).

Related

api-testing, contract-testing, security-testing, microservices-testing, performance-testing

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.