Skip to content
hotchocolate-specialist logo

HotChocolate Specialist

hotchocolate-specialist

Deep HotChocolate v15 GraphQL server expertise — schema design, resolvers, filtering/sorting/projections, pagination, subscriptions, error handling, authorization, performance, persisted operations, source generators, and migration. Self-learns from official docs. Triggers on: HotChocolate, Graph...

SKILL.md

Full skill instructions

HotChocolate Specialist

Deep HotChocolate v15 API expertise. Complements the backend-developer skill (project-specific patterns) with framework-level knowledge and self-learning from official documentation.

Scope boundary: Project-specific patterns (ObjectType layout, TypeExtension conventions, DataLoader naming, middleware testing, MassTransit, MongoDB) live in the backend-developer skill. This skill covers HotChocolate framework APIs, advanced features, and official best practices.

Self-Learning Workflow

Before answering any non-trivial HotChocolate question, fetch the latest official documentation to ensure accuracy. HotChocolate evolves rapidly — never rely solely on training data.

Step 1: Identify the Topic

Map the user's question to one or more documentation areas from the Documentation Index.

Step 2: Fetch Latest Documentation

Use fetch_webpage to retrieve the relevant page(s):

Primary:   https://chillicream.com/​docs/​hotchocolate/​v15/​{topic-path}
Fallback:  https://github.com/​ChilliCream/​graphql-platform/​blob/​main/​website/​src/​docs/​hotchocolate/​v15/​{topic-path}/​index.md

For bleeding-edge features or source code questions, search the GitHub repository:

https://github.com/​ChilliCream/​graphql-platform/​tree/​main/​src/​HotChocolate/​{module}

Step 3: Cross-Reference with Project Patterns

After fetching official docs, verify alignment with project conventions from backend-developer skill and general.instructions.md. Prefer project conventions when they intentionally diverge from defaults.

Step 4: Apply and Cite

Implement using the latest API. Always cite the documentation URL when introducing patterns the user may not have seen before.

Topic Quick Reference

AreaKey APIs / AttributesDoc Path
Schema DesignObjectType<T>, InterfaceType<T>, UnionType, EnumType, InputObjectType<T>, DirectiveType<T>defining-a-schema/
ScalarsBuilt-in + custom ScalarType<TRuntimeType, TLiteral>defining-a-schema/​scalars
EnumsEnumType<T>, [GraphQLName], [GraphQLDescription]defining-a-schema/​enums
InterfacesInterfaceType<T>, [InterfaceObject], implementsdefining-a-schema/​interfaces
UnionsUnionType, UnionType<T>, annotation-baseddefining-a-schema/​unions
DirectivesDirectiveType<T>, [Directive], executable/​type-systemdefining-a-schema/​directives
Relay[Node], [ID], Global Object Identification, INodeResolverdefining-a-schema/​relay
OneOf[OneOf] input typesdefining-a-schema/​input-object-types
Dynamic SchemasRuntime type building, ITypeModuledefining-a-schema/​dynamic-schemas
Versioning@deprecated, schema evolution strategiesdefining-a-schema/​versioning
ResolversPure resolvers, resolver pipeline, [Parent], [Service], [ScopedService]fetching-data/​resolvers
DataLoaderBatchDataLoader, GroupedDataLoader, CacheDataLoader, source-generatedfetching-data/​dataloader
Pagination[UsePaging], [UseOffsetPaging], cursor vs offset vs keysetfetching-data/​pagination
Filtering[UseFiltering], IFilterConvention, custom filter fieldsfetching-data/​filtering
Sorting[UseSorting], ISortConvention, custom sort fieldsfetching-data/​sorting
Projections[UseProjection], IProjectionConvention, first-class MongoDB supportfetching-data/​projections
Subscriptions[Subscribe], [Topic], in-memory, Redis providerdefining-a-schema/​subscriptions
MutationsMutation conventions, MutationConventionOptions, [Error], [UseMutationConvention]defining-a-schema/​mutations
Error HandlingIErrorFilter, mutation error conventions, IError, ErrorBuilderdefining-a-schema/​mutations
Server ConfigEndpoints, warmup, command-lineserver/
InterceptorsIHttpRequestInterceptor, ISocketSessionInterceptorserver/​interceptors
DI[Service], RegisterService, scoped services in resolversserver/​dependency-injection
Global StateIResolverContext.ContextData, SetGlobalState, GetGlobalStateserver/​global-state
IntrospectionEnable/​disable, AllowIntrospectionserver/​introspection
File UploadIFile, Upload scalarserver/​files
BatchingRequest batching, variable batchingserver/​batching
InstrumentationIExecutionDiagnosticEvents, OpenTelemetry integrationserver/​instrumentation
Auth[Authorize], policies, roles, @authorize directivesecurity/
Persisted OpsAutomatic Persisted Operations (APQ), file/​blob/​Redis storesperformance/
Cost AnalysisQuery cost/​complexity limits, [Cost]Related to CostAnalysis module
Source Generators[Module], AddTypes(), automatic type registrationdefining-a-schema/#automatic-type-registration
Migrationv13→v14→v15 breaking changes and migration pathsmigrating/

