.claude/skills/auth-standards/SKILL.md
Use when working with authentication, authorization, OAuth, JWT, identity, RBAC, claims, or secrets management in .NET projects. Provides domain-specific rules layered on top of base architectural standards.
npx skillsauth add klod68/littlerae auth-standardsInstall 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.
| Field | Value |
|---|---|
| Name | Authentication & Authorization Standards |
| Domain | Security, Identity, Access Control |
| Level | Feature |
| Tags | auth, jwt, oauth, identity, rbac, claims |
Activate this skill when the task involves:
These rules layer on top of base architectural standards. On conflict, these win.
<!-- SHARED:rules/auth.md -->Apply these rules in addition to _base.md for projects using authentication or authorization.
Program.cs using AddAuthentication with explicit default scheme.Issuer, Audience, Lifetime, and IssuerSigningKey.HttpOnly = true, Secure = true, SameSite = Strict (or Lax for OAuth flows).appsettings.json or source code.id_token claims: iss, aud, exp, nonce.localStorage (use httpOnly cookies or BFF pattern).AddOpenIdConnect with explicit Authority, ClientId, ResponseType = "code", and SaveTokens = true.[Authorize(Policy = "CanEditOrders")] over [Authorize(Roles = "Admin")].Program.cs using AddAuthorizationBuilder with explicit requirements.IAuthorizationService and call AuthorizeAsync with the resource.[AllowAnonymous] deliberately and sparingly — document why each anonymous endpoint is safe.ClaimsPrincipal — never parse tokens manually in application code.public static class AppClaims { public const string TenantId = "tenant_id"; }.IClaimsTransformation — keep application code provider-agnostic.appsettings.json, *.cs, *.yml, or .env files.dotnet user-secrets (Secret Manager)..gitignore: appsettings.Development.json, appsettings.Local.json, .env, secrets.json.| Anti-Pattern | Fix |
|---|---|
| HS256 with short symmetric key in config | Use RS256 with asymmetric key from Key Vault |
| Secrets in appsettings.json committed to VCS | Use user-secrets (dev) or Key Vault (prod) |
| [Authorize] without specifying policy | Define explicit policy: [Authorize(Policy = "...")] |
| Checking User.IsInRole("Admin") in action body | Create authorization policy with RequireRole or custom requirement |
| localStorage.setItem("token", jwt) | Use httpOnly cookie or BFF pattern |
| Missing ValidateLifetime = true in JWT config | Always validate token expiration |
| Implicit flow for SPA | Use Authorization Code + PKCE |
| Parsing JWT manually with JwtSecurityTokenHandler | Use ClaimsPrincipal from HttpContext.User |
| Global [Authorize] without [AllowAnonymous] on health/status | Explicitly mark health endpoints as anonymous |
api-design.md — RESTful conventions, HTTP methods, pagination, error responsesminimal-api.md — Minimal API endpoint organization, handlers, filters, validationblazor.md — Blazor component design, state management, parameters, routingsignalr.md — SignalR hub design, groups, streaming, authorizationtools
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.