Template Syntax

Templates are source code files with embedded placeholders that get replaced during skill execution. This page covers the full syntax and processing pipeline.

Variables

Variables are wrapped in single curly braces and get replaced with values from skill arguments and architecture configuration.

Variables follow PascalCase naming and come from skill arguments (user-provided values) and layer variables (from architecture configuration). Replacement is simple string substitution.

Before processing

namespace {ServiceName}.{DomainLayer}.Entities;

public class {EntityName} : AggregateRoot<{IdType}>
{
    public string Name { get; private set; }
}

After processing

namespace Orders.Domain.Entities;

public class Order : AggregateRoot<Guid>
{
    public string Name { get; private set; }
}

Conditionals

Conditional blocks include or exclude sections of a template based on configuration flags.

Conditionals use a comment-based syntax so templates remain valid source code even before processing. The condition name matches a configuration flag like typed-id, guid, controller, or minimal-api.

Conditional syntax

// {{#if typed-id}}
public record OrderId(Guid Value);
// {{/if}}

// {{#if guid}}
// Using standard Guid for entity IDs
// {{/if}}

After processing (typed-id = true)

public record OrderId(Guid Value);

Endpoint filtering

Templates can be prefixed to target specific endpoint styles. Only templates matching the selected style are included.

Prefix template filenames with the endpoint style. Files with controller., minimal-api., or fast-endpoints. prefixes are only included when that style is selected. Files without a prefix are always included.

Skill templates

add-endpoint/
  skill definition
  controller.Endpoint.cs
  minimal-api.Endpoint.cs
  fast-endpoints.Endpoint.cs
  EndpointDto.cs          # always included

Processing pipeline

Templates go through a three-step processing pipeline:

1. Filter by endpoint style

Templates with an endpoint prefix that doesn't match the selected style are excluded entirely. The prefix is stripped from the filename.

2. Replace variables

All variable placeholders are replaced with their values from skill arguments, layer variables, and ID strategy configuration.

3. Process conditionals

Conditional blocks are evaluated. True conditions keep their content (markers removed). False conditions are removed entirely.

The pipeline runs in this fixed order. Variables inside conditional blocks are replaced even if the block is later removed. The final output is clean source code with no template syntax remaining.

Pipeline

Template file
    |
    v
 1. Filter endpoints
    |
    v
 2. Replace variables
    |
    v
 3. Process conditionals
    |
    v
Final source code

Built-in variables

These variables are always available from the architecture configuration:

  • Name
    DomainLayer
    Type
    string
    Description

    Name of the domain layer. Default: Domain. Alternative: Core.

  • Name
    ApplicationLayer
    Type
    string
    Description

    Name of the application layer. Default: Application. Alternative: UseCases.

  • Name
    ApiLayer
    Type
    string
    Description

    Name of the API layer. Default: Api. Alternative: Web.

  • Name
    IdType
    Type
    string
    Description

    Entity ID type. Guid when using guid strategy, or typed ID record when using typed-id.

  • Name
    SolutionName
    Type
    string
    Description

    Name of the solution, set during create_solution.

Was this page helpful?