Generates Specification pattern base classes, evaluator, and examples for EF Core to turn repeated query logic into reusable, testable objects.
Ships in TheCodeMan .NET AI ToolKit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turn repeated query criteria into reusable, unit-testable Specification objects, with an evaluator that applies them to an EF IQueryable.
Works on a target: a folder, project, or GitHub URL. Spot duplicated query logic to consolidate: grep -rn "\.Where(\|\.Include(\|\.OrderBy" --include=*.cs <target>.
public abstract class Specification<T>
{
public Expression<Func<T, bool>>? Criteria { get; protected set; }
public List<Expression<Func<T, object>>> Includes { get; } = new();
public Expression<Func<T, object>>? OrderBy { get; private set; }
public int? Take { get; private set; }
public int? Skip { get; private set; }
public bool AsNoTracking { get; private set; } = true;
protected void Where(Expression<Func<T, bool>> c) => Criteria = c;
protected void Include(Expression<Func<T, object>> i) => Includes.Add(i);
protected void Order(Expression<Func<T, object>> o) => OrderBy = o;
protected void Page(int skip, int take){ Skip = skip; Take = take; }
protected void Tracked() => AsNoTracking = false;
}
public static class SpecificationEvaluator
{
public static IQueryable<T> Apply<T>(IQueryable<T> q, Specification<T> spec) where T : class
{
if (spec.AsNoTracking) q = q.AsNoTracking();
if (spec.Criteria is not null) q = q.Where(spec.Criteria);
q = spec.Includes.Aggregate(q, (cur, inc) => cur.Include(inc));
if (spec.OrderBy is not null) q = q.OrderBy(spec.OrderBy);
if (spec.Skip is not null) q = q.Skip(spec.Skip.Value);
if (spec.Take is not null) q = q.Take(spec.Take.Value);
return q;
}
}
public class ActiveOrdersForCustomer : Specification<Order>
{
public ActiveOrdersForCustomer(Guid customerId)
{
Where(o => o.CustomerId == customerId && o.Status == OrderStatus.Active);
Include(o => o.Lines);
Order(o => o.CreatedAt);
}
}
var orders = await SpecificationEvaluator
.Apply(db.Orders, new ActiveOrdersForCustomer(id)).ToListAsync(ct);
Criteria compiles to the right predicate) and composable.AsNoTracking the default for read specs (opt into tracking explicitly)."Add the specification pattern", "dedupe these repeated EF queries into specs", "make my query criteria reusable and testable". Pairs with ef-core-query-optimizer.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
specification-pattern, ef-core, query-reuse, linq, repository-pattern
/dotnet-ai-toolkit:specification-pattern-generatorfrom TheCodeMan .NET AI ToolKit
npx claudepluginhub stefanthecode/dotnet-ai-toolkit --plugin dotnet-ai-toolkit49 skills in this plugin
/adonet-data-access-auditorAudit and fix classic ADO.NET data-access code (SqlConnection / SqlCommand / SqlDataReader / DataSet) on .NET Framework. Use this skill whenever the user shares raw ADO.NET code, a DAL / repository built on SqlCommand, stored-proc calls, string-concatenated SQL, or mentions SQL injection, parameterized queries, connection leaks, "using / Dispose", reading the same column multiple times, transactions, or "why does my old data layer leak connections / is it safe". Always use this skill for classic ADO.NET review instead of answering from memory; it applies a fixed security + correctness + performance checklist and rewrites the code./async-await-auditorAudit C#/.NET code for async/await anti-patterns and concurrency bugs. Use this skill whenever the user shares async C# code or asks about deadlocks, async void, .Result/.Wait(), blocking calls, ConfigureAwait, sync-over-async, fire-and-forget tasks, CancellationToken usage, or "why does my async code hang/deadlock". Always use this skill for async correctness/performance reviews instead of answering from memory; it applies a fixed checklist and rewrites the code./authorization-policy-generatorDesign ASP.NET Core authorization — policy-based, role-based, and claims/requirement-based with custom authorization handlers and resource-based checks. Use this skill whenever the user wants authorization policies, role/claim checks, custom AuthorizationHandler, resource-based authorization, permission checks, or asks "how do I authorize this / policy vs role / restrict this endpoint to X". Always use this skill for authorization requests; it generates policies, handlers, and endpoint wiring.Other plugins' skills for the same job