This document provides AI agents with concise, high-signal context about this repository to produce high-quality, maintainable code and helpful developer assistance. It complements .github/copilot-instructions.md with a broader perspective on architecture, patterns, workflows, and conventions.
This project consumes the bITdevKit (BDK) exclusively via NuGet packages (BridgingIT.DevKit.*).
All official bITdevKit (BDK) documentation is located in .bdk/docs/.
Core Rule:
Always base your answers about bITdevKit on the documentation in .bdk/docs/. Never guess, invent, or extrapolate bITdevKit behavior.
Routing Strategy (Mandatory):
For any request involving the bITdevKit (BDK), follow this process:
- First read
.bdk/docs/INDEX.md. - Treat
.bdk/docs/INDEX.mdexclusively as a routing table / feature map. - Use it to identify the exact documentation file that contains the relevant information.
- Read that specific file from the
.bdk/docs/folder. - Also consult the XML documentation on the public classes, interfaces, extension methods, and behaviors from the installed bITdevKit NuGet packages.
Priority Order for bITdevKit topics:
.bdk/docs/INDEX.md(pure routing table – read first on bITdevKit requests)- The specific file in
.bdk/docs/referenced by the index - XML documentation embedded in the bITdevKit assemblies
The project heavily uses the bITdevKit — always consult the documentation in .bdk/docs/ first.
- Name: bITdevKit GettingStarted Example
- Purpose: Demonstrates a modular, Domain-Driven Design (DDD) application using the bITdevKit on .NET 10.
- Primary Domain Concept: Customer management lifecycle (create, update, list, delete, export job).
- Architecture: Onion / Clean Architecture + Modular vertical slices (Domain, Application, Infrastructure, Presentation, Tests). Full details in ARCHITECTURE.md.
- Runtime: ASP.NET Core minimal APIs, EF Core (SQL Server), Serilog.
- Modules: Located under
src/Modules/<ModuleName>(e.g.,CoreModule). Each module is self-contained. - Host: Composition root in
src/Presentation.Web.Server(Program.cs, DI wiring, middleware). - Testing: Unit tests in
tests/UnitTests, integration tests intests/IntegrationTests. - Development Workflow: Described in README.md and reinforced in this document.
- Generate concise, idiomatic C# 10+ (.NET 10) code following DDD and clean architecture.
- Respect layering boundaries and module isolation; avoid cross-layer leakage.
- Prefer repository abstractions and specifications over direct DbContext access in Application code.
- Use existing bITdevKit features (requester, notifier, pipeline behaviors) instead of re-inventing infrastructure.
- Produce testable changes with unit/integration tests where meaningful.
IMPORTANT: This project uses Agent Skills to provide specialized, standardized workflows for common tasks.
- ALWAYS check for and use available skills when the user's request matches a skill's description.
- Skills are located in
.agents/skills/directories. - Each skill provides a tested, standardized approach to specific tasks.
- Using skills ensures consistency, follows best practices, and reduces errors.
- Use the
find-skillsskill to discover available skills when you're unsure which skill applies to your task.
- When a user request explicitly matches a skill's purpose (e.g., "commit changes" → use
git-commitskill) - When performing tasks that have established workflows (e.g., adding aggregates, reviewing code)
- Before manually implementing any workflow, check if a skill exists for it
- Default to using skills over ad-hoc manual approaches
- First: Check if a skill exists for the task
- Second: Load and follow the skill's workflow
- Last Resort: Only use manual approaches when no skill exists
This ensures all agents follow the same high-quality, tested patterns that the project relies on.
- Use conventional commit format: type(scope): description
- Use imperative mood: 'Add feature' not 'Added feature'
- Keep subject line under 50 characters
- Use types: feat, fix, docs, style, refactor, perf, test, chore, ci
- Include scope when relevant (e.g., api, ui, auth, docs, frontend, backend, database, config)
- Reference issue numbers with # prefix
When committing changes:
Commit messages should follow:
type: short description
Examples
feat: implement task creation use case
fix: correct repository filtering behavior
test: add domain tests for task status transitions
- Please follow the rules in .editorconfig.
- Language: C# 10+; file-scoped namespaces.
- Style: Follow C# Coding Conventions; descriptive names; expressive syntax (null-conditional, string interpolation).
- Types: Use
varwhen type is obvious; prefer records, pattern matching, null-coalescing assignment. - Naming:
- PascalCase for classes, methods, public members.
- camelCase for locals/private fields; prefix interfaces with
I(e.g.,IUserService). - Constants in UPPERCASE.
- Use
this.for fields.
- Validation & Errors: Prefer
Result<T>for recoverable failures; exceptions only for exceptional cases. Use FluentValidation for inputs. - Async: Use
async/awaitfor I/O-bound operations. - LINQ: Prefer efficient LINQ; avoid N+1 queries.
- Nullability: Project uses disabled nullability annotations; maintain consistency.
- Frameworks: ASP.NET Core minimal API, EF Core (SQL Server), Mapster, Serilog, Quartz, FluentValidation.
- bITdevKit: Requester/Notifier, repositories, startup tasks, job scheduling, module infrastructure.
- Testing: xUnit, NSubstitute, Shouldly; WebApplicationFactory for integration.
- Domain: Aggregates, Value Objects, Enumerations, Domain Events, Business Rules. No references to outer layers.
- Application: Commands/Queries, Handlers, DTO models, Specifications. References Domain only; do not reference Infrastructure/Presentation.
- Infrastructure: EF Core DbContext/configurations, repositories, jobs, startup tasks. May reference Domain & Application; expose abstractions.
- Presentation: Minimal API endpoints, module registration, mapping profiles; references Application (and Domain types as needed for mapping).
- Host: Server project wiring, middleware (Serilog, correlation, problem details, swagger).
- Commands:
[Entity][Action]Command(e.g.,CustomerCreateCommand). - Queries:
[Entity][Action]Query(e.g.,CustomerFindAllQuery). - Handlers:
[Entity][Command|Query]Handlerco-located with commands/queries. - Domain Events:
[Entity]<PastTenseEvent>DomainEvent. - Value Objects: Singular descriptive (e.g.,
EmailAddress). - Enumerations:
Enumerationderivative with PascalCase static instances.
- Use Mapster via
services.AddMapping().WithMapster<CoreModuleMapperRegister>(). - Define mappings in the module-specific
MapperRegisterclass; avoid ad-hoc inline mapping in handlers.
- Use
AddSqlServerDbContext<T>with connection string from module config. - Register repositories via
AddEntityFrameworkRepository<TEntity, TDbContext>()and chain behaviors (logging, audit, domain events). - Application handlers must depend on repository abstractions, not the DbContext.
- Typical pipeline:
ModuleScopeBehavior->ValidationPipelineBehavior->RetryPipelineBehavior->TimeoutPipelineBehavior. - Add new behaviors only for justified cross-cutting concerns.
- Use tasks defined in the workspace to build, test, and manage EF:
- Build:
Solution [build] - Format:
Solution [format apply] - Tests:
Tests [unit all],Tests [integration all] - Coverage:
Coverage [all -> html] - EF Migrations:
EF [migration add],EF [apply migrations],EF [update database] - Docker:
Docker [build & run],Docker [compose up]
- Build:
- Prefer these tasks over custom scripts to maintain consistency.
- Containers are supported via Docker. Compose files and scripts exist in the repo.
- When adding cloud-related code (e.g., Azure), follow the Azure best practices guidance in
azure.instructions.md(extension resource). Do not assume AKS/Terraform unless explicitly requested. - Publishing: use Server publish tasks (
Server [publish],Server [publish release]) when needed. - For bITdevKit patterns and module infrastructure, always consult the documentation in
.bdk/docs/.
- Use Serilog with structured logging.
- Include correlation via
app.UseRequestCorrelation(); propagateCorrelationIdin logs and context. - Avoid logging sensitive PII; use structured templates (e.g.,
logger.LogInformation("Customer {CustomerId} created", customer.Id);).
- Validate all external input via FluentValidation + Domain guard rules.
- Keep domain pure; avoid external calls in value objects/entities.
- Plan for future authn/authz; design endpoints to allow attribute-based constraints.
- Use Markdown for docs located under
/docs/. - Keep
README.mdupdated for setup steps. - Update module
READMEfiles (e.g.,CoreModule-README.md) when adding features.
The project maintains comprehensive ADRs documenting key architectural decisions. Reference these when working on related features.
See docs/adr/INDEX.md for the complete list and ADR creation guidelines.
- Common functionality is organized per module; avoid cross-module duplication.
- Use repository abstractions and specifications rather than duplicating query logic.
- Mapping configurations live in each module’s
MapperRegister.
- Unit tests: focus on handlers, domain logic, rules, mapping.
- Integration tests: use WebApplicationFactory; exercise endpoints and persistence.
- Architecture tests: enforce layering boundaries.
- Prefer
Result<T>assertions and repository test doubles/mocks (NSubstitute) for application layer tests.
- Branch naming:
feature/<area>-<short-description>,fix/<issue>,chore/<task>. - Small, focused PRs; follow existing folder structure and naming conventions.
- Include tests and docs updates where applicable.
- Avoid unrelated formatting changes; use
Solution [format apply]for targeted formatting.
When asking Copilot to implement something, include:
- Target module (e.g.,
CoreModule). - Layer scope (Domain vs Application vs Presentation).
- Persistence & migrations requirements.
- Mapping + validation needs.
- Endpoint shape (HTTP verb, route, request/response DTO).
Example prompt:
Add a new command/query pair to CoreModule to deactivate a Customer (sets Status=Retired). Include validator, handler retry/timeout attributes, endpoint (PUT /api/core/customers/{id:guid}/deactivate), and unit tests.
- Do: Keep domain purity; use existing extension methods and pipeline behaviors; co-locate validators/handlers; prefer
Result<T>; follow naming + folder conventions. - Don’t: Introduce circular references; access DbContext directly in Application; leak infrastructure to Presentation; add static mutable state; use reflection-heavy hacks.
/ (root)
./github/copilot-instructions.md
AGENTS.md
ARCHITECTURE.md
CHANGELOG.md
BDK_KNOWLEDGE_BASE.md
README.md
docs/
adr/
INDEX.md
INDEX.md
...
.bdk/docs/
INDEX.md
...
This AGENTS.md reinforces and summarizes the rules found in .github/copilot-instructions.md. Agents should treat that file as authoritative for architectural boundaries, naming and module practices.