.claude/skills/gen-service-interface/SKILL.md
Use when defining the public contract for a new domain service or application service. Generates a CQS-categorized interface with Commands, Queries, Validators, a Criteria class, and XML doc comments. Also invoke when the user mentions: service interface, IMyService, define service contract, add service interface, application service interface. Domain: Code Generation, Architecture. Level: Intermediate.
npx skillsauth add klod68/littlerae gen-service-interfaceInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate a CQS-categorized service interface for the entity: ${1:EntityName}.
${2|int,Guid,string|}${3:MyApp}${4:string name, string description}${5:int id, string name, string description}${6:string? nameSearch, string? category}${3}.Domain.Services.I${1}Service.cs
Divide methods into three #region blocks:
Commands — side-effect operations, return technical receipts only:
InsertAsync(${4}, CancellationToken ct = default) → Task<${2}>UpdateAsync(${5}, CancellationToken ct = default) → Task<bool>DeleteAsync(${2} id, CancellationToken ct = default) → Task<bool>Queries — pure reads, no side effects:
GetByIdAsync(${2} id, CancellationToken ct = default) → Task<${1}?>GetByCriteriaAsync(${1}Criteria criteria, CancellationToken ct = default) → Task<IReadOnlyList<${1}>>GetPagedAsync(${1}Criteria criteria, IPagedRequest paging, CancellationToken ct = default) → Task<IPagedResult<${1}>>Validators — boolean checks, no side effects:
ExistsAsync(${2} id, CancellationToken ct = default) → Task<bool>${3}.Domain.Services.${1}Criteria.cs
CancellationToken cancellationToken = defaultIReadOnlyList<T> — never List<T> or IEnumerable<T>bool) — never domain objectsbool / Task<bool> — no other return typeInsert, Update, Delete, ExecuteGet, Find, LoadExists, Is, Has, Canpublic — it is a domain contracttools
Use when cross-cutting concerns (logging, metrics, validation, authorization) are tangled into command handlers or service methods, when building database command pipelines with reorderable concerns, or when HTTP client pipelines or message handlers need composable, independently-replaceable processing stages. Covers ICommandInterceptor interface, InterceptorPipeline with reverse-chain construction, zero-cost Empty sentinel to skip overhead when no interceptors are registered, and ConfigureAwait(false) discipline for library code. Domain: Architecture, Cross-Cutting Concerns. Level: Intermediate. Tags: interceptor, pipeline, middleware, decorator, cross-cutting-concerns.
development
Use when writing integration tests for Razor Pages, MVC, or Minimal API applications to validate routing, middleware, page rendering, and HTTP behavior without a browser or live server, or when adding fast smoke tests to a CI pipeline. Covers WebApplicationFactory<Program> setup with public partial class Program, in-memory test server, AngleSharp HTML parsing, CSS selector assertions, redirect and status code testing, and a shared static fixture pattern for minimal per-test startup overhead. Domain: Testing, ASP.NET Core. Level: Intermediate. Tags: integration-testing, webapplicationfactory, razor-pages, anglesharp, http-testing.
development
Use when designing indexes for new tables, diagnosing slow queries that are not using indexes efficiently, reviewing index fragmentation and maintenance, or when the current indexing strategy results in key lookups, table scans, or missing index warnings. Covers clustered index key selection (narrow, unique, ever-increasing), non-clustered index design for query patterns, covering indexes with INCLUDE columns, filtered indexes for subset queries, composite index column ordering, DMV-based monitoring for missing and unused indexes, and rebuild vs reorganize maintenance thresholds. Domain: Database, Performance. Level: Intermediate. Tags: index, sql-server, covering-index, filtered-index, performance, dmv, maintenance.
development
Use when building a searchable in-memory catalog or registry for documentation sites, admin panels, or type/API browsers where you need keyword matching, fuzzy search, and ranked results without an external search engine or database. Covers RegistryService with weighted scoring across name, description, keywords, and method names; Levenshtein fuzzy matching; synonym expansion; category and subcategory filtering; and singleton DI registration for datasets of hundreds to low thousands of items. Domain: Search, Data Access Patterns. Level: Intermediate. Tags: search, registry, fuzzy-matching, in-memory, catalog, filtering.