Back to Skills

strawberry-graphql

verified

Strawberry GraphQL library for Python with FastAPI integration, type-safe resolvers, DataLoader patterns, and subscriptions. Use when building GraphQL APIs with Python, implementing real-time features, or creating federated schemas.

View on GitHub

Marketplace

orchestkit

yonatangross/skillforge-claude-plugin

Plugin

orchestkit-complete

development

Repository

yonatangross/skillforge-claude-plugin
33stars

./skills/strawberry-graphql/SKILL.md

Last Verified

January 23, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/yonatangross/skillforge-claude-plugin/blob/main/./skills/strawberry-graphql/SKILL.md -a claude-code --skill strawberry-graphql

Installation paths:

Claude
.claude/skills/strawberry-graphql/
Powered by add-skill CLI

Instructions

# Strawberry GraphQL Patterns

Type-safe GraphQL in Python with code-first schema definition.

## Overview

- Complex data relationships (nested queries, multiple entities)
- Client-driven data fetching (mobile apps, SPAs)
- Real-time features (subscriptions for live updates)
- Federated microservice architecture

## When NOT to Use

- Simple CRUD APIs (REST is simpler)
- Internal microservice communication (use gRPC)

## Schema Definition

```python
import strawberry
from datetime import datetime
from strawberry import Private

@strawberry.enum
class UserStatus:
    ACTIVE = "active"
    INACTIVE = "inactive"

@strawberry.type
class User:
    id: strawberry.ID
    email: str
    name: str
    status: UserStatus
    password_hash: Private[str]  # Not exposed in schema

    @strawberry.field
    def display_name(self) -> str:
        return f"{self.name} ({self.email})"

    @strawberry.field
    async def posts(self, info: strawberry.Info, limit: int = 10) -> list["Post"]:
        return await info.context.post_loader.load_by_user(self.id, limit)

@strawberry.type
class Post:
    id: strawberry.ID
    title: str
    content: str
    author_id: strawberry.ID

    @strawberry.field
    async def author(self, info: strawberry.Info) -> User:
        return await info.context.user_loader.load(self.author_id)

@strawberry.input
class CreateUserInput:
    email: str
    name: str
    password: str
```

## Query and Mutation

```python
@strawberry.type
class Query:
    @strawberry.field
    async def user(self, info: strawberry.Info, id: strawberry.ID) -> User | None:
        return await info.context.user_service.get(id)

    @strawberry.field
    async def me(self, info: strawberry.Info) -> User | None:
        user_id = info.context.current_user_id
        return await info.context.user_service.get(user_id) if user_id else None

@strawberry.type
class Mutation:
    @strawberry.mutation
    async def create_user(self, info: strawberry.Info, input: CreateUserInput) -> User

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
7062 chars