agentleFS
muon-m2muon-m2/magento2-tools/skills/graphql/SKILL.md

graphql

Skill6 starsChanged 28 days agoMITView on GitHub

Schema-first GraphQL generation. Produces: - etc/schema.graphqls with query/mutation/type definitions - Resolver classes implementing ResolverInterface - Batch loaders implementing BatchResolverInterface (to avoid N+1) - Auth and store-scope checks - Per-resolver unit tests via test-generate - Schema-first. Decide the schema before writing resolvers. - Batch over standard for list contexts. Any resolver returning data per element of a parent list MUST use BatchResolverInterface. Standard resolvers in a list cause N+1. - Auth check on every mutation. Anonymous mutations require explicit justification. -…

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 18 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Append, don't replace: When etc/schema.graphqls exists, append new types/fields rather than rewriting.

    line 29
  2. Very specific:

    Apply the shared module-hygiene baseline (required): After generating or modifying PHP files, run …

    line 83

“Common” is measured: kept by at least 6 in 10 of the 18 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Magento 2 GraphQL Create

Schema-first GraphQL generation. Produces:

  • etc/schema.graphqls with query/mutation/type definitions
  • Resolver classes implementing ResolverInterface
  • Batch loaders implementing BatchResolverInterface (to avoid N+1)
  • Auth and store-scope checks
  • Per-resolver unit tests via test-generate

