agentsclimarketplace

Implement graphql

Skill igmarin/rails-agent-skills/skills/api/implement-graphql

This is my personal configuration of skills as a Ruby on Rails Dev

Install
npx -y skills add igmarin/rails-agent-skills --skill implement-graphql

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 22 stars22 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when building or reviewing GraphQL APIs in Rails with graphql-ruby — must follow the TDD gates by writing a failing spec in spec/graphql/ using AppSchema.execute rather than HTTP controller dispatch, define arguments/return types without leaking internal model names (use connection_type for pagination), implement resolver/mutation classes that delegate to services, prevent N+1 queries by using and priming the dataloader on association loads, and ensure mutations return result and errors shapes on failure. Trigger words: graphql, graphql-ruby, resolver, mutation, dataloader, schema.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

4.0 KB, as published. Nobody here has run it

Implement GraphQL

Use this skill when designing, implementing, or reviewing GraphQL APIs in a Rails application with the graphql-ruby gem.

Core Process

DO NOT proceed to step 3 before step 1 is written and failing.

  1. SPEC: Write failing spec (happy path + auth + validation error case) — see TESTING.md. Use AppSchema.execute in spec/graphql/. Never use HTTP controller dispatch for GraphQL specs.

  2. TYPE: Define arguments and return types. Use connection_type for pagination shapes. Do not leak internal model names.

  3. IMPLEMENT: Create resolver/mutation class delegating to a service object. Use dedicated classes instead of inline field blocks.

  4. N+1 CHECK: Use dataloader on every association load. For list resolvers, prime the dataloader with the records returned by the relation before fields resolve associated objects. Use bullet and db-query-matchers in specs.

    # ✅ batches loads across all records
    def buyer
      dataloader.with(Sources::RecordById, Buyer).load(object.buyer_id)
    end
    
  5. AUTH CHECK: Apply field-level guards where data is sensitive using Pundit or custom context guards.

    field :internal_notes, String, null: true do
      guard -> (_obj, _args, ctx) { ctx[:current_user]&.admin? }
    end
    
  6. FINAL CHECK: Verify every item in the HARD-GATE checklist below. Ensure mutations return { result, errors } shapes on failure.

    rescue ActiveRecord::RecordInvalid => e
      { order: nil, errors: e.record.errors.full_messages }
    
  7. RUN: Ensure the full test suite is green before PR.

HARD-GATE Checklist

Before shipping a resolver/mutation slice, ALL of the following must be confirmed:

  • Specs — covers happy path, unauthenticated, unauthorized, validation errors, N+1 counts, and schema limits.
  • N+1 Preventiondataloader.with(Source, Model).load(id) on every association; never object.association.
  • Dataloader Priming — collection resolvers prime records before association fields resolve.
  • Authorization — sensitive fields have field-level guards (not type-level alone).
  • Type Conventions — paginated collections use Types::*Type.connection_type, not plain arrays.
  • Schema Safeguards — introspection disabled in production; max_depth and max_complexity set.
  • Error Handling — mutations return { result, errors } with rescue blocks; no unhandled exceptions.
  • Documentationdescription: on every field in every type.
  • Resolver Structure — dedicated resolver classes, not inline field blocks.

Extended Resources (Progressive Disclosure)

Load these files only when their specific content is needed:

  • TESTING.md — For the spec template, paths, and checklist.
  • EXAMPLES.md — For detailed code examples of dataloaders, mutations, and types.

Integration

SkillWhen to chain
define-domain-languageType and field naming must match business language
plan-testsChoose first failing spec (mutation vs query vs resolver unit)
write-testsFull TDD cycle for resolvers and mutations
security-checkAuth, introspection disable, query depth/complexity limits

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.