agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when designing or operating a GraphQL API. Covers schema design, resolver performance and DataLoader batching, query cost limiting, error handling, and federation.
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill graphql --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/graphqlContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when designing or operating a GraphQL API. Covers schema design, resolver performance and DataLoader batching, query cost limiting, error handling, and federation.
name: graphql description: Use when designing or operating a GraphQL API. Covers schema design, resolver performance and DataLoader batching, query cost limiting, error handling, and federation. metadata: category: backend version: 1.0.0 tags: [graphql, schema, dataloader, federation, performance]
Design a GraphQL schema that models the domain rather than the database, and operate it without letting a single query take down the service.
1. **Design for the client, not the tables** — The schema is a product surface. If it mirrors your database, you have built a slower REST API with worse caching. 2. **Get nullability right early** — A nullable field is a permanent client burden; a non-null field that later fails takes down the whole parent object. Non-null for genuine invariants only. 3. **Batch every relation** — Every resolver that fetches by id gets a DataLoader. Without one, `orders { customer { name } }` issues one query per order. 4. **Bound the cost** — Depth limit, complexity limit, and pagination caps. Then persisted queries for first-party clients. 5. **Model errors explicitly** — Expected failures (validation, not found) belong in the schema as union results; unexpected failures go to `errors`.
**DataLoader eliminating an N+1:**
// Without a loader: 1 query for orders, then N queries for customers.
const resolvers = {
Order: {
customer: (order, _args, ctx) => ctx.loaders.customer.load(order.customerId),
},
};
// The loader batches every customerId requested in the same tick into one query.
export function createLoaders(db: Db) {
return {
customer: new DataLoader<string, Customer>(async (ids) => {
const rows = await db.customers.findMany({ where: { id: { in: [...ids] } } });
const byId = new Map(rows.map((r) => [r.id, r]));
return ids.map((id) => byId.get(id) ?? new Error(`Customer ${id} not found`));
}),
};
}**Expected failures modeled in the schema:**
union CreateOrderResult = Order | ValidationFailed | InsufficientInventory
type Mutation {
createOrder(input: CreateOrderInput!): CreateOrderResult!
}The client must handle each outcome. Business failures no longer masquerade as transport errors.
A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Repo: nimadorostkar/Claude-Skills-collection
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory, structuring notes for retrieval, and…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should not be trusted to remember,…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling, versioning, testing, and…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive disclosure, and the difference between a…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base model, and measuring whether the…