[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73CVQYRZ8103H1V2XB1CMKJ":3,"skill-same:01M73CVQYRZ8103H1V2XB1CMKJ":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":6,"updatedAt":44,"install":45,"resources":58},"01M73CVQYRZ8103H1V2XB1CMKJ","use-graphql-api",null,"Interact with GraphQL APIs from the command line — discover schemas via introspection, construct queries and mutations, execute them with gh api graphql or curl, parse responses with jq, and chain operations by piping IDs between calls. Use when automating GitHub Discussions, Issues, or Projects via GraphQL, integrating with any GraphQL endpoint from scripts, or building CLI workflows that need structured API data.","roohe\u002Fagentic-super-skills","roohe","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99054084?v=4","01M734WCDFP6RZVT5CNM00QR26","01M734WCE4BD0T4NZS5PCV9V5F",10,"MIT","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fuse-graphql-api\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: use-graphql-api\nlocale: caveman-lite\nsource_locale: en\nsource_commit: 82c77053\ntranslator: \"Julius Brussee homage — caveman\"\ntranslation_date: \"2026-05-03\"\ndescription: >\n  Interact with GraphQL APIs from the command line — discover schemas via\n  introspection, construct queries and mutations, execute them with gh api\n  graphql or curl, parse responses with jq, and chain operations by piping\n  IDs between calls. Use when automating GitHub Discussions, Issues, or\n  Projects via GraphQL, integrating with any GraphQL endpoint from scripts,\n  or building CLI workflows that need structured API data.\nlicense: MIT\nallowed-tools: Read Write Edit Bash Grep Glob WebFetch\nmetadata:\n  author: Philipp Thoss\n  version: \"1.0\"\n  domain: web-dev\n  complexity: intermediate\n  language: multi\n  tags: graphql, api, github, query, mutation, introspection\n---\n\n# Use GraphQL API\n\nDiscover, construct, execute, and chain GraphQL operations from the command line.\n\n## When to Use\n\n- Querying or mutating data via a GraphQL endpoint (GitHub, Hasura, Apollo, etc.)\n- Automating GitHub operations that require GraphQL (Discussions, Projects v2)\n- Building shell scripts that fetch structured data from GraphQL APIs\n- Chaining multiple GraphQL calls where output of one feeds into the next\n\n## Inputs\n\n- **Required**: GraphQL endpoint URL or service name (e.g., `github`)\n- **Required**: Operation intent (what data to read or write)\n- **Optional**: Authentication token or method (default: `gh` CLI auth for GitHub)\n- **Optional**: Output format preference (raw JSON, jq-filtered, variable assignment)\n\n## Procedure\n\n### Step 1. Discover the Schema\n\nDetermine available types, fields, queries, and mutations.\n\n**For GitHub:**\n\n```bash\n# List available query fields\ngh api graphql -f query='{ __schema { queryType { fields { name description } } } }' \\\n  | jq '.data.__schema.queryType.fields[] | {name, description}'\n\n# List available mutation fields\ngh api graphql -f query='{ __schema { mutationType { fields { name description } } } }' \\\n  | jq '.data.__schema.mutationType.fields[] | {name, description}'\n\n# Inspect a specific type\ngh api graphql -f query='{\n  __type(name: \"Repository\") {\n    fields { name type { name kind ofType { name } } }\n  }\n}' | jq '.data.__type.fields[] | {name, type: .type.name \u002F\u002F .type.ofType.name}'\n```\n\n**For generic endpoints:**\n\n```bash\n# Full introspection query via curl\ncurl -s -X POST https:\u002F\u002Fapi.example.com\u002Fgraphql \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -d '{\"query\":\"{ __schema { types { name kind fields { name } } } }\"}' \\\n  | jq '.data.__schema.types[] | select(.kind == \"OBJECT\") | {name, fields: [.fields[].name]}'\n```\n\n**Got:** JSON output listing available types, fields, or mutations. The schema response confirms the endpoint is reachable and the auth token is valid.\n\n**If fail:**\n- `401 Unauthorized` — verify the token; for GitHub, run `gh auth status`\n- `Cannot query field` — the endpoint may disable introspection; consult its documentation instead\n- Connection refused — verify the endpoint URL and network access\n\n### Step 2. Identify the Operation Type\n\nDetermine whether your task requires a query (read), mutation (write), or subscription (stream).\n\n| Intent | Operation | Example |\n|--------|-----------|---------|\n| Fetch data | `query` | Get repository details, list discussions |\n| Create\u002Fupdate\u002Fdelete | `mutation` | Create a discussion, add a comment |\n| Real-time updates | `subscription` | Watch for new issues (rare in CLI) |\n\nFor GitHub-specific operations, consult the [GitHub GraphQL API docs](https:\u002F\u002Fdocs.github.com\u002Fen\u002Fgraphql).\n\n```bash\n# Quick check: does the mutation exist?\ngh api graphql -f query='{ __schema { mutationType { fields { name } } } }' \\\n  | jq '.data.__schema.mutationType.fields[].name' | grep -i \"discussion\"\n```\n\n**Got:** Clear identification of whether a query or mutation is needed, plus the exact operation name (e.g., `createDiscussion`, `repository`).\n\n**If fail:**\n- Operation not found — search with broader terms or check the API version\n- Unclear whether query or mutation — if the action changes state, it is a mutation\n\n### Step 3. Construct the Operation\n\nBuild the GraphQL query or mutation with fields, arguments, and variables.\n\n**Query example — fetch a repository's discussion categories:**\n\n```bash\ngh api graphql -f query='\n  query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) {\n      discussionCategories(first: 10) {\n        nodes { id name }\n      }\n    }\n  }\n' -f owner=\"OWNER\" -f repo=\"REPO\" | jq '.data.repository.discussionCategories.nodes'\n```\n\n**Mutation example — create a GitHub Discussion:**\n\n```bash\ngh api graphql -f query='\n  mutation($repoId: ID!, $categoryId: ID!, $title: String!, $body: String!) {\n    createDiscussion(input: {\n      repositoryId: $repoId,\n      categoryId: $categoryId,\n      title: $title,\n      body: $body\n    }) {\n      discussion { url number }\n    }\n  }\n' -f repoId=\"$REPO_ID\" -f categoryId=\"$CAT_ID\" \\\n  -f title=\"My Discussion\" -f body=\"Discussion body here\"\n```\n\n**Key construction rules:**\n\n1. Always use variables (`$var: Type!`) instead of inline values for reusability\n2. Request only the fields you need to minimize response size\n3. Use `first: N` with `nodes` for paginated connections\n4. Add `id` to every object selection — you will need it for chaining\n\n**Got:** A syntactically valid GraphQL operation with appropriate variables, field selections, and pagination parameters.\n\n**If fail:**\n- Syntax errors — check bracket matching and trailing commas (GraphQL has no trailing commas)\n- Type mismatch — verify variable types against the schema (e.g., `ID!` vs `String!`)\n- Missing required fields — add required input fields per the schema\n\n### Step 4. Execute via CLI\n\nRun the operation and capture the response.\n\n**GitHub — using `gh api graphql`:**\n\n```bash\n# Simple query\ngh api graphql -f query='{ viewer { login } }'\n\n# With variables\ngh api graphql \\\n  -f query='query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) { id name }\n  }' \\\n  -f owner=\"octocat\" -f repo=\"Hello-World\"\n\n# With jq post-processing\nREPO_ID=$(gh api graphql \\\n  -f query='query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) { id }\n  }' \\\n  -f owner=\"OWNER\" -f repo=\"REPO\" \\\n  --jq '.data.repository.id')\n```\n\n**Generic endpoint — using curl:**\n\n```bash\ncurl -s -X POST \"$GRAPHQL_ENDPOINT\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -d \"$(jq -n \\\n    --arg query 'query { users { id name } }' \\\n    '{query: $query}'\n  )\"\n```\n\n**Got:** A JSON response with a `data` key containing the requested fields, or an `errors` array if the operation failed.\n\n**If fail:**\n- `errors` array in response — read the message; common causes are missing permissions, invalid IDs, or rate limits\n- Empty `data` — the query matched no records; verify input values\n- HTTP 403 — the token lacks the required scope; for GitHub, check `gh auth status` and add scopes with `gh auth refresh -s scope`\n\n### Step 5. Parse the Response\n\nExtract the data you need from the JSON response.\n\n```bash\n# Extract a single value\ngh api graphql -f query='{ viewer { login } }' --jq '.data.viewer.login'\n\n# Extract from a list\ngh api graphql -f query='\n  query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) {\n      issues(first: 5, states: OPEN) {\n        nodes { number title }\n      }\n    }\n  }\n' -f owner=\"OWNER\" -f repo=\"REPO\" \\\n  --jq '.data.repository.issues.nodes[] | \"\\(.number): \\(.title)\"'\n\n# Assign to a variable for later use\nCATEGORY_ID=$(gh api graphql -f query='\n  query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) {\n      discussionCategories(first: 20) {\n        nodes { id name }\n      }\n    }\n  }\n' -f owner=\"OWNER\" -f repo=\"REPO\" \\\n  --jq '.data.repository.discussionCategories.nodes[] | select(.name == \"Show and Tell\") | .id')\n```\n\n**Got:** Clean, extracted values ready for display or assignment to shell variables.\n\n**If fail:**\n- `jq` returns null — the field path is wrong; pipe raw JSON to `jq .` first to inspect structure\n- Multiple values when expecting one — add a `select()` filter or `| first`\n- Unicode issues — add `-r` to jq for raw string output\n\n### Step 6. Chain Operations\n\nUse output from one operation as input to the next.\n\n```bash\n# Step A: Get the repository ID\nREPO_ID=$(gh api graphql \\\n  -f query='query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) { id }\n  }' \\\n  -f owner=\"$OWNER\" -f repo=\"$REPO\" \\\n  --jq '.data.repository.id')\n\n# Step B: Get the discussion category ID\nCAT_ID=$(gh api graphql \\\n  -f query='query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) {\n      discussionCategories(first: 20) {\n        nodes { id name }\n      }\n    }\n  }' \\\n  -f owner=\"$OWNER\" -f repo=\"$REPO\" \\\n  --jq '.data.repository.discussionCategories.nodes[]\n    | select(.name == \"Show and Tell\") | .id')\n\n# Step C: Create the discussion using both IDs\nRESULT=$(gh api graphql \\\n  -f query='mutation($repoId: ID!, $catId: ID!, $title: String!, $body: String!) {\n    createDiscussion(input: {\n      repositoryId: $repoId,\n      categoryId: $catId,\n      title: $title,\n      body: $body\n    }) {\n      discussion { url number }\n    }\n  }' \\\n  -f repoId=\"$REPO_ID\" -f catId=\"$CAT_ID\" \\\n  -f title=\"$TITLE\" -f body=\"$BODY\" \\\n  --jq '.data.createDiscussion.discussion')\n\necho \"Created: $(echo \"$RESULT\" | jq -r '.url')\"\n```\n\n**Pattern:** Always extract `id` fields in earlier queries so they can be passed as `ID!` variables to subsequent mutations.\n\n**Got:** A multi-step workflow where each call succeeds and IDs flow correctly between operations.\n\n**If fail:**\n- Variable is empty — a previous step failed silently; add `set -e` and check each intermediate value\n- ID format wrong — GitHub node IDs are opaque strings (e.g., `R_kgDO...`); never construct them manually\n- Rate limited — add `sleep 1` between calls or batch queries using aliases\n\n## Validation\n\n1. Introspection query returns schema data (Step 1 succeeds)\n2. Constructed queries are syntactically valid (no GraphQL parser errors)\n3. Responses contain `data` keys without `errors`\n4. Extracted values match expected types (IDs are non-empty strings, counts are numbers)\n5. Chained operations complete end-to-end (mutation uses IDs from prior queries)\n\n## Pitfalls\n\n| Pitfall | Prevention |\n|---------|------------|\n| Forgetting `!` on required variable types | Always check schema for nullability; most input fields are non-null (`!`) |\n| Using REST IDs in GraphQL | GraphQL uses opaque node IDs; fetch them via GraphQL, not REST |\n| Not paginating large result sets | Use `first`\u002F`after` with `pageInfo { hasNextPage endCursor }` |\n| Hardcoding IDs instead of querying them | IDs differ between environments; always query dynamically |\n| Ignoring the `errors` array | Check for errors even when `data` is present — partial errors are possible |\n| Shell quoting issues with nested JSON | Use `--jq` flag with `gh` or pipe through `jq` separately |\n\n## Related Skills\n\n- [scaffold-nextjs-app](..\u002Fscaffold-nextjs-app\u002FSKILL.md) — scaffolding web apps that consume GraphQL APIs\n- [create-pull-request](..\u002Fcreate-pull-request\u002FSKILL.md) — GitHub workflow automation (REST-based counterpart)\n- [manage-git-branches](..\u002Fmanage-git-branches\u002FSKILL.md) — Git operations often paired with API automation\n- [serialize-data-formats](..\u002Fserialize-data-formats\u002FSKILL.md) — JSON parsing patterns used in response handling\n","# Use GraphQL API\n\nDiscover, construct, execute, and chain GraphQL operations from the command line.\n\n## When to Use\n\n- Querying or mutating data via a GraphQL endpoint (GitHub, Hasura, Apollo, etc.)\n- Automating GitHub operations that require GraphQL (Discussions, Projects v2)\n- Building shell scripts that fetch structured data from GraphQL APIs\n- Chaining multiple GraphQL calls where output of one feeds into the next\n\n## Inputs\n\n- **Required**: GraphQL endpoint URL or service name (e.g., `github`)\n- **Required**: Operation intent (what data to read or write)\n- **Optional**: Authentication token or method (default: `gh` CLI auth for GitHub)\n- **Optional**: Output format preference (raw JSON, jq-filtered, variable assignment)\n\n## Procedure\n\n### Step 1. Discover the Schema\n\nDetermine available types, fields, queries, and mutations.\n\n**For GitHub:**\n\n```bash\n# List available query fields\ngh api graphql -f query='{ __schema { queryType { fields { name description } } } }' \\\n  | jq '.data.__schema.queryType.fields[] | {name, description}'\n\n# List available mutation fields\ngh api graphql -f query='{ __schema { mutationType { fields { name description } } } }' \\\n  | jq '.data.__schema.mutationType.fields[] | {name, description}'\n\n# Inspect a specific type\ngh api graphql -f query='{\n  __type(name: \"Repository\") {\n    fields { name type { name kind ofType { name } } }\n  }\n}' | jq '.data.__type.fields[] | {name, type: .type.name \u002F\u002F .type.ofType.name}'\n```\n\n**For generic endpoints:**\n\n```bash\n# Full introspection query via curl\ncurl -s -X POST https:\u002F\u002Fapi.example.com\u002Fgraphql \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -d '{\"query\":\"{ __schema { types { name kind fields { name } } } }\"}' \\\n  | jq '.data.__schema.types[] | select(.kind == \"OBJECT\") | {name, fields: [.fields[].name]}'\n```\n\n**Got:** JSON output listing available types, fields, or mutations. The schema response confirms the endpoint is reachable and the auth token is valid.\n\n**If fail:**\n- `401 Unauthorized` — verify the token; for GitHub, run `gh auth status`\n- `Cannot query field` — the endpoint may disable introspection; consult its documentation instead\n- Connection refused — verify the endpoint URL and network access\n\n### Step 2. Identify the Operation Type\n\nDetermine whether your task requires a query (read), mutation (write), or subscription (stream).\n\n| Intent | Operation | Example |\n|--------|-----------|---------|\n| Fetch data | `query` | Get repository details, list discussions |\n| Create\u002Fupdate\u002Fdelete | `mutation` | Create a discussion, add a comment |\n| Real-time updates | `subscription` | Watch for new issues (rare in CLI) |\n\nFor GitHub-specific operations, consult the [GitHub GraphQL API docs](https:\u002F\u002Fdocs.github.com\u002Fen\u002Fgraphql).\n\n```bash\n# Quick check: does the mutation exist?\ngh api graphql -f query='{ __schema { mutationType { fields { name } } } }' \\\n  | jq '.data.__schema.mutationType.fields[].name' | grep -i \"discussion\"\n```\n\n**Got:** Clear identification of whether a query or mutation is needed, plus the exact operation name (e.g., `createDiscussion`, `repository`).\n\n**If fail:**\n- Operation not found — search with broader terms or check the API version\n- Unclear whether query or mutation — if the action changes state, it is a mutation\n\n### Step 3. Construct the Operation\n\nBuild the GraphQL query or mutation with fields, arguments, and variables.\n\n**Query example — fetch a repository's discussion categories:**\n\n```bash\ngh api graphql -f query='\n  query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) {\n      discussionCategories(first: 10) {\n        nodes { id name }\n      }\n    }\n  }\n' -f owner=\"OWNER\" -f repo=\"REPO\" | jq '.data.repository.discussionCategories.nodes'\n```\n\n**Mutation example — create a GitHub Discussion:**\n\n```bash\ngh api graphql -f query='\n  mutation($repoId: ID!, $categoryId: ID!, $title: String!, $body: String!) {\n    createDiscussion(input: {\n      repositoryId: $repoId,\n      categoryId: $categoryId,\n      title: $title,\n      body: $body\n    }) {\n      discussion { url number }\n    }\n  }\n' -f repoId=\"$REPO_ID\" -f categoryId=\"$CAT_ID\" \\\n  -f title=\"My Discussion\" -f body=\"Discussion body here\"\n```\n\n**Key construction rules:**\n\n1. Always use variables (`$var: Type!`) instead of inline values for reusability\n2. Request only the fields you need to minimize response size\n3. Use `first: N` with `nodes` for paginated connections\n4. Add `id` to every object selection — you will need it for chaining\n\n**Got:** A syntactically valid GraphQL operation with appropriate variables, field selections, and pagination parameters.\n\n**If fail:**\n- Syntax errors — check bracket matching and trailing commas (GraphQL has no trailing commas)\n- Type mismatch — verify variable types against the schema (e.g., `ID!` vs `String!`)\n- Missing required fields — add required input fields per the schema\n\n### Step 4. Execute via CLI\n\nRun the operation and capture the response.\n\n**GitHub — using `gh api graphql`:**\n\n```bash\n# Simple query\ngh api graphql -f query='{ viewer { login } }'\n\n# With variables\ngh api graphql \\\n  -f query='query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) { id name }\n  }' \\\n  -f owner=\"octocat\" -f repo=\"Hello-World\"\n\n# With jq post-processing\nREPO_ID=$(gh api graphql \\\n  -f query='query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) { id }\n  }' \\\n  -f owner=\"OWNER\" -f repo=\"REPO\" \\\n  --jq '.data.repository.id')\n```\n\n**Generic endpoint — using curl:**\n\n```bash\ncurl -s -X POST \"$GRAPHQL_ENDPOINT\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -d \"$(jq -n \\\n    --arg query 'query { users { id name } }' \\\n    '{query: $query}'\n  )\"\n```\n\n**Got:** A JSON response with a `data` key containing the requested fields, or an `errors` array if the operation failed.\n\n**If fail:**\n- `errors` array in response — read the message; common causes are missing permissions, invalid IDs, or rate limits\n- Empty `data` — the query matched no records; verify input values\n- HTTP 403 — the token lacks the required scope; for GitHub, check `gh auth status` and add scopes with `gh auth refresh -s scope`\n\n### Step 5. Parse the Response\n\nExtract the data you need from the JSON response.\n\n```bash\n# Extract a single value\ngh api graphql -f query='{ viewer { login } }' --jq '.data.viewer.login'\n\n# Extract from a list\ngh api graphql -f query='\n  query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) {\n      issues(first: 5, states: OPEN) {\n        nodes { number title }\n      }\n    }\n  }\n' -f owner=\"OWNER\" -f repo=\"REPO\" \\\n  --jq '.data.repository.issues.nodes[] | \"\\(.number): \\(.title)\"'\n\n# Assign to a variable for later use\nCATEGORY_ID=$(gh api graphql -f query='\n  query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) {\n      discussionCategories(first: 20) {\n        nodes { id name }\n      }\n    }\n  }\n' -f owner=\"OWNER\" -f repo=\"REPO\" \\\n  --jq '.data.repository.discussionCategories.nodes[] | select(.name == \"Show and Tell\") | .id')\n```\n\n**Got:** Clean, extracted values ready for display or assignment to shell variables.\n\n**If fail:**\n- `jq` returns null — the field path is wrong; pipe raw JSON to `jq .` first to inspect structure\n- Multiple values when expecting one — add a `select()` filter or `| first`\n- Unicode issues — add `-r` to jq for raw string output\n\n### Step 6. Chain Operations\n\nUse output from one operation as input to the next.\n\n```bash\n# Step A: Get the repository ID\nREPO_ID=$(gh api graphql \\\n  -f query='query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) { id }\n  }' \\\n  -f owner=\"$OWNER\" -f repo=\"$REPO\" \\\n  --jq '.data.repository.id')\n\n# Step B: Get the discussion category ID\nCAT_ID=$(gh api graphql \\\n  -f query='query($owner: String!, $repo: String!) {\n    repository(owner: $owner, name: $repo) {\n      discussionCategories(first: 20) {\n        nodes { id name }\n      }\n    }\n  }' \\\n  -f owner=\"$OWNER\" -f repo=\"$REPO\" \\\n  --jq '.data.repository.discussionCategories.nodes[]\n    | select(.name == \"Show and Tell\") | .id')\n\n# Step C: Create the discussion using both IDs\nRESULT=$(gh api graphql \\\n  -f query='mutation($repoId: ID!, $catId: ID!, $title: String!, $body: String!) {\n    createDiscussion(input: {\n      repositoryId: $repoId,\n      categoryId: $catId,\n      title: $title,\n      body: $body\n    }) {\n      discussion { url number }\n    }\n  }' \\\n  -f repoId=\"$REPO_ID\" -f catId=\"$CAT_ID\" \\\n  -f title=\"$TITLE\" -f body=\"$BODY\" \\\n  --jq '.data.createDiscussion.discussion')\n\necho \"Created: $(echo \"$RESULT\" | jq -r '.url')\"\n```\n\n**Pattern:** Always extract `id` fields in earlier queries so they can be passed as `ID!` variables to subsequent mutations.\n\n**Got:** A multi-step workflow where each call succeeds and IDs flow correctly between operations.\n\n**If fail:**\n- Variable is empty — a previous step failed silently; add `set -e` and check each intermediate value\n- ID format wrong — GitHub node IDs are opaque strings (e.g., `R_kgDO...`); never construct them manually\n- Rate limited — add `sleep 1` between calls or batch queries using aliases\n\n## Validation\n\n1. Introspection query returns schema data (Step 1 succeeds)\n2. Constructed queries are syntactically valid (no GraphQL parser errors)\n3. Responses contain `data` keys without `errors`\n4. Extracted values match expected types (IDs are non-empty strings, counts are numbers)\n5. Chained operations complete end-to-end (mutation uses IDs from prior queries)\n\n## Pitfalls\n\n| Pitfall | Prevention |\n|---------|------------|\n| Forgetting `!` on required variable types | Always check schema for nullability; most input fields are non-null (`!`) |\n| Using REST IDs in GraphQL | GraphQL uses opaque node IDs; fetch them via GraphQL, not REST |\n| Not paginating large result sets | Use `first`\u002F`after` with `pageInfo { hasNextPage endCursor }` |\n| Hardcoding IDs instead of querying them | IDs differ between environments; always query dynamically |\n| Ignoring the `errors` array | Check for errors even when `data` is present — partial errors are possible |\n| Shell quoting issues with nested JSON | Use `--jq` flag with `gh` or pipe through `jq` separately |\n\n## Related Skills\n\n- [scaffold-nextjs-app](..\u002Fscaffold-nextjs-app\u002FSKILL.md) — scaffolding web apps that consume GraphQL APIs\n- [create-pull-request](..\u002Fcreate-pull-request\u002FSKILL.md) — GitHub workflow automation (REST-based counterpart)\n- [manage-git-branches](..\u002Fmanage-git-branches\u002FSKILL.md) — Git operations often paired with API automation\n- [serialize-data-formats](..\u002Fserialize-data-formats\u002FSKILL.md) — JSON parsing patterns used in response handling\n",{"name":5,"locale":23,"license":14,"metadata":24,"translator":31,"description":32,"allowed-tools":33,"source_commit":34,"source_locale":35,"translation_date":36},"caveman-lite",{"tags":25,"author":26,"domain":27,"version":28,"language":29,"complexity":30},"graphql, api, github, query, mutation, introspection","Philipp Thoss","web-dev","1.0","multi","intermediate","Julius Brussee homage — caveman","Interact with GraphQL APIs from the command line — discover schemas via introspection, construct queries and mutations, execute them with gh api graphql or curl, parse responses with jq, and chain operations by piping IDs between calls. Use when automating GitHub Discussions, Issues, or Projects via GraphQL, integrating with any GraphQL endpoint from scripts, or building CLI workflows that need structured API data.\n","Read Write Edit Bash Grep Glob WebFetch","82c77053","en","2026-05-03","master","f483e54f3ad5f202a77d45f2e57f8d970b71195f","skills_library\u002Fuse-graphql-api",2,"https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills","https:\u002F\u002Fgithub.com\u002Froohe","yoou.link","2026-05-19 15:56:07",{"source":8,"skillName":5,"commands":46,"prompt":56,"zipAvailable":57},[47,50,53],{"tool":48,"command":49},"npx","npx skills add roohe\u002Fagentic-super-skills --skill use-graphql-api",{"tool":51,"command":52},"bunx","bunx skills add roohe\u002Fagentic-super-skills --skill use-graphql-api",{"tool":54,"command":55},"pnpm","pnpm dlx skills add roohe\u002Fagentic-super-skills --skill use-graphql-api","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fuse-graphql-api\u002FSKILL.md",true,[],[60,67,74,81,88,95],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":18},"01M73D865CZME2FCMKA4PQM348","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M73D7Z64J4ABWZJD7P44XBBF","youtube-downloader","Download and process YouTube content for research. Use when: downloading competitor videos for analysis; extracting audio for podcasts; getting transcripts for content repurposing; archiving webinars; research content curation","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fyoutube-downloader\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M73D7K8778TGZV3GJFR3703D","yc-pitch-deck","Create a compelling startup pitch deck that follows the structure proven to raise billions from top investors. Master the YC and Sequoia formats that get founders funded. Use when: **Fundraising** to create investor pitch decks; **YC application** to structure your narrative; **Demo Day prep** to craft your 2-minute pitch; **Angel investors** to communicate your opportunity; **Partnership pitches** to structure compelling asks","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fyc-pitch-deck\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M73D70KJSE0E8Z28YMNNRT04","x-twitter-scraper","Use when the user needs X (Twitter) data or confirmation-gated X actions through Xquik: tweet search, user lookup, follower extraction, media download, monitoring, webhooks, MCP, SDKs, posting, likes, DMs, and profile updates. Requires a Xquik API key. Never ask for X login material.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fx-twitter-scraper\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M73D6ED01GV077R7K4NZNFZJ","write-vignette","Create R package vignettes using R Markdown or Quarto. Covers vignette setup, YAML configuration, code chunk options, building and testing, and CRAN requirements for vignettes. Use when adding a Getting Started tutorial, documenting complex workflows spanning multiple functions, creating domain-specific guides, or when CRAN submission requires user-facing documentation beyond function help pages.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fwrite-vignette\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":18},"01M73D69YJR0BK3NFHE0CYG3EF","write-validation-documentation","Write IQ\u002FOQ\u002FPQ validation documentation for computerized systems in regulated environments. Covers protocols, reports, test scripts, deviation handling, and approval workflows. Use when validating R or other software for regulated use, preparing for a regulatory audit, documenting qualification of computing environments, or creating and updating validation protocols and reports for new or re-qualified systems.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fwrite-validation-documentation\u002FSKILL.md",[],[]]