GraphQL (professional)
Skill text is English; answer in the user’s preferred language when rules or the conversation specify it.
Use official GraphQL Specification, GraphQL over HTTP, and GraphQL.org learn for standards truth; this skill encodes schema-first modeling, resolver discipline, and production-safe performance and security defaults.
Boundary
graphql-pro owns GraphQL contract (SDL shape, resolver behavior per field), execution concerns (batching, limits), and schema evolution. api-design-pro owns cross-protocol governance when REST and GraphQL coexist at product level; postgresql-pro owns SQL tuning beneath resolvers; security-pro owns threat modeling breadth beyond GraphQL defaults.
Related skills (this repo)
| Skill |
When to combine |
api-design-pro |
Versioning, errors, deprecation alongside REST |
security-pro |
Introspection policy, authZ depth, abusive queries |
nestjs-pro |
Code-first GraphQL module, guards, DI |
postgresql-pro |
Indexes, RLS, query plans under dataloaders |
testing-pro |
Operation tests, SDL snapshots, integration DB |
caching-pro |
APQ, CDN caching of GET queries, Redis layers |
When to use
- Types, fields, mutations, subscriptions design.
- Resolver review: N+1, batching, errors, authZ per field.
- Latency/cost: complexity limits, DataLoader patterns.
- Backward-compatible evolution, deprecation.
- Federation ownership and composition issues.
When not to use
- Pure REST/OpenAPI design —
api-design-pro unless comparing hybrid.
- Database schema design only —
postgresql-pro (pair when resolvers touch SQL).
Required inputs
- Server stack (Apollo Server, Mercurius, Yoga, Nest GraphQL module, …).
- Single graph vs federation and gateway/router if applicable.
Expected output
Follow Suggested response format strictly — execution model through operational risks.
Workflow
Apply Karpathy principles throughout: Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution.
- Confirm stack, federation vs monolith, client patterns (persisted ops vs ad hoc). → verify: [context documented].
- State assumptions about requirements, constraints (Think Before Coding).
- Apply minimum solution first; escalate only when justified (Simplicity First).
- Make surgical changes — only touch code directly related to the request (Surgical Changes).
- Define success criteria; loop until verified (Goal-Driven Execution).
- Respond using Suggested response format; note main risks.
Operating principles
- Think Before Coding — Confirm server stack, graph topology, and client query patterns before proposing schema or resolver changes. Ask when federation ownership or authZ boundary is unclear.
- Simplicity First — Prefer the smallest schema or resolver change that preserves contract clarity. Do not introduce custom directives, federation layers, or caching systems unless required.
- Surgical Changes — Touch only the relevant field, type, resolver, or execution control. Avoid unrelated SDL cleanup or global error-policy rewrites.
- Goal-Driven Execution — Done = the contract behaves correctly under GraphQL execution rules, and performance/authZ assumptions are verified.
- Schema is product contract — Field names, nullability, and mutation semantics are API decisions, not implementation details.
- Resolver work is per field — N+1, authZ leaks, and inconsistent error handling usually come from field-level behavior, not the top-level query alone.
- Nullability is a blast-radius control — Choosing nullable vs non-null affects failure propagation and client breakage.
- Query cost must be bounded — Production safety requires limits, batching, or persisted operations when clients can shape expensive queries.
Default recommendations by scenario
- New schema surface — Model the smallest stable type and field set before adding convenience expansions.
- Resolver performance issue — Check batching, query shape, and SQL/path cost before changing schema.
- AuthZ issue — Verify field-level ownership and null/error behavior before broad middleware fixes.
- Federation issue — Clarify entity ownership and contract boundaries before adding router workarounds.
Decision trees
Summary: choose the fix based on whether the issue is schema contract, field execution, query cost, or federation ownership.
Details: references/decision-tree.md
Anti-patterns
Summary: nullable contracts by accident, resolvers doing hidden N+1 work, broad introspection or query-cost exposure, and schema churn that masks ownership problems.
Details: references/anti-patterns.md
GraphQL execution and schema system model (summary)
How parse, validate, execute, null propagation, and resolver composition actually work so contract and runtime issues stay explainable.
Details: references/graphql-execution-and-schema-system-model.md
Failure modes and mitigation (summary)
N+1, null cascades, DoS-style queries, federation skew, and subscription overload patterns to detect before production pain.
Details: references/failure-modes-detection-mitigation.md
Decision framework and trade-offs (summary)
How to choose schema patterns, pagination models, query controls, and coexistence with REST or other backends.
Details: references/decision-framework-and-trade-offs.md
Versions (summary)
Version-sensitive server or spec notes that affect directives, transport, and execution controls.
Details: references/versions.md
Suggested response format
- Context — Server stack, monolith vs federation, client query style, and persistence/authZ boundaries.
- Execution model — Explain the relevant schema, resolver, nullability, or query-cost behavior.
- Solution — Minimum SDL/resolver/control change with rationale.
- Verification — Query examples, performance checks, or authZ tests that prove the fix.
- Residual risks — Remaining nullability, cost, federation, or client-migration caveats.
Resources in this skill
| Topic |
File |
| GraphQL execution and schema system model |
references/graphql-execution-and-schema-system-model.md |
| Failure modes and mitigation |
references/failure-modes-detection-mitigation.md |
| Decision framework and trade-offs |
references/decision-framework-and-trade-offs.md |
| Decision tree |
references/decision-tree.md |
| Anti-patterns |
references/anti-patterns.md |
| Tips and tricks |
references/tips-and-tricks.md |
| Edge cases |
references/edge-cases.md |
| Quality validation and guardrails |
references/quality-validation-and-guardrails.md |
| Integration map |
references/integration-map.md |
| Version notes |
references/versions.md |
Quick example
Input: "This query is slow because each product resolves inventory separately."
- Inspect resolver fan-out and add batching at the field boundary before redesigning the schema.
- Keep the contract stable while fixing execution cost.
- Verify: The same query drops from N+1 database calls to a bounded batch pattern.
Input (tricky): "A non-null field occasionally throws and breaks the whole query."
- Explain null propagation and decide whether the contract should stay non-null or the resolver must harden.
- Fix the smallest correct layer: resolver guarantees or schema nullability.
- Verify: Partial failures behave exactly as the intended contract specifies.
Input (cross-skill): "We need field-level auth on tenant data backed by Postgres."
- Pair
security-pro for threat framing and postgresql-pro for underlying policy/data guarantees.
- Ensure resolver logic and data-layer isolation tell the same truth.
- Verify: Unauthorized fields resolve safely and tenant data cannot be inferred through query shape.
Checklist before calling the skill done
Source: truongnat/skills — distributed by TomeVault.
1---2name: truongnat-skills-graphql-pro3description: GraphQL (professional)4---56# GraphQL (professional)78Skill text is **English**; answer in the user’s preferred language when rules or the conversation specify it.910Use official [GraphQL Specification](https://spec.graphql.org/), [GraphQL over HTTP](https://graphql.github.io/graphql-over-http/), and [GraphQL.org learn](https://graphql.org/learn/) for standards truth; this skill encodes **schema-first modeling**, **resolver discipline**, and **production-safe** performance and security defaults.1112## Boundary1314**`graphql-pro`** owns **GraphQL contract** (SDL shape, resolver behavior per field), **execution concerns** (batching, limits), and **schema evolution**. **`api-design-pro`** owns **cross-protocol** governance when REST and GraphQL coexist at product level; **`postgresql-pro`** owns **SQL tuning** beneath resolvers; **`security-pro`** owns **threat modeling** breadth beyond GraphQL defaults.1516## Related skills (this repo)1718| Skill | When to combine |19|-------|----------------|20| **`api-design-pro`** | Versioning, errors, deprecation alongside REST |21| **`security-pro`** | Introspection policy, authZ depth, abusive queries |22| **`nestjs-pro`** | Code-first GraphQL module, guards, DI |23| **`postgresql-pro`** | Indexes, RLS, query plans under dataloaders |24| **`testing-pro`** | Operation tests, SDL snapshots, integration DB |25| **`caching-pro`** | APQ, CDN caching of GET queries, Redis layers |2627## When to use2829- Types, fields, mutations, subscriptions design.30- Resolver review: N+1, batching, errors, authZ per field.31- Latency/cost: complexity limits, DataLoader patterns.32- Backward-compatible evolution, deprecation.33- Federation ownership and composition issues.3435## When not to use3637- **Pure REST/OpenAPI** design — **`api-design-pro`** unless comparing hybrid.38- **Database schema design only** — **`postgresql-pro`** (pair when resolvers touch SQL).3940## Required inputs4142- **Server stack** (Apollo Server, Mercurius, Yoga, Nest GraphQL module, …).43- **Single graph vs federation** and gateway/router if applicable.4445## Expected output4647Follow **Suggested response format** strictly — execution model through operational risks.4849## Workflow5051Apply **Karpathy principles** throughout: Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution.52531. **Confirm** stack, federation vs monolith, client patterns (persisted ops vs ad hoc). → verify: [context documented].542. **State assumptions** about requirements, constraints (**Think Before Coding**).553. **Apply** minimum solution first; escalate only when justified (**Simplicity First**).564. **Make surgical changes** — only touch code directly related to the request (**Surgical Changes**).575. **Define success criteria**; loop until verified (**Goal-Driven Execution**).586. **Respond** using **Suggested response format**; note main risks.5960### Operating principles61621. **Think Before Coding** — Confirm server stack, graph topology, and client query patterns before proposing schema or resolver changes. Ask when federation ownership or authZ boundary is unclear.632. **Simplicity First** — Prefer the smallest schema or resolver change that preserves contract clarity. Do not introduce custom directives, federation layers, or caching systems unless required.643. **Surgical Changes** — Touch only the relevant field, type, resolver, or execution control. Avoid unrelated SDL cleanup or global error-policy rewrites.654. **Goal-Driven Execution** — Done = the contract behaves correctly under GraphQL execution rules, and performance/authZ assumptions are verified.665. **Schema is product contract** — Field names, nullability, and mutation semantics are API decisions, not implementation details.676. **Resolver work is per field** — N+1, authZ leaks, and inconsistent error handling usually come from field-level behavior, not the top-level query alone.687. **Nullability is a blast-radius control** — Choosing nullable vs non-null affects failure propagation and client breakage.698. **Query cost must be bounded** — Production safety requires limits, batching, or persisted operations when clients can shape expensive queries.7071## Default recommendations by scenario7273- **New schema surface** — Model the smallest stable type and field set before adding convenience expansions.74- **Resolver performance issue** — Check batching, query shape, and SQL/path cost before changing schema.75- **AuthZ issue** — Verify field-level ownership and null/error behavior before broad middleware fixes.76- **Federation issue** — Clarify entity ownership and contract boundaries before adding router workarounds.7778## Decision trees7980Summary: choose the fix based on whether the issue is schema contract, field execution, query cost, or federation ownership.8182Details: [references/decision-tree.md](references/decision-tree.md)8384## Anti-patterns8586Summary: nullable contracts by accident, resolvers doing hidden N+1 work, broad introspection or query-cost exposure, and schema churn that masks ownership problems.8788Details: [references/anti-patterns.md](references/anti-patterns.md)8990### GraphQL execution and schema system model (summary)9192How parse, validate, execute, null propagation, and resolver composition actually work so contract and runtime issues stay explainable.9394Details: [references/graphql-execution-and-schema-system-model.md](references/graphql-execution-and-schema-system-model.md)9596### Failure modes and mitigation (summary)9798N+1, null cascades, DoS-style queries, federation skew, and subscription overload patterns to detect before production pain.99100Details: [references/failure-modes-detection-mitigation.md](references/failure-modes-detection-mitigation.md)101102### Decision framework and trade-offs (summary)103104How to choose schema patterns, pagination models, query controls, and coexistence with REST or other backends.105106Details: [references/decision-framework-and-trade-offs.md](references/decision-framework-and-trade-offs.md)107108### Versions (summary)109110Version-sensitive server or spec notes that affect directives, transport, and execution controls.111112Details: [references/versions.md](references/versions.md)113114## Suggested response format1151161. **Context** — Server stack, monolith vs federation, client query style, and persistence/authZ boundaries.1172. **Execution model** — Explain the relevant schema, resolver, nullability, or query-cost behavior.1183. **Solution** — Minimum SDL/resolver/control change with rationale.1194. **Verification** — Query examples, performance checks, or authZ tests that prove the fix.1205. **Residual risks** — Remaining nullability, cost, federation, or client-migration caveats.121122## Resources in this skill123124| Topic | File |125|-------|------|126| GraphQL execution and schema system model | [references/graphql-execution-and-schema-system-model.md](references/graphql-execution-and-schema-system-model.md) |127| Failure modes and mitigation | [references/failure-modes-detection-mitigation.md](references/failure-modes-detection-mitigation.md) |128| Decision framework and trade-offs | [references/decision-framework-and-trade-offs.md](references/decision-framework-and-trade-offs.md) |129| Decision tree | [references/decision-tree.md](references/decision-tree.md) |130| Anti-patterns | [references/anti-patterns.md](references/anti-patterns.md) |131| Tips and tricks | [references/tips-and-tricks.md](references/tips-and-tricks.md) |132| Edge cases | [references/edge-cases.md](references/edge-cases.md) |133| Quality validation and guardrails | [references/quality-validation-and-guardrails.md](references/quality-validation-and-guardrails.md) |134| Integration map | [references/integration-map.md](references/integration-map.md) |135| Version notes | [references/versions.md](references/versions.md) |136137## Quick example138139**Input:** "This query is slow because each product resolves inventory separately."140- Inspect resolver fan-out and add batching at the field boundary before redesigning the schema.141- Keep the contract stable while fixing execution cost.142- **Verify:** The same query drops from N+1 database calls to a bounded batch pattern.143144**Input (tricky):** "A non-null field occasionally throws and breaks the whole query."145- Explain null propagation and decide whether the contract should stay non-null or the resolver must harden.146- Fix the smallest correct layer: resolver guarantees or schema nullability.147- **Verify:** Partial failures behave exactly as the intended contract specifies.148149**Input (cross-skill):** "We need field-level auth on tenant data backed by Postgres."150- Pair **`security-pro`** for threat framing and **`postgresql-pro`** for underlying policy/data guarantees.151- Ensure resolver logic and data-layer isolation tell the same truth.152- **Verify:** Unauthorized fields resolve safely and tenant data cannot be inferred through query shape.153154## Checklist before calling the skill done155156- [ ] Server stack, graph topology, and client query patterns confirmed first (Think Before Coding)157- [ ] Minimum schema/resolver/control change chosen; no unnecessary platform complexity added (Simplicity First)158- [ ] Only the affected field/type/resolver surface was changed (Surgical Changes)159- [ ] Success criteria and query/performance/authZ verification are explicit and validated (Goal-Driven Execution)160- [ ] Nullability and error behavior are intentional, not accidental161- [ ] N+1 or query-cost implications are considered where relevant162- [ ] Field-level authZ and data-layer guarantees stay aligned163- [ ] Residual federation or client-migration risks are documented164165---166> Source: [truongnat/skills](https://github.com/truongnat/skills) — distributed by [TomeVault](https://tomevault.io).167<!-- tomevault:4.0:skill_md:2026-06-15 -->