npx skills add ...
npx skills add forcedotcom/sf-skills --skill experience-lds-graphql-generate
Use ALWAYS when a prompt mentions GraphQL, lightning/uiGraphQLApi, @wire(graphql, ...), or gql template tags in an LWC context — even if the surface ask is \"build an LWC\". Owns the ENTIRE flow: introspect the org's LDS GraphQL schema, identify entities/fields, construct the schema-validated gql query or mutation, wire it into the LWC via lightning/uiGraphQLApi, verify against a connected org. REQUIRED whenever a prompt asks to render, list, or edit Salesforce records (Account, Contact, Case, custom objects) via GraphQL — the .html and .js scaffolding IS in scope. DO NOT delegate to experience-lwc-generate: that skill has NO GraphQL schema introspection, NO create_lds_graphql_read_query binding, and defaults to getRecord/getRelatedListRecords wire adapters which will not satisfy a GraphQL prompt. DO NOT TRIGGER only if the prompt forbids GraphQL, chooses UIAPI/Apex (use experience-lds-best-practices-apply), or asks for data requirements (use experience-lds-data-requirements-generate).
npx skills add forcedotcom/sf-skills --skill experience-lds-graphql-generate
Generate schema-validated Salesforce LDS GraphQL queries (read or mutation), either as standalone queries or wired into a Lightning Web Component via the lightning/graphql adapters. The skill encodes the schema-as-source-of-truth workflow end-to-end. Two bundled bash scripts handle the org-aware steps — scripts/fetch-lds-graphql-schema.sh for schema introspection and scripts/test-lds-graphql-query.sh for live-org validation.
Do NOT use this skill for:
experience-lds-best-practices-apply).experience-lds-data-requirements-generate.sf available in the shell for the schema fetch.uiapi (default: standard + custom objects) or setup (setup objects like permission sets, profiles).read (default) or mutation.standalone (raw GraphQL + variables) or LWC integration (full component wiring).These apply to every step — they are the rules this skill enforces:
schema.graphql introspection. Never use common Salesforce knowledge (e.g., do not assume Owner is a User — it may be polymorphic).The full normative workflow lives in references/generation-guide.md. Read it before starting. Read-query specifics are in references/generation-query.md; mutation specifics are in references/generation-mutation.md.
Collect and echo back:
If any is unclear, ask once and wait.
usernameOrAlias. If a default is inferred from context, present it and wait for explicit confirmation.scripts/fetch-lds-graphql-schema.sh USERNAME_OR_ALIAS [OUTPUT_PATH] [API_VERSION] with the confirmed alias. The script writes the SDL to schema.graphql (or the path you pass) so the schema never enters the chat context. If a non-empty schema.graphql already exists at OUTPUT_PATH, the script exits early (set LDS_FETCH_FORCE=1 to re-fetch).The schema is 265,000+ lines. NEVER read the whole file — use targeted grep calls only.
^type <ObjectName> implements Record with -A 100.^input <ObjectName>_Filter with -A 50.^input <ObjectName>_OrderBy with -A 30.^input <ObjectName>(Create|Update)Input with -A 50.Search budget: max 4–5 grep calls per entity. Plan before executing.
^type <Name> implements Record matches.Unknown entities is non-empty → status FAILED → ask for clarification → restart Step 3.Iteration limit: 3 cycles (primary entity → references → child relationships). Hard-stop after 3.
Per cycle:
Owner: User). Fields with the same name on different entities may have different types — check each entity independently. If a field resolves to multiple entity types, mark it polymorphic and plan to use inline fragments (... on TypeA, ... on TypeB).Contacts: ContactConnection). Add new entities to the unknown list.[FAIL] → global FAILED → remediation → resume from cycle start.read)Author the read query per references/generation-query.md, feeding in the introspection data, entity list, field types, output format, and usernameOrAlias.
Apply the rules in references/generation-query.md — covers:
uiapi.query vs setup.query).eq, ne, in, nin, gt, gte, lt, lte, like, contains).first, after, last, before; edges.node, pageInfo).lightning/graphql, gql tagged template, refreshGraphQL for imperative refresh).If the tool returns an error, categorize it and ask the user how to proceed.
mutation)Author the mutation per references/generation-mutation.md — covers:
create, update, delete operation shape.<Entity>CreateInput, <Entity>UpdateInput) discovered via the input grep pattern.! annotation).Id only.record.errors[]).graphqlMutate from lightning/graphql.Run scripts/test-lds-graphql-query.sh USERNAME_OR_ALIAS 'QUERY' '<VARIABLES_JSON>' against the confirmed usernameOrAlias and present the response shape/sample to the user. Errors are categorized, not echoed verbatim.
scripts/fetch-lds-graphql-schema.sh — schema acquisition via a GraphQL introspection query against the org's /services/data/vX/graphql endpoint (LDS exposes no /graphql/sdl route); call once per org/session before query authoring.scripts/test-lds-graphql-query.sh — org-backed validation of the generated query against /services/data/vX/graphql.experience-lds-best-practices-apply — general LDS principles, cache semantics, and wire-vs-imperative choice.experience-lds-data-requirements-generate — pre-work that decides what to query before this skill decides how.experience-lwc-generate — host the generated wire adapter cleanly.Standalone read — minimal
LWC integration — read with wire
Step 3 status: SUCCESS before Step 4; Step 4 status: SUCCESS before Steps 5/6.! in schema) is present.scripts/test-lds-graphql-query.sh returns without errors; or, on error, a categorized remediation is presented.LWC integration, the component imports from lightning/graphql, uses gql tagged template, and exposes data via a getter (not directly in HTML).