MCPInstall

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 createldsgraphqlreadquery 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).

Installs
1.9K
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/forcedotcom/sf-skills --skill experience-lds-graphql-generate
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads experience-lds-graphql-generate automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

<!-- adk-managed-skill -->

Building LDS GraphQL

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.

When to Use

  • User wants to create, modify, or integrate a Salesforce GraphQL query (standard objects, custom objects, or setup objects).
  • Building or updating an LWC that consumes/mutates LDS data through GraphQL.
  • Introspecting an org's schema before writing a query.
  • Validating a generated query end-to-end against a connected org.

Do NOT use this skill for:

  • REST-based UI API (use LDS wire adapters; see experience-lds-best-practices-apply).
  • Apex callouts or custom GraphQL endpoints — this skill is LDS-scoped.
  • Data-requirements discovery — that's experience-lds-data-requirements-generate.

Prerequisites

  • A connected Salesforce org (username or alias). User must confirm it before schema fetch — never assume.
  • Salesforce CLI / sf available in the shell for the schema fetch.
  • Decision on:
    • Namespace — uiapi (default: standard + custom objects) or setup (setup objects like permission sets, profiles).
    • Query type — read (default) or mutation.
    • Output format — standalone (raw GraphQL + variables) or LWC integration (full component wiring).

Core Rules

These apply to every step — they are the rules this skill enforces:

  1. Sequential execution — Steps 1→6 run in order. Every step is mandatory unless its triggering conditions are not met.
  2. Hard stop on failure — A failed step blocks subsequent steps until remediation is complete.
  3. Schema is the single source of truth — Every entity name, field name, field type, and relationship must come from schema.graphql introspection. Never use common Salesforce knowledge (e.g., do not assume Owner is a User — it may be polymorphic).
  4. Report each step — Use the provided templates before advancing.
  5. Error reporting — Categorize errors; never echo raw tool output into the chat.

Workflow

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.

Step 1 — General query information

Collect and echo back:

Query type:       [read | mutation]
Namespace:        [uiapi | setup]
Output format:    [standalone | LWC integration]

If any is unclear, ask once and wait.

Step 2 — Acquire the schema

  1. Ask for the usernameOrAlias. If a default is inferred from context, present it and wait for explicit confirmation.
  2. Run 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).
  3. On failure: hard stop, report category, ask user to resolve org access, then retry.

Using the schema file

The schema is 265,000+ lines. NEVER read the whole file — use targeted grep calls only.

  • Object type: ^type <ObjectName> implements Record with -A 100.
  • Filter: ^input <ObjectName>_Filter with -A 50.
  • OrderBy: ^input <ObjectName>_OrderBy with -A 30.
  • Mutation input: ^input <ObjectName>(Create|Update)Input with -A 50.

Search budget: max 4–5 grep calls per entity. Plan before executing.

Step 3 — Entity identification

  1. Entity names are PascalCase.
  2. If names aren't given, extract candidates from ^type <Name> implements Record matches.
  3. If any entity is still unresolved, ask the user and wait.
  4. Report:
    Identified entities:
    - EntityName (Field1, Field2, ...)
    Unknown entities:
    - <textual name>
    Step 3 status: SUCCESS | FAILED
    
  5. If Unknown entities is non-empty → status FAILED → ask for clarification → restart Step 3.

Step 4 — Iterative entity introspection

Iteration limit: 3 cycles (primary entity → references → child relationships). Hard-stop after 3.

Per cycle:

  1. Remove already-introspected entities from the list.
  2. Grep for the remaining entities' fields using the schema patterns above.
  3. Extract standard field types.
  4. Identify reference fields (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).
  5. Identify child relationships (Connection types, e.g., Contacts: ContactConnection). Add new entities to the unknown list.
  6. If unknown list not empty and iterations < 3, loop.
  7. Report:
    [PASS|FAIL] EntityName
      - Standard fields: FieldName (type), ...
      - Reference fields: FieldName → TargetType, ...
      - Polymorphic fields: FieldName → [TypeA, TypeB], ...
      - Child relationships: RelationshipName → ChildType, ...
      - Unknown fields: FieldName, ...
    Introspection cycles used: N/3
    Step 4 status: SUCCESS | FAILED
    
  8. If any entity is [FAIL] → global FAILED → remediation → resume from cycle start.

