victorzhuk/skills

z-dotnet-core

C/ASP.NET Core web APIs for inherited and green services — minimal APIs, nullable reference types as errors, dependency injection, EF Core AsNoTracking reads, async all the way.

Voir la source

Mode d’emploi

  1. Copiez la commande et examinez le paquet avant de l’installer dans votre environnement agent.
  2. Consultez le document original pour les outils, identifiants et environnements requis.
  3. Décrivez les entrées et le livrable souhaité ; comparez la sortie aux sources.
npx skills add https://github.com/victorzhuk/skills --skill z-dotnet-core

Avant de commencer

  • L’installation n’inclut ni abonnement au modèle, ni quota API, ni accès aux fichiers.
  • Étoiles et installations reflètent l’activité, pas un test indépendant de qualité ou de sécurité.
Document Skill original

Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.

.NET core

Default to minimal APIs for a new small service, controllers only where the codebase already committed to them — don't migrate an inherited controller app just to match a green one.

Target framework

  • Select a supported LTS from Microsoft's current support policy for new services. Preserve the target of an inherited application unless an upgrade is in scope.
  • verify against the actual global.json/.csproj TargetFramework before assuming a version — an inherited codebase may sit on an out-of-support release

API style

  • minimal APIs (MapGet/MapPost on WebApplication) for small, focused services — less ceremony, faster to read top to bottom
  • controllers where the codebase already has them — don't rewrite a working controller-based API to minimal APIs on style preference alone
  • nullable reference types enabled (<Nullable>enable</Nullable>) with warnings treated as errors — this is what makes a null a compile-time signal instead of a runtime surprise

Dependency injection

  • Use constructor injection for services and supported handler-parameter injection for minimal APIs. Do not hide dependencies behind IServiceProvider.GetService in business logic.
  • register lifetimes deliberately: Scoped for anything touching a DbContext or per-request state, Singleton only for genuinely stateless or thread-safe services, Transient for cheap short-lived instances

EF Core discipline

  • review every migration before it ships — a generated migration can silently drop a column or add a non-nullable one without a default on a populated table
  • AsNoTracking() on read-only queries — skips change-tracking overhead for data that's never saved back
  • no lazy-loading surprises: either disable lazy loading and Include() explicitly, or know exactly which navigation properties trigger N+1 queries on access
  • LINQ readable over clever — a query that reads like the SQL it produces is easier to review than one showing off Aggregate/SelectMany chains

Async

  • Keep asynchronous I/O asynchronous through the endpoint. Blocking on .Result or .Wait() can cause thread-pool starvation; ASP.NET Core does not install the classic ASP.NET synchronization context.
  • thread a CancellationToken through to DB/HTTP calls that support it, sourced from the request's own token

Testing

  • xUnit as the default test framework
  • WebApplicationFactory<T> for API-level tests against the real DI graph and middleware pipeline, not just isolated handler unit tests

Do not

  • grow god controllers — a controller accumulating unrelated endpoints is a decomposition signal, not a place to keep adding [HttpPost] methods
  • sync-over-async (.Result, .Wait(), .GetAwaiter().GetResult() on a hot path) — thread-pool starvation and deadlocks follow
  • use DateTime.Now for anything that becomes business logic or gets tested — use DateTime.UtcNow, or inject TimeProvider (built into .NET 8+) so tests can control time
  • catch Exception broadly at a layer that isn't the outermost error boundary — it swallows bugs a narrower catch or the framework's own exception handling would surface

Verify

  • dotnet build -warnaserror
  • Use the existing test wrapper with a whole-process deadline and the selected runner's supported timeout and parallelism limits; see [[z-testing-strategy]]. Discover the runner before choosing flags.
  • dotnet format --verify-no-changes
du même dépôt

Autres Skills

Tous les Skills
victorzhuk
Communauté

z-accessibility

Audit and improve web accessibility following WCAG 2.2 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible".

installations
1
GitHub Stars
0
Mis à jour
22 oct.
victorzhuk
Communauté

z-algo-core

DS/algorithm selection judgment for production code, not competitive tricks — hash map for membership/dedup, slice+sort beats a tree until proven, heap for top-k, two-pointer/sliding-window for scans, BFS/DFS/topo-sort for dependency shapes. Triggers on Big-O, hash map vs tree. Does not cover profiling/tuning; see [[z-go-performance]].

installations
1
GitHub Stars
0
Mis à jour
22 oct.
victorzhuk
Communauté

z-bdd

BDD acceptance contracts for humans and agents across UI, API, and CLI products. Use for Gherkin, Given-When-Then, E2E acceptance, or scenario evidence. Define repeatable scenarios with explicit assertions and required outcomes. Test selection belongs to [[z-testing-strategy]]. Go harness wiring belongs to [[z-go-bdd]].

installations
1
GitHub Stars
0
Mis à jour
22 oct.
victorzhuk
Communauté

z-codegraph

Use an existing CodeGraph integration for call graphs, impact analysis, affected tests, or route discovery. Discover installed tools and index freshness; follow host LSP precedence and verify current source. Do not initialize indexes without user authorization.

installations
1
GitHub Stars
0
Mis à jour
22 oct.