Advanced Patterns

Custom Scalars

public class UrlType : ScalarType<Uri, StringValueNode>
{
    public UrlType() : base("Url") { }

    protected override Uri ParseLiteral(StringValueNode valueSyntax)
        => new(valueSyntax.Value);

    protected override StringValueNode ParseValue(Uri runtimeValue)
        => new(runtimeValue.AbsoluteUri);

    public override IValueNode ParseResult(object? resultValue)
        => ParseValue((Uri)resultValue!);
}

Register: .AddType<UrlType>()

Filtering — Custom Convention

public class CustomFilterConvention : FilterConvention
{
    protected override void Configure(IFilterConventionDescriptor descriptor)
    {
        descriptor.AddDefaults();
        descriptor.Provider(new QueryableFilterProvider(p =>
            p.AddDefaultFieldHandlers()));
    }
}

// Registration
services.AddGraphQLServer()
    .AddFiltering<CustomFilterConvention>();

Sorting — Custom Convention

public class CustomSortConvention : SortConvention
{
    protected override void Configure(ISortConventionDescriptor descriptor)
    {
        descriptor.AddDefaults();
        descriptor.Provider(new QueryableSortProvider(p =>
            p.AddDefaultFieldHandlers()));
    }
}

Pagination — Cursor with MongoDB

[UsePaging(IncludeTotalCount = true, MaxPageSize = 100, DefaultPageSize = 25)]
[UseProjection]
[UseSorting]
[UseFiltering]
public IExecutable<MyEntity> GetEntities([Service] IMongoCollection<MyEntity> collection)
    => collection.AsExecutable();

Order matters: [UsePaging] → [UseProjection] → [UseSorting] → [UseFiltering] (outermost to innermost).

Subscriptions

// In mutation resolver
[UseMutationConvention]
public async Task<MyEntity> CreateEntity(
    CreateEntityInput input,
    [Service] ITopicEventSender sender,
    CancellationToken ct)
{
    MyEntity entity = /​* create */;
    await sender.SendAsync(nameof(OnEntityCreated), entity, ct);
    return entity;
}

// Subscription
[Subscribe]
[Topic(nameof(OnEntityCreated))]
public MyEntity OnEntityCreated([EventMessage] MyEntity entity) => entity;

Error Handling — Mutation Conventions

// Define domain errors as classes
public class EntityNotFoundError
{
    public EntityNotFoundError(string id) => Id = id;
    public string Id { get; }
    public string Message => $"Entity '{Id}' not found.";
}

// Annotate mutation with expected errors
[Error<EntityNotFoundError>]
[Error<ValidationError>]
[UseMutationConvention]
public async Task<MyEntity> UpdateEntity(UpdateEntityInput input, ...)
{
    // throw or return error types
}

