Skip to content
TheBushidoCollective avatar

absinthe-graphql

Absinthe GraphQL skills for Elixir that cover schema design, resolvers, and real-time subscriptions.

CCM score
45 of 100
GitHub stars
201
View on GitHub

Own this plugin? Claim it

What it does

  • Adds 3 skills: absinthe-schema, absinthe-resolvers, and absinthe-subscriptions for Absinthe projects
  • Covers type definitions, interfaces, unions, enums, and schema organization for large APIs
  • Includes resolver patterns with Dataloader batching and error handling, plus Phoenix channel subscriptions and PubSub
  • Designed for Elixir projects on Phoenix 1.7+ that need GraphQL APIs with live updates

Add marketplace

/plugin marketplace add TheBushidoCollective/han

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install absinthe-graphql@han

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

Absinthe - Resolvers

Guide to implementing efficient and maintainable resolvers in Absinthe.

Key Concepts

Basic Resolvers

defmodule MyApp.Resolvers.User do
  alias MyApp.Accounts

  def list_users(_parent, args, _resolution) do
    {:ok, Accounts.list_users(args)}
  end

  def get_user(_parent, %{id: id}, _resolution) do
    case Accounts.get_user(id) do
      nil -> {:error, "User not found"}
      user -> {:ok, user}
    end
  end

  def create_user(_parent, %{input: input}, _resolution) do
    case Accounts.create_user(input) do
      {:ok, user} -> {:ok, user}
      {:error, changeset} -> {:error, changeset}
    end
  end
end

Resolution Context

def current_user(_parent, _args, %{context: %{current_user: user}}) do
  {:ok, user}
end

def current_user(_parent, _args, _resolution) do
  {:error, "Not authenticated"}
end

Dataloader Integration

defmodule MyApp.Schema do
  use Absinthe.Schema

  def context(ctx) do
    loader =
      Dataloader.new()
      |> Dataloader.add_source(MyApp.Repo, Dataloader.Ecto.new(MyApp.Repo))

    Map.put(ctx, :loader, loader)
  end

  def plugins do
    [Absinthe.Middleware.Dataloader] ++ Absinthe.Plugin.defaults()
  end
end

# In type definitions
object :user do
  field :posts, list_of(:post) do
    resolve dataloader(MyApp.Repo)
  end
end

Custom Dataloader Source

defmodule MyApp.Loaders.User do
  def data() do
    Dataloader.KV.new(&fetch/2)
  end

  defp fetch(:posts_count, user_ids) do
    counts = MyApp.Posts.count_by_user_ids(user_ids)

    Map.new(user_ids, fn id ->
      {id, Map.get(counts, id, 0)}
    end)
  end
end

Best Practices

  1. Use Dataloader - Prevents N+1 queries
  2. Keep resolvers thin - Delegate to context modules
  3. Handle errors gracefully - Return meaningful error messages
  4. Use middleware - For cross-cutting concerns like auth
  5. Batch related queries - Use dataloader batching

Middleware

defmodule MyApp.Middleware.Auth do
  @behaviour Absinthe.Middleware

  def call(resolution, _config) do
    case resolution.context do
      %{current_user: %{}} ->
        resolution
      _ ->
        resolution
        |> Absinthe.Resolution.put_result({:error, "Unauthorized"})
    end
  end
end

# Apply to fields
field :admin_data, :string do
  middleware MyApp.Middleware.Auth
  resolve &MyApp.Resolvers.Admin.get_data/3
end

Error Handling

defmodule MyApp.Resolvers.Helpers do
  def handle_changeset_errors(%Ecto.Changeset{} = changeset) do
    errors =
      Ecto.Changeset.traverse_errors(changeset, fn {msg, opts} ->
        Enum.reduce(opts, msg, fn {key, value}, acc ->
          String.replace(acc, "%{#{key}}", to_string(value))
        end)
      end)

    {:error, errors}
  end
end

Anti-Patterns

  • Avoid business logic in resolvers
  • Don't query database directly in resolvers
  • Avoid returning raw Ecto changesets
  • Don't skip error handling

Readme

Absinthe GraphQL

Absinthe GraphQL skills for Elixir projects with Claude Code.

What This Plugin Provides

Skills

This plugin provides the following skills for building GraphQL APIs with Absinthe:

  • absinthe-schema: Type definitions, interfaces, unions, enums, and schema organization patterns
  • absinthe-resolvers: Resolver patterns, Dataloader integration, batching, and error handling
  • absinthe-subscriptions: Real-time subscriptions with Phoenix channels and PubSub

Installation

han plugin install absinthe-graphql

Usage

Once installed, Claude Code will have access to Absinthe-specific knowledge when working on Elixir GraphQL projects.

Example Use Cases

  • Designing GraphQL schemas with proper type definitions
  • Implementing efficient resolvers with Dataloader
  • Setting up real-time subscriptions
  • Handling authentication and authorization
  • Organizing large schemas

Requirements

  • Elixir 1.14+
  • Absinthe 1.7+
  • Phoenix 1.7+ (for subscriptions)

Related Plugins

  • elixir: Core Elixir language skills
  • phoenix: Phoenix framework patterns
  • ecto: Database interactions with Ecto
  • graphql: General GraphQL concepts

Details

Marketplace
TheBushidoCollective/han
Source
plugins/tools/absinthe-graphql
Category
Tool
Keywords
absinthe, graphql, elixir, api, subscriptions
Listed since
Apr 7, 2026

Questions

What is absinthe-graphql?

absinthe-graphql is a Claude Code plugin listed on Claude Marketplaces in the Backend & APIs category. The listing describes absinthe-graphql like this: Absinthe GraphQL skills for Elixir with schema design, resolvers, and subscriptions.

How do I install absinthe-graphql?

Run /plugin marketplace add TheBushidoCollective/han inside Claude Code, then /plugin install absinthe-graphql@han, to install absinthe-graphql. After that, absinthe-graphql is part of Claude Code.

Which category is absinthe-graphql in?

absinthe-graphql is in the Backend & APIs category on Claude Marketplaces. Other listings in that category next to absinthe-graphql include ruflo-ddd, Prismic Automation and svix-automation.

Where is the source code of absinthe-graphql?

absinthe-graphql comes from the thebushidocollective-han marketplace on GitHub at https://github.com/TheBushidoCollective/han. The TheBushidoCollective account on GitHub publishes absinthe-graphql.

More from TheBushidoCollective/han

All 340

Similar to absinthe-graphql

More Backend & APIs