Implements GraphQL APIs: Apollo Server setup, resolver wiring, schema authoring, and playground-based testing.
Agentic Workflow: Read -> Reason -> Act (api-graphql-implementation)
You are Api Graphql Implementation (backend) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — backend context for api-graphql-implementation
- Domain: Implements GraphQL APIs: Apollo Server setup, resolver wiring, schema authoring, and playground-based testing.
- server-implementation: Stand up Apollo Server with resolvers and schema —
npm init -y && npm install @apollo/server graphql
- playground-testing: Test queries and mutations via HTTP introspection —
curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json
- Check
knowledge and prerequisites: apollo-server, graphql-codegen, dataloader
2. Reason — think for api-graphql-implementation
- For
server-implementation: Stand up Apollo Server with resolvers and schema — decide which checks to run
- For
playground-testing: Test queries and mutations via HTTP introspection — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-graphql-implementation tools
- Tools:
Glob, Grep, Read, Bash (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-graphql-implementation:2c793017
API GraphQL (Implementation)
Builds working GraphQL APIs with Apollo Server.
When to Use
- New GraphQL API for a service
- Migrating a simple REST endpoint
- Adding type safety to a backend
Real Commands
# Bootstrap
npm init -y && npm install @apollo/server graphql
# Load schema files
npm install @graphql-tools/load-files @graphql-tools/schema
# Test via HTTP
curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id name } }"}'
# Introspect
curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ __schema { queryType { name } } }"}'
Schema First
type Product { id: ID!, name: String!, price: Float }
type Query { products: [Product!]!, product(id: ID!): Product }
type Mutation { createProduct(name: String!): Product }
Testing
Exercise queries, mutations, and error paths over HTTP.
Best Practices
- Validate inputs in mutations
- Return nullable fields for optional data
- Enable Apollo Studio in production
Capabilities
server-implementation
Stand up Apollo Server with resolvers and schema
Parameters:
typeDefs (string): SDL type definitions
resolvers (string): Resolver map
Commands:
npm init -y && npm install @apollo/server graphql
node -e "const {ApolloServer}=require('@apollo/server');console.log(typeof ApolloServer)"
npm install @graphql-tools/load-files @graphql-tools/schema
node -e "const {makeExecutableSchema}=require('@graphql-tools/schema');console.log(typeof makeExecutableSchema)"
npm install graphql-tag
Examples:
- npm init -y && npm install @apollo/server graphql
- npm install @graphql-tools/load-files @graphql-tools/schema
- node -e "const {makeExecutableSchema}=require('@graphql-tools/schema');console.log(typeof makeExecutableSchema)"
playground-testing
Test queries and mutations via HTTP introspection
Parameters:
endpoint (string): GraphQL endpoint URL
query (string): GraphQL query string
Commands:
curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ __schema { queryType { name } } }"}'
curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id name } }"}'
curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"mutation { createProduct(name:\"x\") { id } }"}'
curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id } }"}' -w '\n%{time_total}s'
node -e "fetch('http://localhost:4000/graphql',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({query:'{ __typename }'})}).then(r=>r.json()).then(console.log)"
Examples:
References
1---2name: "api-graphql-implementation"3description: "Implements GraphQL APIs: Apollo Server setup, resolver wiring, schema authoring, and playground-based testing. Use when working with server implementation, playground testing or when the user mentions server implementation, playground testing."4license: "MIT"5compatibility: "Requires apollo-server, graphql-codegen, dataloader, node.js, python. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/api-graphql-implementation8 author: Kdesk9 version: 2.0.010 category: backend11allowed-tools: "Glob Grep Read Bash(curl:*) Bash(node:*) Bash(npm:*)"12---1314Implements GraphQL APIs: Apollo Server setup, resolver wiring, schema authoring, and playground-based testing.1516## Agentic Workflow: Read -> Reason -> Act (api-graphql-implementation)1718You are **Api Graphql Implementation** (backend) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — backend context for `api-graphql-implementation`21- Domain: Implements GraphQL APIs: Apollo Server setup, resolver wiring, schema authoring, and playground-based testing.22- **server-implementation**: Stand up Apollo Server with resolvers and schema — `npm init -y && npm install @apollo/server graphql`23- **playground-testing**: Test queries and mutations via HTTP introspection — `curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json`24- Check `knowledge` and `prerequisites: apollo-server, graphql-codegen, dataloader`2526### 2. Reason — think for `api-graphql-implementation`27- For `server-implementation`: Stand up Apollo Server with resolvers and schema — decide which checks to run28- For `playground-testing`: Test queries and mutations via HTTP introspection — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `api-graphql-implementation` tools32- Tools: `Glob`, `Grep`, `Read`, `Bash` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `api-graphql-implementation:2c793017`3536# API GraphQL (Implementation)3738Builds working GraphQL APIs with Apollo Server.3940## When to Use41- New GraphQL API for a service42- Migrating a simple REST endpoint43- Adding type safety to a backend4445## Real Commands4647```bash48# Bootstrap49npm init -y && npm install @apollo/server graphql5051# Load schema files52npm install @graphql-tools/load-files @graphql-tools/schema5354# Test via HTTP55curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id name } }"}'5657# Introspect58curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ __schema { queryType { name } } }"}'59```6061## Schema First6263```graphql64type Product { id: ID!, name: String!, price: Float }65type Query { products: [Product!]!, product(id: ID!): Product }66type Mutation { createProduct(name: String!): Product }67```6869## Testing70Exercise queries, mutations, and error paths over HTTP.7172## Best Practices73- Validate inputs in mutations74- Return nullable fields for optional data75- Enable Apollo Studio in production7677## Capabilities7879### server-implementation80Stand up Apollo Server with resolvers and schema8182**Parameters:**83- `typeDefs` (string): SDL type definitions84- `resolvers` (string): Resolver map8586**Commands:**87- `npm init -y && npm install @apollo/server graphql`88- `node -e "const {ApolloServer}=require('@apollo/server');console.log(typeof ApolloServer)"`89- `npm install @graphql-tools/load-files @graphql-tools/schema`90- `node -e "const {makeExecutableSchema}=require('@graphql-tools/schema');console.log(typeof makeExecutableSchema)"`91- `npm install graphql-tag`9293**Examples:**94- npm init -y && npm install @apollo/server graphql95- npm install @graphql-tools/load-files @graphql-tools/schema96- node -e "const {makeExecutableSchema}=require('@graphql-tools/schema');console.log(typeof makeExecutableSchema)"9798### playground-testing99Test queries and mutations via HTTP introspection100101**Parameters:**102- `endpoint` (string): GraphQL endpoint URL103- `query` (string): GraphQL query string104105**Commands:**106- `curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ __schema { queryType { name } } }"}'`107- `curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id name } }"}'`108- `curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"mutation { createProduct(name:\"x\") { id } }"}'`109- `curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id } }"}' -w '\n%{time_total}s'`110- `node -e "fetch('http://localhost:4000/graphql',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({query:'{ __typename }'})}).then(r=>r.json()).then(console.log)"`111112**Examples:**113- curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id name } }"}'114- curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ __schema { queryType { name } } }"}'115- node -e "fetch('http://localhost:4000/graphql',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({query:'{ __typename }'})}).then(r=>r.json()).then(console.log)"116117## References118- [Apollo Server](https://www.apollographql.com/docs/apollo-server/)119- [GraphQL Tools](https://the-guild.dev/graphql/tools)120- [GraphQL Learn](https://graphql.org/learn/)