一键导入
smart-detect
Use when detecting .NET project type, architecture pattern, or solution structure.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when detecting .NET project type, architecture pattern, or solution structure.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when designing gRPC services, proto files, or adding gRPC-Web or JSON transcoding.
Use when writing async code, propagating CancellationTokens, or fixing async/await pitfalls.
Use when applying or enforcing C# coding style — namespaces, sealed classes, var usage, XML docs.
Use when applying modern C# idioms — records, pattern matching, primary constructors, collection expressions.
Use when registering services, choosing lifetimes, or implementing DI patterns like decorator or keyed services.
Use when selecting or implementing design patterns in C# — factory, builder, strategy, decorator, or mediator.
基于 SOC 职业分类
| name | smart-detect |
| description | Use when detecting .NET project type, architecture pattern, or solution structure. |
| metadata | {"category":"detection"} |
| when_to_use | When detecting project architecture type or analyzing .NET project structure |
You are analyzing a .NET project to determine its architectural type using behavioral analysis.
You will receive:
Read the following files to build a picture of the project:
Program.cs or Startup.cs — startup configuration*.csproj — NuGet packages, target framework, SDK type*.sln or *.slnx — solution structure**/Application/**/Handlers/**/*.cs or **/Features/**/*Handler.cs**/Controllers/**/*.cs**/Services/**/*Service.cs**/Domain/**/Aggregate*.cs or **/Domain/**/Core/*.cs**/Endpoints/**/*.cs or **/Modules/**/*.csFeatures/ directory — VSA indicatorDomain/, Application/, Infrastructure/ directories — Clean Architecture indicatorBoundedContexts/ or Contexts/ directory — DDD indicatorModules/ directory — Modular Monolith indicatorControllers/ directory — traditional MVC/APIListeners/ or ServiceBus/ directory — event-driven*.razor files — Blazor UIFor each handler/service file, analyze:
IRequestHandler<CreateOrderCommand>)IRequestHandler<Event<OrderCreatedData>, bool>)[HttpGet], [HttpPost], etc.app.MapGet(), app.MapPost(), endpoint definitionsSaveChangesAsync, AddAsync, repository Add/UpdateThese types are for projects following a CQRS/event-sourced microservice architecture:
| Type | IN | INSIDE | OUT |
|---|---|---|---|
| command | Commands | Load aggregate -> domain method -> commit events | void/Task |
| query-sql | Events | Save to SQL database | bool (ack) |
| query-cosmos | Events | Save to Cosmos DB | bool (ack) |
| processor | Events | Call other gRPC services OR publish to message bus | bool (ack) |
| gateway | HTTP requests | Forward to gRPC services | HTTP responses |
| controlpanel | Browser requests | Blazor components render UI | HTML/Blazor |
| hybrid | Commands AND Events | Both domain manipulation AND DB save | Mixed |
These types are for projects following common .NET architectural patterns outside CQRS microservices:
| Type | Key Indicators | Structure | Typical Patterns |
|---|---|---|---|
| vsa | Features/ directory with self-contained slices | Each feature folder contains handler, validator, model, endpoint | MediatR handlers per feature, minimal cross-feature dependencies |
| clean-arch | 3+ layers: Domain, Application, Infrastructure | Separate projects per layer, dependency inversion | Use cases in Application, entities in Domain, repos in Infrastructure |
| ddd | BoundedContexts/ or Contexts/ directory | Bounded contexts with internal layering | Aggregates, value objects, domain events, anti-corruption layers |
| modular-monolith | Modules/ directory with independent modules | Each module has its own API, domain, infrastructure | Module-to-module communication via contracts/events |
| generic | None of the above patterns match | Varies — could be simple API, console app, library | Standard .NET project without strong architectural pattern |
Structure signals:
Features/ or Slices/ directory at project rootApplication/, Domain/, Infrastructure/ top-level layersCode signals:
IRequestHandler<TRequest, TResponse> per featureIValidator<T> paired with handlers in same folderNuGet signals:
MediatR, FluentValidation, Carter or FastEndpointsStructure signals:
*.Domain, *.Application, *.Infrastructure, *.Api (or *.Web, *.Presentation)Code signals:
IRepository<T>, IUnitOfWork)NuGet signals:
MediatR.Contracts only)EntityFrameworkCore, Dapper, provider packagesStructure signals:
BoundedContexts/ or Contexts/ directorySharedKernel/ or BuildingBlocks/ directory for cross-cutting concernsAntiCorruption/ or ACL/ directoriesCode signals:
AggregateRoot or Entity base classes in domainIDomainEvent, DomainEvent)NuGet signals:
Structure signals:
Modules/ directory with independent module directoriesApi/, Core/ (or Domain/), Infrastructure/Contracts/ or IntegrationEvents/ for inter-module communicationInfrastructure/ or Common/ at root levelCode signals:
AddModule<OrderModule>() pattern)NuGet signals:
Use generic when:
Apply rules in order — first match wins:
.razor files exist → controlpanelFeatures/ directory with self-contained feature handlers → vsaBoundedContexts/ or Contexts/ directory with aggregate roots → dddModules/ directory with independent module structure → modular-monolithCRITICAL: project_type is the SPECIFIC type (command, query-sql, vsa, etc.). mode is ALWAYS microservice or generic. Never swap these.
project_type: {command|query-sql|query-cosmos|processor|gateway|controlpanel|hybrid|vsa|clean-arch|ddd|modular-monolith|generic}
mode: {microservice|generic}
confidence: {high|medium|low}
dotnet_version: "{version from csproj TargetFramework}"
architecture: "{human-readable description}"
namespace_format: "{detected namespace pattern}"
evidence:
1. {most important behavioral evidence}
2. {second most important evidence}
3. {third most important evidence}
reasoning: "{1-2 sentences explaining the data flow that led to this classification}"
packages:
- {key NuGet packages detected}
solution_name: "{solution name without extension, from .sln/.slnx file}"
layers:
domain: "{Domain project name or empty}"
application: "{Application project name or empty}"
infrastructure: "{Infrastructure project name or empty}"
presentation: "{Presentation project name or empty}"
api_style: "{grpc|rest|blazor|minimal-api|none}"
patterns:
- "{architectural patterns detected, e.g. cqrs-command-side, event-sourcing, outbox-pattern}"
deployment:
containerized: {true if Dockerfile exists, else false}
orchestration: "{kubernetes if k8s manifests, docker-compose if compose file, else empty}"
test_projects:
- "{test project names from solution}"
sibling_repos:
- name: "{sibling repo directory name}"
type: "{detected type or empty}"
.sln/.slnx filename (strip extension)Grpc.AspNetCore → grpc, Microsoft.AspNetCore.Mvc or controllers → rest, .razor files → blazor, app.MapGet/app.MapPost without controllers → minimal-api../ that are git repos with .NET projects — classify by quick structural scanThis skill depends on the always-on existing-projects convention rule:
The rule is loaded into context whenever this skill is active (FR-011 universal whitelist).