- Resolve Python 3.11+ through shared Resolve-Python.ps1/resolve-python.sh, which probe python, python3 and py -3 and skip the Windows Store alias. Build and capability checks fail early with an actionable message; doctor reports missing Python and the skipped hooks. - Fix check-capabilities.sh comparing only the major version. - Register Validate-CommandSafety as a PreToolUse hook for Claude and Codex; shared logic in command-safety.py catches rm -rf variants, git reset --hard, git clean -f, Remove-Item -Recurse, del/rd /s /q and nested shells. - Replace duplicated placeholder chains in both builds with adapters/placeholders.tsv. - Restore shell parity: add test-capabilities.sh, rename credentials.ps1 to with-credential.ps1 and qmd-warm.sh to start-qmd-warm.sh. - CI: build once and pass generated/ as an artifact, lint Python with ruff and JavaScript modules with node --check, require SHA pins for all actions. - Add evals for all own skills and update documentation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
4.6 KiB
JSON
48 lines
4.6 KiB
JSON
{
|
|
"skill_name": "efcore-review",
|
|
"evals": [
|
|
{
|
|
"id": 1,
|
|
"prompt": "Review this EF Core 8 code (SQL Server provider):\n\n```csharp\npublic async Task<List<OrderSummary>> GetRecentOrders(Guid tenantId)\n{\n var orders = _db.Orders.ToList()\n .Where(o => o.TenantId == tenantId && o.CreatedAt > DateTime.UtcNow.AddDays(-30));\n var result = new List<OrderSummary>();\n foreach (var o in orders)\n {\n var lines = await _db.OrderLines.Where(l => l.OrderId == o.Id).ToListAsync();\n result.Add(new OrderSummary(o.Id, lines.Sum(l => l.Price * l.Quantity)));\n }\n return result;\n}\n```",
|
|
"expected_output": "Should flag that ToList() materializes the entire Orders table before filtering, including all tenants' rows, so filters are not applied before materialization. Should flag the N+1 query for OrderLines inside the loop. Should note unnecessary tracking for a read-only summary (AsNoTracking or projection) and the unbounded result set. Should propose a single projected query with the filter and aggregate translated to SQL. Should report the query path, runtime impact, and provider-aware verification (e.g. inspect generated SQL via ToQueryString or logging). Should not recommend indexes without evidence of query need.",
|
|
"assertions": [
|
|
"Flags that ToList() before Where loads the entire Orders table into memory",
|
|
"Notes that rows from all tenants are materialized before tenant filtering",
|
|
"Flags the N+1 query pattern for OrderLines",
|
|
"Recommends a single server-side projected query with filtering and aggregation",
|
|
"Mentions AsNoTracking or projection to avoid unnecessary tracking",
|
|
"Recommends provider-aware verification such as inspecting the generated SQL",
|
|
"Does not recommend adding an index without evidence of need"
|
|
],
|
|
"files": []
|
|
},
|
|
{
|
|
"id": 2,
|
|
"prompt": "Migration review (EF Core 7, PostgreSQL via Npgsql). We deploy with rolling updates; old and new app versions run together for a few minutes.\n\n```csharp\nprotected override void Up(MigrationBuilder mb)\n{\n mb.RenameColumn(name: \"FullName\", table: \"Customers\", newName: \"DisplayName\");\n mb.AlterColumn<string>(name: \"Email\", table: \"Customers\", nullable: false, oldNullable: true);\n}\nprotected override void Down(MigrationBuilder mb) { }\n```",
|
|
"expected_output": "Should flag that renaming FullName breaks the old app version still running during rolling deployment. Should flag that making Email non-nullable fails if existing rows contain NULL and needs a data backfill first. Should flag the empty Down method as a rollback limitation. Should recommend an expand/contract approach (add new column, backfill, switch, later drop) and checking the generated SQL. Report with migration path, data impact, and provider-aware verification.",
|
|
"assertions": [
|
|
"Flags the column rename as incompatible with the old app version during rolling deployment",
|
|
"Flags that AlterColumn to non-nullable fails or loses data if existing rows have NULL Email",
|
|
"Recommends backfilling Email before enforcing NOT NULL",
|
|
"Flags the empty Down method as a rollback limitation",
|
|
"Recommends an additive expand-and-contract migration sequence",
|
|
"Recommends reviewing the generated SQL for PostgreSQL"
|
|
],
|
|
"files": []
|
|
},
|
|
{
|
|
"id": 3,
|
|
"prompt": "Small query, can you review it? EF Core 8, SQL Server.\n\n```csharp\nvar customer = await _db.Customers\n .AsNoTracking()\n .Where(c => c.Id == id && c.TenantId == currentTenant.Id)\n .Select(c => new CustomerDto(c.Id, c.Name, c.Email))\n .SingleOrDefaultAsync(ct);\n```\nAlso, should we add Redis caching and an index on Name to make it faster?",
|
|
"expected_output": "This query is well formed: filtered server-side, tenant-scoped, projected, no tracking, cancellation passed. Should state no concrete defects. Should not recommend Redis caching or an index on Name without evidence of a query need (Name is not used in the filter; Id is presumably the primary key). May suggest measuring first if there is a performance concern.",
|
|
"assertions": [
|
|
"States that no concrete defect was found in the query",
|
|
"Acknowledges the tenant filter is applied server-side",
|
|
"Does not recommend an index on Name, noting Name is not part of the filter or that there is no evidence of need",
|
|
"Does not recommend Redis caching without evidence of a performance need",
|
|
"Suggests measurement or evidence before optimization if performance is a concern"
|
|
],
|
|
"files": []
|
|
}
|
|
]
|
|
}
|