Step 5 — Read query generation (only if query type is 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:

  • Query root / namespace selection (uiapi.query vs setup.query).
  • Field selection discipline (ask only for fields actually needed — every field is a billable scan).
  • Filter operators (eq, ne, in, nin, gt, gte, lt, lte, like, contains).
  • OrderBy (per-field direction).
  • Pagination (first, after, last, before; edges.node, pageInfo).
  • Polymorphic inline fragments.
  • Aliasing and variable placeholders.
  • Standalone vs LWC output (wire adapter from lightning/graphql, gql tagged template, refreshGraphQL for imperative refresh).

If the tool returns an error, categorize it and ask the user how to proceed.

Step 6 — Mutation query generation (only if query type is mutation)

Author the mutation per references/generation-mutation.md — covers:

  • create, update, delete operation shape.
  • Input types (<Entity>CreateInput, <Entity>UpdateInput) discovered via the input grep pattern.
  • Required vs optional fields (from schema's ! annotation).
  • Reference-field updates using Id only.
  • Return selection — what to read back after the mutation to drive cache consistency.
  • Error handling (record.errors[]).
  • LWC integration: imperative mutation via graphqlMutate from lightning/graphql.

Step 7 — Test the query

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.

Cross-References

  • Bundled scripts:
    • 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.
  • Related skills:
    • 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.

Examples

Standalone read — minimal

query Accounts($limit: Int = 10) {
  uiapi {
    query {
      Account(first: $limit) {
        edges {
          node {
            Id
            Name { value }
          }
        }
      }
    }
  }
}

LWC integration — read with wire

import { LightningElement, wire } from 'lwc';
import { gql, graphql } from 'lightning/graphql';

export default class AccountList extends LightningElement {
    @wire(graphql, {
        query: gql`
            query Accounts($limit: Int = 10) {
                uiapi {
                    query {
                        Account(first: $limit) {
                            edges { node { Id Name { value } } }
                        }
                    }
                }
            }
        `,
        variables: '$variables'
    })
    accounts;

    variables = { limit: 10 };

    get records() {
        return this.accounts?.data?.uiapi?.query?.Account?.edges ?? [];
    }
}

Verification

  • Step 3 status: SUCCESS before Step 4; Step 4 status: SUCCESS before Steps 5/6.
  • Every field in the generated query appears in the introspection report (no hallucinated fields).
  • Polymorphic fields use inline fragments; non-polymorphic fields do not.
  • For mutations, every required input field (! in schema) is present.
  • scripts/test-lds-graphql-query.sh returns without errors; or, on error, a categorized remediation is presented.
  • If output format is LWC integration, the component imports from lightning/graphql, uses gql tagged template, and exposes data via a getter (not directly in HTML).

FAQ

What does the experience-lds-graphql-generate skill do?

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 createldsgraphqlreadquery 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).

How do I install experience-lds-graphql-generate?

Run npx skills add https://github.com/forcedotcom/sf-skills --skill experience-lds-graphql-generate in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/experience-lds-graphql-generate/ (personal) or .claude/skills/experience-lds-graphql-generate/ (project).

Which AI agents can use experience-lds-graphql-generate?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is experience-lds-graphql-generate safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains experience-lds-graphql-generate?

It is published by forcedotcom in forcedotcom/sf-skills. It has 1,890 recorded installs.

More from forcedotcom/sf-skills

View all →

platform-apex-generate

forcedotcom/sf-skills

Primary Apex authoring skill for class generation, refactoring, and review. ALWAYS ACTIVATE when the user mentions Apex, .cls, triggers, or asks to create/refactor a class (service, selector, domain, batch, queueable, schedulable, invocable, DTO, utility, interface, abstract, exception, REST resource). Use this skill for requests involving SObject CRUD, mapping collections, fetching related records, scheduled jobs, batch jobs, trigger design, @AuraEnabled controllers, @RestResource endpoints, custom REST APIs, or code review of existing Apex.

platform-apex-test-generate

forcedotcom/sf-skills

Use to generate and validate Apex test classes with TestDataFactory patterns, bulk testing (251+ records), mocking, assertions, and disciplined test-fix loops. Use when creating Apex test classes (for triggers, services, controllers, batch jobs, queueables, and callouts), improving coverage, debugging or fixing failing Apex tests, or running test/coverage analysis. Triggers on Test.cls files, sf apex run test, coverage reports. Do NOT trigger for production Apex (use platform-apex-generate) or Jest/LWC tests.

Testing & QA7.1K installs

platform-apex-test-run

forcedotcom/sf-skills

Apex test execution, coverage analysis, and test-fix loops with 120-point scoring. Use when the user runs Apex tests, checks code coverage, fixes failing tests, or touches Test.cls / Test.cls files. DO NOT TRIGGER when writing Apex production code (use platform-apex-generate), Agentforce agent testing (use agentforce-test), or Jest/LWC tests (use experience-lwc-generate).

Testing & QA7K installs

platform-apex-logs-debug

forcedotcom/sf-skills

Salesforce debug log analysis and troubleshooting with 100-point scoring. TRIGGER when: user analyzes debug logs, hits governor limits, reads stack traces, or touches .log files from Salesforce orgs. DO NOT TRIGGER when: running Apex tests (use platform-apex-test-run), generating or fixing Apex code (use platform-apex-generate), or Agentforce session tracing (use agentforce-observe).

platform-soql-query

forcedotcom/sf-skills

Use when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan/selectivity analysis, and performance or safety improvements. TRIGGER when the user writes, optimizes, or debugs SOQL/SOSL, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER for bulk data operations (use platform-data-manage), Apex DML logic (use platform-apex-generate), or report/dashboard queries.

platform-metadata-deploy

forcedotcom/sf-skills

Salesforce DevOps automation using sf CLI v2. TRIGGER when: user deploys metadata, validates a deploy or does a dry-run, deploys to a Production org, quick-deploys a validated job ID, ships/promotes to prod, creates/manages scratch orgs or sandboxes, sets up CI/CD pipelines, or troubleshoots deployment errors with sf project deploy. DO NOT TRIGGER when: writing Apex code, building LWC components (use experience-lwc-generate), creating metadata definitions (use platform-custom-object-generate), deleting metadata from an org (use platform-destructive-deploy), or querying org data (use platform-data-manage).

DevOps & Cloud6.8K installs

Popular backend & apis skills

View category →

find-skills

vercel-labs/skills

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

OfficialBackend & APIs4.1M installs

entra-app-registration

microsoft/azure-skills

Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.

OfficialBackend & APIs566.7K installs

This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).

Backend & APIs514.8K installs

embedded-captions

heygen-com/hyperframes

Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.

Backend & APIs453.3K installs

entra-agent-id

microsoft/azure-skills

Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).

OfficialBackend & APIs336.6K installs

neon

neondatabase/agent-skills

Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.

Backend & APIs237.1K installs