Python graphql
Skill Mattakushi432/Claude-Code-Skills-Custom-DevTools-Pack/plugins/devtools-pack/skills/python-graphql
A curated pack of custom Claude Code skills for developers — installable as a Claude Code plugin marketplace.
npx -y skills add Mattakushi432/Claude-Code-Skills-Custom-DevTools-Pack --skill python-graphqlAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 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
When to activate: Strawberry, Graphene, GraphQL, subscriptions, dataloaders, N+1, schema-first design
SKILL.md
3.1 KB, 666 tokens by cl100k_base, as published. Nobody here has run it
Python GraphQL Patterns (Strawberry)
Schema Definition
import strawberry
from strawberry.fastapi import GraphQLRouter
from strawberry.dataloader import DataLoader
from typing import Optional
import asyncio
@strawberry.type
class User:
id: int
email: str
name: str
@strawberry.type
class Post:
id: int
title: str
author_id: int
@strawberry.field
async def author(self, info: strawberry.types.Info) -> User:
return await info.context.loaders.user.load(self.author_id)
@strawberry.type
class Query:
@strawberry.field
async def user(self, id: int, info: strawberry.types.Info) -> Optional[User]:
return await info.context.db.get_user(id)
@strawberry.field
async def posts(self, limit: int = 20, offset: int = 0, info: strawberry.types.Info) -> list[Post]:
return await info.context.db.list_posts(limit=limit, offset=offset)
schema = strawberry.Schema(query=Query)
DataLoader (N+1 Prevention)
from strawberry.dataloader import DataLoader
async def load_users_by_ids(keys: list[int]) -> list[User | Exception]:
users = await db.get_users_by_ids(keys)
user_map = {u.id: u for u in users}
return [user_map.get(key, Exception(f"User {key} not found")) for key in keys]
class Context:
def __init__(self, db: Database) -> None:
self.db = db
self.loaders = Loaders(
user=DataLoader(load_fn=load_users_by_ids),
)
async def get_context(db: Database = Depends(get_db)) -> Context:
return Context(db=db)
graphql_app = GraphQLRouter(schema, context_getter=get_context)
Mutations with Input Types
@strawberry.input
class CreatePostInput:
title: str
body: str
@strawberry.type
class CreatePostPayload:
post: Optional[Post] = None
errors: list[str] = strawberry.field(default_factory=list)
@strawberry.type
class Mutation:
@strawberry.mutation
async def create_post(
self,
input: CreatePostInput,
info: strawberry.types.Info,
) -> CreatePostPayload:
if len(input.title) < 3:
return CreatePostPayload(errors=["Title must be at least 3 characters"])
post = await info.context.db.create_post(
title=input.title,
body=input.body,
author_id=info.context.current_user.id,
)
return CreatePostPayload(post=post)
Subscriptions
import asyncio
from typing import AsyncGenerator
@strawberry.type
class Subscription:
@strawberry.subscription
async def post_created(self, info: strawberry.types.Info) -> AsyncGenerator[Post, None]:
async with info.context.pubsub.subscribe("posts") as sub:
async for event in sub:
yield event
Gives 0 of the 12 instructions most apis services skills give in 666 tokens
Counted across 424 of the 426 authors here whose files we hold, read 2026-08-06
- use plural nouns for resource namesin 41 of 424, across 32 files
- use cursor-based pagination for large datasetsin 35 of 424, across 20 files
- include rate limit headers in responsesin 25 of 424, across 13 files
- Use kebab-case for multi-word resourcesin 23 of 424, across 13 files
- version APIs in the URL pathin 19 of 424, across 9 files
- use semantic HTTP status codesin 18 of 424, across 8 files
- verify webhook signaturesin 18 of 424, across 11 files
- use query parameters for filteringin 17 of 424, across 6 files
- use async database operationsin 14 of 424, across 7 files
- wrap successful responses in a data fieldin 13 of 424, across 3 files
- prefix sorting parameters with a hyphen for descending orderin 13 of 424, across 3 files
- set appropriate HTTP status codesin 13 of 424, across 6 files
Said here and by no other author read
- Define schema using strawberry decorators
- Return exceptions for missing DataLoader keys
- Store loaders on request context
- Define separate input classes for mutations
- Implement subscriptions as async generators
- Subscribe to pubsub channels for subscriptions
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.