Authorization — Field-Level

[Authorize(Policy = "AdminOnly")]
public class AdminQueries
{
    [Authorize(Roles = ["superadmin"])]
    public async Task<SensitiveData> GetSensitiveData(...)
        => /​* ... */;
}

Interceptors

public class CustomHttpRequestInterceptor : DefaultHttpRequestInterceptor
{
    public override ValueTask OnCreateAsync(
        HttpContext context,
        IRequestExecutor requestExecutor,
        OperationRequestBuilder requestBuilder,
        CancellationToken ct)
    {
        // Add custom context data from HTTP headers
        string? tenantId = context.Request.Headers["X-Tenant-Id"];
        requestBuilder.SetGlobalState("TenantId", tenantId);
        return base.OnCreateAsync(context, requestExecutor, requestBuilder, ct);
    }
}

// Registration
services.AddGraphQLServer()
    .AddHttpRequestInterceptor<CustomHttpRequestInterceptor>();

Source Generators & Registration

HotChocolate 12.7+ source generator auto-discovers types decorated with [QueryType], [MutationType], [SubscriptionType], [ObjectType], [ExtendObjectType], etc.

// ModuleInfo.cs — triggers source generation
[assembly: Module("MyDomain")]

// Startup — register all discovered types
services.AddGraphQLServer()
    .AddTypes();  // Registers all source-generated types from the module

Persisted Operations

services.AddGraphQLServer()
    .UseAutomaticPersistedOperationPipeline()
    .AddFileSystemOperationDocumentStorage("./​persisted-operations");

Alternative stores: Redis (AddRedisOperationDocumentStorage), Azure Blob Storage.

Troubleshooting Checklist

SymptomLikely CauseAction
Type 'X' is not registeredMissing AddTypes() or manual registrationCheck [Module] attribute + startup config
Filtering/​sorting not appliedMissing [UseFiltering]/[UseSorting] or wrong attribute orderVerify attribute stacking order
N+1 queries in resolverMissing DataLoaderImplement BatchDataLoader per backend-developer conventions
Subscription not firingITopicEventSender not called or topic mismatchVerify SendAsync topic matches [Topic]
Auth returning AUTH_NOT_AUTHENTICATEDMissing AddAuthorization() or JWT configVerify auth pipeline in startup
Pagination returns no totalCountIncludeTotalCount = false (default)Set [UsePaging(IncludeTotalCount = true)]
Mutation error not in unionMissing [Error<T>] attributeAdd error type annotation to mutation
Schema export changed unexpectedlySource generator picked up new typesReview [Module] scope and type visibility

Anti-Patterns

Anti-PatternWhy It's WrongFix
Filtering/​sorting on non-indexed fieldsKills DB performance at scaleEnsure MongoDB indexes match filterable/​sortable fields
[UseProjection] without DB supportProjection only works with supported providersVerify MongoDB/​EF Core provider integration
Manual pagination implementationReinvents cursor/​offset logic HC handlesUse [UsePaging] or [UseOffsetPaging]
Catching exceptions in resolvers to return errorsBypasses HC error pipelineUse IErrorFilter or mutation error conventions
Hardcoded MaxPageSize > 500Opens DoS vector via large queriesKeep MaxPageSize ≤ 100 in production
Introspection enabled in productionExposes full schema to attackersDisable via AllowIntrospection.Never or per-policy
Ignoring [Authorize] on mutationsAll mutations default to anonymousAdd authorization explicitly
Using DateTime scalar for UTC timestampsAmbiguous timezone semanticsUse DateTimeOffset or custom UTC scalar

