Composes, debugs, and optimizes Guillotine GraphQL queries for Enonic XP headless content delivery. Covers query construction, variable usage, filtering, aggregation, pagination, sorting, and TypeScript type generation from the auto-generated Guillotine schema. Use when writing or troubleshooting Guillotine queries, querying custom content types through GraphQL, or generating typed interfaces from Guillotine responses. Don't use for content type XML definitions, non-Enonic GraphQL APIs (Apollo, Hasura), server-side lib-content queries, or Guillotine deployment and CORS configuration.
80
100%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Step 1: Scan the workspace for existing Guillotine usage
node scripts/find-guillotine-targets.mjs . to inventory files containing Guillotine markers (query strings, library imports, endpoint references).guillotine, queryDsl, queryDslConnection, or /lib/guillotine in .ts, .js, .graphql, and .gql files.query(query: "...") string-based fields are found, the project uses the deprecated 5.x-style API; if queryDsl / queryDslConnection are found, the project uses 6.x+ DSL. Check for exports.extensions in guillotine/guillotine.js to detect Guillotine 7 Extensions API usage.Step 2: Load the Guillotine API reference
references/guillotine-reference.md before composing any query.references/compatibility.md when the workspace targets or migrates between Guillotine versions.Step 3: Determine the query shape
get(key).getChildren(key) or getChildrenConnection(key) for pagination.queryDsl(query) for a flat list or queryDslConnection(query) for pagination, aggregations, or highlighting.getType(name) or getTypes.queryDslConnection, getChildrenConnection) and guide the caller to pass after / first.queryDslConnection — these features are not available on queryDsl.Step 4: Construct the content type fragment
.) and colons (:) with underscores (_), and removing hyphens (-) while capitalizing the following letter. The first letter of each segment after a colon is capitalized. Example: com.enonic.app.myapp:BlogPost → com_enonic_app_myapp_BlogPost. For built-in types: portal:template-folder → portal_TemplateFolder.data field: ... on <GraphQLTypeName> { data { ... } }.processedHtml and optionally links, images, macros sub-fields. Use the processHtml input argument for absolute URLs, srcset widths (imageWidths), or responsive sizes (imageSizes).Step 5: Build query filters and sorting
QueryDSLInput must contain exactly one expression field.boolean with must, should, mustNot, and filter arrays.range expression with gt/gte/lt/lte and the correct DSLExpressionValueInput type (localDate, localDateTime, instant, long, double).SortDslInput with field and direction (ASC / DESC).references/examples.md when the query pattern matches a documented example.Step 6: Add aggregations and highlighting (if needed)
aggregations as an array of AggregationInput objects on queryDslConnection.name and exactly one aggregation type field (terms, dateRange, stats, etc.).highlight with a properties array specifying propertyName for each field to highlight.aggregationsAsJson and highlightAsJson on the connection result.Step 7: Generate TypeScript types (if requested)
assets/guillotine-query.template.ts as the starting template.__APP_KEY__, __CONTENT_TYPE__, __GRAPHQL_TYPE__, and __FIELDS__ placeholders with the actual content type values.Data interface matching the content type schema fields requested in the query.ContentConnection<T> generic with the specific content type.Step 8: Set site context (if applicable)
siteKey on the guillotine field or instruct the caller to set the X-Guillotine-SiteKey HTTP header.${site} placeholder in path arguments for site-relative queries._path(type: siteRelative) to return site-relative paths.Step 9: Validate the query
queryDsl / queryDslConnection are used instead of the deprecated query / queryConnection.QueryDSLInput objects contain exactly one expression field.DSLExpressionValueInput objects contain exactly one value type field.pageUrl / mediaUrl / imageUrl / attachmentUrl use Json type for params argument, not String.references/troubleshooting.md if the query returns unexpected nulls, empty results, or type errors.get returns null, verify the key is a valid content path or ID and that the correct branch (draft vs master) is targeted.queryDsl returns empty results, simplify to matchAll: {} to confirm data exists, then re-add filters one at a time.queryDslConnection, not queryDsl.query field is used, read references/compatibility.md to migrate to queryDsl with DSL syntax.scripts/find-guillotine-targets.mjs cannot run, scan the workspace manually for Guillotine markers and continue.029e044
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.