Agent skill
orchardcore-graphql
Skill for configuring and using the GraphQL API in Orchard Core. Covers GraphQL queries, custom types, content type querying, and GraphQL schema customization.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/orchardcore-graphql
Metadata
Additional technical details for this skill
- author
- CrestApps Team
- version
- 1.0
SKILL.md
Orchard Core GraphQL - Prompt Templates
Configure and Use GraphQL API
You are an Orchard Core expert. Generate GraphQL queries and custom type definitions for Orchard Core.
Guidelines
- Enable
OrchardCore.Apis.GraphQLto expose a GraphQL endpoint at/api/graphql. - Content types are automatically exposed as GraphQL types.
- Use the GraphiQL interface at
/admin/graphqlfor query exploration. - Custom GraphQL types can extend the schema for custom data.
- GraphQL queries support filtering, sorting, and pagination.
- Authentication and authorization apply to GraphQL queries.
- Use
WhereInputtypes for filtering content items.
Enabling GraphQL Features
{
"steps": [
{
"name": "Feature",
"enable": [
"OrchardCore.Apis.GraphQL"
],
"disable": []
}
]
}
Basic Content Query
{
blogPost {
contentItemId
displayText
createdUtc
publishedUtc
titlePart {
title
}
autoroutePart {
path
}
htmlBodyPart {
html
}
}
}
Query with Filtering
{
blogPost(where: {displayText_contains: "orchard"}) {
contentItemId
displayText
publishedUtc
}
}
Query with Pagination
{
blogPost(first: 10, skip: 0, orderBy: {publishedUtc: DESC}) {
contentItemId
displayText
publishedUtc
}
}
Query Specific Content Item
{
contentItem(contentItemId: "{{ContentItemId}}") {
contentItemId
contentType
displayText
publishedUtc
... on BlogPost {
titlePart {
title
}
htmlBodyPart {
html
}
}
}
}
Query Content Items by Status
{
blogPost(status: PUBLISHED) {
contentItemId
displayText
publishedUtc
}
}
{
blogPost(status: DRAFT) {
contentItemId
displayText
modifiedUtc
}
}
{
blogPost(status: LATEST) {
contentItemId
displayText
latest
published
}
}
Custom GraphQL Object Type
using GraphQL.Types;
using OrchardCore.Apis.GraphQL;
using OrchardCore.ContentManagement;
public sealed class MyPartQueryObjectType : ObjectGraphType<MyPart>
{
public MyPartQueryObjectType()
{
Name = "MyPart";
Field(x => x.MyField)
.Description("My custom field.");
Field(x => x.MyNumber)
.Description("A numeric value.");
}
}
Custom GraphQL Input Type
using GraphQL.Types;
public sealed class MyPartInputObjectType : InputObjectGraphType<MyPart>
{
public MyPartInputObjectType()
{
Name = "MyPartInput";
Field(x => x.MyField, nullable: true)
.Description("Filter by my custom field.");
}
}
Custom GraphQL Filter
using OrchardCore.ContentManagement.GraphQL.Queries;
public sealed class MyPartIndexAliasProvider : IIndexAliasProvider
{
private static readonly IndexAlias[] _aliases = new[]
{
new IndexAlias
{
Alias = "myPart",
Index = nameof(MyPartIndex),
IndexType = typeof(MyPartIndex)
}
};
public IEnumerable<IndexAlias> GetAliases()
{
return _aliases;
}
}
Registering Custom GraphQL Types
using OrchardCore.Apis;
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddObjectGraphType<MyPart, MyPartQueryObjectType>();
services.AddInputObjectGraphType<MyPart, MyPartInputObjectType>();
services.AddScoped<IIndexAliasProvider, MyPartIndexAliasProvider>();
}
}
Querying with Liquid and GraphQL
Execute GraphQL queries from Liquid templates:
{% graphql query: "{ blogPost(first: 5, orderBy: {publishedUtc: DESC}) { displayText, autoroutePart { path } } }" %}
{% for post in graphql.blogPost %}
<a href="{{ post.autoroutePart.path }}">{{ post.displayText }}</a>
{% endfor %}
Authentication for GraphQL
GraphQL queries respect Orchard Core permissions. For API access:
# Query with API key
curl -X POST https://example.com/api/graphql \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {{token}}" \
-d '{"query": "{ blogPost { displayText } }"}'
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?