Core Rules

  • Schema-first. Decide the schema before writing resolvers.
  • Batch over standard for list contexts. Any resolver returning data per element of a parent list MUST use BatchResolverInterface. Standard resolvers in a list cause N+1.
  • Auth check on every mutation. Anonymous mutations require explicit justification.
  • Store-scope aware. Resolvers querying store-scoped data must respect the Store header via ContextInterface.
  • Append, don't replace. When etc/schema.graphqls exists, append new types/fields rather than rewriting.
  • Coding style. Generated PHP follows PER-CS 3.0 as the baseline, with the Magento 2 coding standard taking precedence on any conflict; --standard=Magento2 PHPCS is the gate. See context/references/php-coding-style.md.
  • Source of truth. Generate from templates → shared references → baked-in Magento 2 knowledge → official Magento/Adobe docs (live-fetched only when uncertain). Do NOT read, grep, or "study" other modules under app/code/vendor/*/Magento core to infer conventions, entity shapes, naming, or wiring. Narrow exceptions: the target module/class of this operation, and the specific contract of a module this code explicitly depends on. Affirm sources in the final report. See context/references/source-of-truth.md.

Workflow

Phase 0 — Context Resolution

Invoke context.

Phase 1 — Schema Plan

Ask the user:

  • Operation: query | mutation
  • Entity: what is being queried/mutated
  • Return shape: single | list | paginated
  • Auth: customer | admin | anonymous (with justification)
  • Store scope: single | store-aware | global
  • Inputs: which fields the operation accepts
  • Backing service: existing service contract, or new

Produce the schema fragment. See references/schema-patterns.md.

Phase 2 — Resolver Plan

For each operation, decide:

  • Standard resolver — one entity at a time. Use when called once per request.
  • Batch resolver — collects N IDs, returns N results. Use in list contexts to avoid N+1 (e.g. products.reviews { ... } returning reviews per product).
  • Paginated resolver — getList with SearchCriteria + currentPage/pageSize.

Present the plan. Wait for approval.

Phase 3 — Generate

  • Append schema to existing etc/schema.graphqls (create file if absent).
  • Generate resolver class(es) under Model/Resolver/.
  • For batch: generate BatchResolverInterface implementation under Model/Resolver/Batch/.
  • Wire DI in area-specific etc/graphql/di.xml.
  • Generate Test/Unit/Model/Resolver/{Name}Test.php via test-generate.

Phase 4 — Verify

  • xmllint --noout on etc/graphql/di.xml.
  • php -l on each resolver.
  • Schema validity: parse via Magento's schema parser if CLI is available.
  • Apply the shared module-hygiene baseline (required). After generating or modifying PHP files, run ${CLAUDE_PLUGIN_ROOT}/skills/context/scripts/add-license-headers.sh {ctx.magento_root}/app/code/{Vendor}/{Module} {Vendor} to stamp the standard copyright header onto every new .php (idempotent — it skips files that already carry it). When adding a composer.json require entry, resolve a bounded constraint via ${CLAUDE_PLUGIN_ROOT}/skills/context/scripts/resolve-dep-constraint.sh <vendor/package> — never "*". See context/references/module-hygiene.md.

Phase 5 — Report

Brief Markdown:

  • Operations added
  • Resolvers added (standard / batch / paginated)
  • Auth/scope decisions
  • Test coverage delta

Docs may now be stale. This change modified module code. Run docs --module={Vendor}_{Module} to refresh the module's README, CHANGELOG, and docs/*.md (technical reference, guides, and API references as applicable).

Inputs

/graphql [--module=<Vendor>_<Module>] [--operation=query|mutation] [--auth=customer|admin|anonymous]

Interactive flow drives the rest.

Outputs

{ctx.magento_root}/app/code/{Vendor}/{Module}/etc/schema.graphqls          # appended or created
{ctx.magento_root}/app/code/{Vendor}/{Module}/etc/graphql/di.xml           # created or merged
{ctx.magento_root}/app/code/{Vendor}/{Module}/Model/Resolver/...           # new files
{ctx.magento_root}/app/code/{Vendor}/{Module}/Test/Unit/Resolver/...       # new tests

Reference Files

  • references/schema-patterns.md — query, mutation, input, interface, union patterns.
  • references/resolver-patterns.md — standard + batch + paginated resolver patterns.
  • references/auth-patterns.md — @doc(category="store"), auth-check helpers.
  • references/store-scope.md — per-store handling in resolvers.
  • references/schema-migration.md — non-breaking vs breaking schema changes.
  • references/n-plus-one-prevention.md — when to use batch resolver vs eager-load.
  • context/references/source-of-truth.md — source-of-truth hierarchy + the no-unrelated-module-scanning rule (allowed reads, live-doc fetch protocol, report affirmation).

Templates

  • templates/query-resolver.php
  • templates/mutation-resolver.php
  • templates/batch-resolver.php
  • templates/paginated-resolver.php
  • templates/schema-fragment.graphqls

Acceptance Criteria

  • Schema parses (when Magento CLI is available).
  • Resolvers implement the correct interface.
  • Mutations include auth check; anonymous mutations require explicit justification.
  • Batch resolvers process N inputs in O(1) DB roundtrips.
  • Generated resolvers have at least one unit test (happy + auth-fail + input-error).

Related Skills

PhaseSkill
0context
(after Phase 3)review --diff
(after Phase 3)test-generate --types=unit
(caller)feature Phase 5 (G* tasks)
(sibling)webapi (REST / Web-API surface for the same entity)

Download now (ZIP)

  • Other versions21 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 21

    1. ParabolInc/parabol★ 2ksame name
    2. Mindrally/skills★ 275same name
    3. kid-sid/claude-spellbook★ 190same name
    4. TheBeardedBearSAS/claude-craft★ 108same name
    5. SubhiSec/claude-ai-cyber-security-skills★ 45same name
    6. 0xGhostCAT/claude-ai-cyber-security-skills★ 41same name
    7. nimadorostkar/Claude-Skills-collection★ 29same name
    8. G1Joshi/Agent-Skills★ 15same name
    9. xfstudio/skills★ 9same name
    10. crowdin/skills★ 8same name

    11 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects with it also use ssti, oauth-oidc and 8 more.

    Other files people use alongside this one.

    Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
    • SubhiSecSkill

      ssti

      Hunt Server-Side Template Injection (SSTI) in Jinja2, Twig, Freemarker, Velocity, Smarty, ERB, Handlebars, Mustache, and Spring (SpEL). Use when input is reflected in a way that suggests template rendering — error pages, email templates, PDF generators, dynamic content systems.

      Also in 5 projects that use this

    • SubhiSecSkill

      oauth-oidc

      Hunt OAuth 2.0 and OIDC flaws — redirect_uri abuse, state CSRF, PKCE bypass, scope manipulation, implicit-flow token theft, postMessage origin tricks, ID token sub claim swap, JWKS confusion, response_type confusion, and OAuth-CSRF. Use when an app has Google/GitHub/Facebook/Apple/custom OAuth or OpenID Connect.

      Also in 3 projects that use this

    • blacklanternsecuritySkill

      ssrf

      Guide server-side request forgery (SSRF) exploitation during authorized penetration testing.

      Also in 5 projects that use this

    • zebbernSkill

      subdomain-enum

      Enumerate subdomains for a target domain using passive and active reconnaissance techniques. Use when starting reconnaissance on a new target, when you need to discover the attack surface, when expanding scope from a root domain, or when the user provides a domain to investigate.

      Also in 3 projects that use this

    • blacklanternsecuritySkill

      jwt-attacks

      Exploit JWT (JSON Web Token) vulnerabilities during authorized penetration testing.

      Also in 3 projects that use this

    • iAskShahramSkill

      file-upload

      Uploads a local file to Cloudflare R2 bucket `public` with wrangler and returns the public URL on assets.shahram.dev. Use when the user wants a public link, public URL, or to host/upload a local image or file to R2.

      Also in 4 projects that use this

    • +3 more from SubhiSec
    • +1 more from blacklanternsecurity
  • In this repository35 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.