Important Rules

  • Always fetch latest documentation before implementing advanced HC features
  • Attribute stacking order matters: [UsePaging] → [UseProjection] → [UseSorting] → [UseFiltering]
  • Never duplicate patterns already defined in backend-developer skill — reference it instead
  • Cite documentation URLs when introducing new patterns to the team
  • Prefer implementation-first (annotation-based) over schema-first approach
  • For project-specific conventions (naming, testing), defer to backend-developer skill and tests.instructions.md

More skills from gabrielmoreira

workflow-router logo
gabrielmoreira/agent-skills-mirror

workflow-router

研发工作流入口 - 帮助用户快速进入正确的工作流阶段。 触发关键词: 工作流, 流程, 从哪开始, 帮我, 我该怎么做, 下一步, workflow, 不知道用什么, 新手引导, 怎么用

19 0
View
平台架构知识 logo
gabrielmoreira/agent-skills-mirror

平台架构知识

Periodically refreshed mirror of agents, skills, prompts and instruction files from public repositories.

19 0
View
unity-profiler logo
gabrielmoreira/agent-skills-mirror

unity-profiler

Read-only Unity runtime performance snapshots — FPS, frame time, batches/draw calls, triangles/vertices, memory (total/mono/per-asset), object counts, AssetBundle stats. Exact signatures via GET /skills/schema.

19 0
View
ads-audit logo
gabrielmoreira/agent-skills-mirror

ads-audit

Full multi-platform paid advertising audit with parallel subagent delegation. Analyzes Google Ads, Meta Ads, LinkedIn Ads, TikTok Ads, Microsoft Ads, and Apple Ads accounts via 6 parallel audit agents. Amazon Ads, cross-platform attribution, and server-side tracking are covered by their standalon...

19 0
View
unity-skills logo
gabrielmoreira/agent-skills-mirror

unity-skills

Unity Editor automation via REST API — create scripts, analyze scenes, manage assets, control editor, orchestrate workflows, run batch jobs, and route by Unity version. Triggers: Unity, Unity Skills, in Unity, automate Unity, Unity editor automation, create Unity script, scene summary, analyze Un...

19 0
View
purple-cow-audit logo
gabrielmoreira/agent-skills-mirror

purple-cow-audit

Score product remarkability 1-10 to decide if it's worth promoting. Seth Godin's Purple Cow test. Triggers on: "is this product worth promoting", "should I promote", "product audit", "purple cow", "remarkable product", "is it remarkable", "rate this product", "product quality check", "worth my re...

19 0
View
unity-cleaner logo
gabrielmoreira/agent-skills-mirror

unity-cleaner

Project cleanup and audit — find unused assets, content-hash duplicates, missing references, empty folders, large assets, dependency trees; two-step confirm-token delete. Exact signatures via GET /skills/schema.

19 0
View
skill-manager-guide logo
gabrielmoreira/agent-skills-mirror

skill-manager-guide

**GUIDE SKILL** — Guide to the Skill Manager for Copilot extension. USE FOR: adding/removing skill repos, syncing skills, pushing feedback, configuring sync intervals, troubleshooting sync issues, understanding skill format. DO NOT USE FOR: creating new skills (use skill-creator), creating agents...

19 0
View
configure-nightwatch logo
gabrielmoreira/agent-skills-mirror

configure-nightwatch

Configures Laravel Nightwatch data collection, sampling rates, filtering rules, and redaction policies. Use when setting up Nightwatch, managing data volume, protecting sensitive data (PII), or optimizing event collection for production workloads.

19 0
View
research-and-write logo
gabrielmoreira/agent-skills-mirror

research-and-write

End-to-end workflow: research a topic and then write a LinkedIn post about it. Use this skill whenever the user wants the full pipeline — from a topic idea to a finished LinkedIn post. Triggers on: 'research and write a post about', 'create a LinkedIn post about [topic]', 'I want to post about', ...

19 0
View
AI Tutor Persona logo
gabrielmoreira/agent-skills-mirror

AI Tutor Persona

Periodically refreshed mirror of agents, skills, prompts and instruction files from public repositories.

19 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View