From datocms
Query the DatoCMS Content Delivery API (CDA) — the read-only GraphQL API — using @datocms/cda-client. Use when users ask for GraphQL content reads: fetching posts/pages/projects, filtering by date/text/fields, sorting/order, pagination/load-more, text pattern matching via regex filters, localization and fallback locales, modular content fragments, Structured Text (DAST) with blocks/inline records, responsive images (srcset/blur-up/imgix), SEO metadata (_seoMetaTags, favicons, global SEO), video/Mux fields, draft or preview reads, environment-targeted reads, cache tags via rawExecuteQuery, and Content Link metadata for visual editing. Also use for CDA query type generation with gql.tada or GraphQL Code Generator.
How this skill is triggered — by the user, by Claude, or both
Slash command
/datocms:datocms-cdaThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Expert at querying DatoCMS CDA (read-only GraphQL) using `@datocms/cda-client`. Follow steps in order.
agents/openai.yamlreferences/client-and-config.mdreferences/draft-caching-environments.mdreferences/filtering.mdreferences/fragment-patterns.mdreferences/images-and-videos.mdreferences/localization.mdreferences/modular-content.mdreferences/pagination-and-ordering.mdreferences/querying-basics.mdreferences/seo-and-meta.mdreferences/structured-text.mdreferences/type-generation.mdExpert at querying DatoCMS CDA (read-only GraphQL) using @datocms/cda-client. Follow steps in order.
If context already established, skip broad detection. Re-inspect only when needed.
Examine project setup:
Read package.json for @datocms/cda-client. Not installed? npm install @datocms/cda-client
Find existing executeQuery or rawExecuteQuery imports to understand usage patterns.
Check .env, .env.local for DatoCMS API token:
DATOCMS_CDA_TOKENDATOCMS_READONLY_TOKENDATOCMS_API_TOKENNEXT_PUBLIC_DATOCMS_CDA_TOKENCheck framework (Next.js, Astro, Remix, Nuxt, SvelteKit) to determine server vs client queries. Don't expose tokens to browser unless using public read-only token.
Check type generation setup:
gql.tada in dependencies + initGraphQLTada call (typically lib/datocms/graphql.ts)@graphql-codegen/cli in devDependencies + graphql.config.tsCDA only needs read-only token. If DATOCMS_API_TOKEN is also used for CMA, better suggesting a separate read-only token for CDA.
Classify task:
| Category | Examples |
|---|---|
| Basic querying | Fetch by slug/ID, single-instance, list collections |
| Filtering | Field filters, AND/OR, meta filters, deep filtering |
| Pagination & ordering | Paginate, sort, tree/hierarchical |
| Localization | Localized fields, fallback, all-locale values |
| Modular content | Block fields with fragments, nested blocks |
| Structured text | DAST value/blocks/links, render |
| Images & media | Responsive images, imgix, placeholders, focal, video |
| SEO & meta | _seoMetaTags, favicons, globalSeo, OG tags |
| Draft/preview & caching | Draft mode, strict mode, cache tags, CDN, Content Link |
| Type generation | gql.tada, graphql-codegen, schema types, typed queries |
Clear request? Proceed directly.
Read relevant references from references/. Always load core client reference, then only relevant files.
Always load:
references/client-and-config.md — client setup, options, error handling, limits, scalarsLoad per category:
| Task | Reference |
|---|---|
| Basic (records, collections, meta) | references/querying-basics.md |
| Filtering (fields, AND/OR, deep, uploads) | references/filtering.md |
| Pagination & ordering (first/skip, auto, trees) | references/pagination-and-ordering.md |
| Localization | references/localization.md |
| Modular content (blocks, fragments) | references/modular-content.md |
| Structured text (DAST, render) | references/structured-text.md |
| Images & media (responsiveImage, video) | references/images-and-videos.md |
| SEO & meta | references/seo-and-meta.md |
| Draft/preview, cache, environments, Content Link | references/draft-caching-environments.md |
| Type generation (gql.tada, graphql-codegen, types) | references/type-generation.md |
| gql.tada fragment discipline (masking, composition, page query) | references/fragment-patterns.md |
Cross-cutting:
references/localization.mdreferences/modular-content.mdreferences/images-and-videos.mdreferences/pagination-and-ordering.mdreferences/pagination-and-ordering.md for complexity costsgql.tada project → references/fragment-patterns.mdexecuteQuery from @datocms/cda-client (or repo's existing wrapper around it)buildRequestHeaders() / buildRequestInit() for framework fetch integration, tagging, custom plumbingexecuteQueryWithAutoPagination to fetch 500+ recordsrawExecuteQuery only if response headers are needed (cache tags)TypedDocumentNode / gql.tada)$first: IntType, $id: ItemId)/* GraphQL */ (comment-tagged templates) for syntax highlightingconst query = /* GraphQL */ `query { ... }`
value, blocks, links, inlineBlocks) — omitting causes silent data lossApiError from @datocms/cda-client at appropriate boundariesautoRetry handles rate limitsas unknown as, no unnecessary asimport type { ... } for type-only importsBefore presenting final code:
ApiError caught at boundariesexecuteQueryWithAutoPaginationincludeDrafts intentional (not exposing unpublished in prod)excludeInvalid — recommend for stable schemas. Changing schema? use filter: { _isValid: { eq: true } } insteadas to silence errors@datocms/cda-client; keep generated GraphQL helpers if type-gen wiredfetch? use buildRequestHeaders() / buildRequestInit()graphql() function, check scalar mappingsreadFragment() at boundary, imports mirror spreads (see references/fragment-patterns.md)This skill covers reading via GraphQL CDA. Route to companion skill for:
| Condition | Route to |
|---|---|
| Mutating content, schema/uploads/webhooks, scripts (including REST queries) | datocms-cma |
| Draft mode endpoints, Web Previews, Content Link, subscriptions, cache tags | datocms-frontend-integrations |
| Building plugin | datocms-plugin |
npx claudepluginhub datocms/agent-skills --plugin datocmsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.