CtrlK
BlogDocsLog inGet started
Tessl Logo

igmarin/rails-agent-skills

Curated library of 41 public AI agent skills for Ruby on Rails development. Organized by category: planning, testing, code-quality, ddd, engines, infrastructure, api, patterns, context, and orchestration. Covers code review, architecture, security, testing (RSpec), engines, service objects, DDD patterns, and TDD automation. Repository workflows remain documented in GitHub but are intentionally excluded from the Tessl tile.

95

1.77x
Quality

93%

Does it follow best practices?

Impact

96%

1.77x

Average score across 41 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

TESTING.mdskills/api/implement-graphql/

GraphQL Testing Reference

Spec Template

# spec/graphql/mutations/create_order_spec.rb
RSpec.describe "Mutations::CreateOrder" do
  let(:user)    { create(:user) }
  let(:product) { create(:product, stock: 5) }
  let(:query) do
    <<~GQL
      mutation CreateOrder($productId: ID!, $quantity: Int!) {
        createOrder(input: { productId: $productId, quantity: $quantity }) {
          order { id }
          errors
        }
      }
    GQL
  end

  subject(:result) do
    AppSchema.execute(query, variables: { productId: product.id, quantity: 1 },
                              context: { current_user: user })
  end

  it "creates an order" do
    expect(result.dig("data", "createOrder", "errors")).to be_empty
    expect(result.dig("data", "createOrder", "order", "id")).to be_present
  end

  context "when unauthenticated" do
    subject(:result) { AppSchema.execute(query, variables: { productId: product.id, quantity: 1 }) }

    it "returns an authorization error" do
      expect(result["errors"]).not_to be_empty
    end
  end
end

Call AppSchema.execute directly in GraphQL specs. Do not route these checks through controller/request dispatch when the behavior under test is schema, resolver, authorization, or mutation response shape.

What to Always Test

  • Happy path — successful query/mutation
  • Authorization — unauthenticated (no context user), unauthorized (wrong role)
  • Validation errors — mutation returns errors array, not exception
  • N+1 — query count matchers for resolvers with associations
  • Dataloader priming — list resolvers prime returned records before type fields load associated records through dataloader
  • Depth/complexity limits — exceeding limits returns an error, not data

Spec Paths

Test typeSuggested path
Query resolversspec/graphql/queries/..._spec.rb
Mutationsspec/graphql/mutations/..._spec.rb
Typesspec/graphql/types/..._spec.rb (only if type has custom logic)
Resolver objectsspec/graphql/resolvers/..._spec.rb

skills

api

README.md

server.json

tile.json