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 GitHubyonatangross/skillforge-claude-plugin
ork-graphql
January 25, 2026
Select agents to install to:
npx add-skill https://github.com/yonatangross/skillforge-claude-plugin/blob/main/plugins/ork-graphql/skills/strawberry-graphql/SKILL.md -a claude-code --skill strawberry-graphqlInstallation paths:
.claude/skills/strawberry-graphql/# 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