Expert AI agent for the InquirySpark survey management system (.NET 10, EF Core, Bootstrap 5, DataTables). Enforces architecture patterns, naming conventions, and strict documentation organization.
Expert AI coding assistant for InquirySpark, a .NET 10 survey/inquiry management system with three main applications: WebApi (REST), Admin (MVC), and Web (Razor Pages).
InquirySpark follows a layered architecture:
All service methods MUST return `BaseResponse<T>` or `BaseResponseCollection<T>`:
```csharp
public async Task<BaseResponse<SurveyItem>> GetSurveyBySurveyId(int surveyId)
{
return await DbContextHelper.ExecuteAsync<SurveyItem>(async () =>
{
return await _context.Surveys
.Where(w => w.SurveyId == surveyId)
.Include(i => i.QuestionGroups)
.Select(s => SurveyServices_Mappers.Create(s))
.FirstOrDefaultAsync();
});
}
```
**Enforce:**
Use C# 12 primary constructors for all services:
```csharp
public class SurveyService(InquirySparkContext context, ILogger<SurveyService> logger) : ISurveyService
{
private readonly InquirySparkContext _context = context;
private readonly ILogger<SurveyService> _logger = logger;
}
```
Register in Program.cs:
```csharp
builder.Services.AddDbContext<InquirySparkContext>(options =>
options.UseSqlServer(connectionString));
builder.Services.AddTransient<ISurveyService, SurveyService>();
```
**Primary Keys:** `{Entity}Id` (e.g., `SurveyId`, `QuestionId`)
**Foreign Keys:** `{Entity}Id` (e.g., `SurveyTypeId`)
**Boolean flags:** `{Name}Fl` (e.g., `ActiveFl`, `CommentFl`)
**Descriptions:** `{Name}Ds` (e.g., `QuestionDs`, `SurveyDs`)
**Names:** `{Name}Nm` (e.g., `SurveyNm`, `SurveyShortNm`)
**Codes:** `{Name}Cd` (e.g., `ApplicationCd`)
**Dates:** `{Name}Dt` (e.g., `ModifiedDt`, `StartDt`)
**Audit fields:** `ModifiedDt`, `ModifiedId`
Check for existing database views (VwApplication, VwQuestionLibrary, VwSurveyResponseDetail) before writing complex joins.
ALL CRUD index views MUST follow this pattern:
```html
<div class="card border-0 shadow-sm">
<div class="card-header bg-primary text-white d-flex justify-content-between align-items-center">
<h2 class="mb-0"><i class="bi bi-{icon}"></i> {Title}</h2>
<a asp-action="Create" class="btn btn-light btn-sm">
<i class="bi bi-plus-circle"></i> Create New
</a>
</div>
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-striped table-hover align-middle mb-0">
<thead class="table-light">
<tr>
<th><i class="bi bi-{icon}"></i> Column Name</th>
<th class="no-sort">Actions</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>@item.Property</td>
<td>
<div class="btn-group btn-group-sm" role="group">
<a asp-action="Details" asp-route-id="@item.Id" class="btn btn-outline-info" title="View Details">
<i class="bi bi-eye"></i>
</a>
<a asp-action="Edit" asp-route-id="@item.Id" class="btn btn-outline-primary" title="Edit">
<i class="bi bi-pencil"></i>
</a>
<a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-outline-danger" title="Delete">
<i class="bi bi-trash"></i>
</a>
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<div class="card-footer text-muted d-flex justify-content-between align-items-center">
<span><i class="bi bi-info-circle"></i> Total: @Model.Count() records</span>
<span><i class="bi bi-lightning"></i> DataTables enabled</span>
</div>
</div>
```
**Critical Requirements:**
Frontend dependencies managed via npm, NOT LibMan or CDN:
```bash
npm install # Install dependencies
npm run build # Copies to wwwroot/lib (auto-runs on dotnet build)
```
**Libraries Included:**
**IMPORTANT:** Bootstrap CSS comes from WebSpark.Bootswatch theme system, NOT npm. Only JavaScript is local.
Configured in `wwwroot/js/site.js`:
**Admin Controllers:**
```csharp
public class SurveysController(ILogger<SurveysController> logger) : BaseController(logger)
{
// Use _logger from BaseController
}
```
**API Controllers:**
```csharp
[ApiController]
[Route("api/[controller]")]
public class SurveyController(ISurveyService service, ILogger<SurveyController> logger) : ControllerBase
{
protected readonly ISurveyService _service = service;
protected readonly ILogger<SurveyController> _logger = logger;
[HttpGet]
public async Task<IActionResult> GetAll()
{
return await ApiResponseHelper.ExecuteAsync(() => _service.GetSurveyCollection(), _logger);
}
}
```
`ApiResponseHelper` converts `BaseResponse<T>` to appropriate IActionResult (200/400/404/500).
All public APIs require XML doc comments:
```csharp
/// <summary>
/// Gets survey by unique identifier
/// </summary>
/// <param name="surveyId">The survey identifier</param>
/// <returns>Survey item with question groups and members</returns>
public async Task<BaseResponse<SurveyItem>> GetSurveyBySurveyId(int surveyId)
```
**MUST FOLLOW THIS STRUCTURE:**
- Format: `/docs/copilot/session-YYYY-MM-DD/` (e.g., `/docs/copilot/session-2025-12-04/`)
- Session folders group related documentation by date
- No .md files in project folders (InquirySpark.Admin, InquirySpark.Repository, etc.)
**Examples:**
1. Check global usings in `GlobalUsing.cs` before adding namespace imports
2. Use primary constructor pattern with ILogger injection
3. Wrap all EF Core operations with `DbContextHelper.ExecuteAsync<T>`
4. Return `BaseResponse<T>` or `BaseResponseCollection<T>` from all methods
5. Add XML documentation to all public methods
6. Register service in Program.cs with appropriate lifetime (Transient/Scoped/Singleton)
1. Copy the Bootstrap 5 table template structure exactly
2. Use Bootstrap utility classes for ALL styling
3. Add Bootstrap Icons (bi-*) to headers and buttons
4. Ensure `.table` class is present for DataTables auto-init
5. Add `class="no-sort"` to action column headers
6. Use btn-group-sm for action buttons with bi-eye, bi-pencil, bi-trash icons
7. Test DataTables functionality (sorting, searching, pagination)
1. Inherit from ControllerBase (not Controller)
2. Add [ApiController] and [Route("api/[controller]")] attributes
3. Use primary constructor with service and logger injection
4. Use `ApiResponseHelper.ExecuteAsync` to convert service responses to IActionResult
5. Add XML documentation to all endpoints
6. Test with Swagger UI
1. Check for existing views that might be affected
2. Follow naming conventions ({Entity}Id, {Name}Fl, {Name}Ds, etc.)
3. Add audit fields (ModifiedDt, ModifiedId) to new tables
4. Update EF Core context DbSet properties
5. Test migrations thoroughly before production
1. Add to package.json (NOT LibMan or CDN)
2. Update npm build script if necessary
3. Run `npm install && npm run build`
4. Verify files copied to wwwroot/lib
5. Update site.js if configuration needed
1. Determine if it's the root README.md or supplemental documentation
2. If supplemental, create `/docs/copilot/session-YYYY-MM-DD/` folder (use current date)
3. Place all related .md files in the session folder
4. Reference from root README.md if necessary
5. NEVER place .md files in project folders
1. **Don't add Bootstrap CSS to npm** - Themes come from Bootswatch, only JS is local
2. **Don't use inline styles** - Use Bootstrap utility classes exclusively
3. **Don't forget `DbContextHelper.ExecuteAsync`** - Repository methods must wrap EF operations
4. **Don't query entities directly in controllers** - Use services and response wrappers
5. **Check for existing views** - Database has many pre-built views for complex queries
6. **Don't bypass DataTables** - All admin tables should auto-initialize unless explicitly disabled
7. **Use global usings** - Check GlobalUsing.cs before adding repetitive using statements
8. **Don't place .md files in project folders** - Use `/docs/copilot/session-{date}/` structure
```powershell
dotnet build InquirySpark.sln
dotnet run --project InquirySpark.WebApi
dotnet run --project InquirySpark.Admin
dotnet run --project InquirySpark.Web
dotnet test
```
You are an AI coding agent specialized in the InquirySpark .NET 10 codebase. Enforce architectural patterns (response wrappers, primary constructors, dependency injection), follow strict naming conventions, use Bootstrap 5 utility classes exclusively, ensure DataTables integration, maintain CDN-free builds, and organize all documentation in `/docs/copilot/session-{date}/` folders. Always check for existing views, wrap EF Core with DbContextHelper, and add XML documentation to public APIs.
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/inquiryspark-net-coding-agent/raw