fix(config): resolve Python reliably, add command-safety hook, harden CI
- 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>
This commit is contained in:
1 parent
e19aa2e27c
commit
79694fbaa2
95 files changed
+1838
-218
No files matched your search
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"skill_name": "api-review",
|
||||
"evals": [
|
||||
{
|
||||
"id": 1,
|
||||
"prompt": "Review this new endpoint:\n\n```csharp\n[Authorize]\n[HttpGet(\"/api/documents/{id}\")]\npublic async Task<IActionResult> Get(Guid id)\n{\n var doc = await _db.Documents.FindAsync(id);\n if (doc == null) return NotFound(new { error = $\"Document {id} not found in tenant {doc.TenantId}\" });\n return Ok(doc);\n}\n```\n\nOther endpoints in this API return errors as RFC 7807 `ProblemDetails` and only return DTOs, never entities.",
|
||||
"expected_output": "Should trace the request through authentication, authorization, and data access. Top finding: no tenant or ownership check at the point of data access, so any authenticated user can read any document by id (IDOR). Should flag the NullReferenceException in the not-found branch (doc.TenantId when doc is null) producing a 500 instead of 404. Should flag the inconsistent error shape vs ProblemDetails and returning the entity directly (over-exposure, serialization of navigation properties). Each finding with location, triggering request, consumer impact, and correction. Should distinguish defects from optional suggestions.",
|
||||
"assertions": [
|
||||
"Reports the missing tenant or ownership check as a security defect",
|
||||
"Gives a triggering request such as an authenticated user requesting another tenant's document id",
|
||||
"Flags the null dereference of doc.TenantId in the not-found branch",
|
||||
"Flags the error body as inconsistent with the ProblemDetails contract",
|
||||
"Flags returning the entity instead of a DTO as data exposure or contract risk",
|
||||
"Each finding includes location, impact, and a practical correction",
|
||||
"Lists defects before optional design suggestions"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"prompt": "Contract change for review. Our public OpenAPI spec v1 is consumed by partner integrations.\n\nBefore:\n```yaml\nCustomer:\n properties:\n id: { type: integer }\n email: { type: string }\n phone: { type: string, nullable: true }\n```\nAfter:\n```yaml\nCustomer:\n required: [id, email, phone]\n properties:\n id: { type: integer }\n email: { type: string }\n phone: { type: string }\n createdAt: { type: string, format: date-time }\n```\nThe PR title is \"Tidy up Customer schema\". The generated TypeScript client in `clients/ts` was not regenerated.",
|
||||
"expected_output": "Should compare schemas with existing consumers and the published contract. Should flag that phone is now required and non-nullable, which breaks existing clients that send or receive null and breaks request validation for partners. Should note adding createdAt is additive (likely compatible for responses, but if Customer is also a request body it may become required for writes). Should flag the stale generated client. Should consider versioning for older clients. Should distinguish defects from optional suggestions.",
|
||||
"assertions": [
|
||||
"Flags phone changing from nullable to required non-null as a breaking change for existing consumers",
|
||||
"Explains the impact on partner integrations that send or receive null phone values",
|
||||
"Identifies that adding createdAt is additive or discusses its effect on request bodies",
|
||||
"Flags that the generated TypeScript client was not regenerated",
|
||||
"Recommends a compatibility approach such as keeping phone nullable or versioning the API",
|
||||
"Does not describe the change as a harmless tidy-up"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"prompt": "Can you review the API side of this? We added `POST /api/payments` which charges the card and returns 201. Mobile clients retry automatically on network timeouts. There's no request id or idempotency key in the request. The handler is below:\n\n```ts\nrouter.post('/api/payments', auth, async (req, res) => {\n const { amount, cardToken } = req.body;\n const charge = await psp.charge(cardToken, amount);\n await db.payments.insert({ userId: req.user.id, amount, chargeId: charge.id });\n res.status(201).json({ id: charge.id });\n});\n```",
|
||||
"expected_output": "Should identify the retry/idempotency problem: automatic retries on timeout can create duplicate charges because there is no idempotency key. Should flag missing validation of amount (missing, negative, non-numeric, oversized) and cardToken. Should consider failure between charge and insert (charged but not recorded). Findings with triggering request, impact, and correction (idempotency key header, validation, error handling). Should ensure validation errors do not disclose sensitive data.",
|
||||
"assertions": [
|
||||
"Flags that client retries can produce duplicate charges due to missing idempotency",
|
||||
"Recommends an idempotency key or equivalent deduplication",
|
||||
"Flags missing validation of amount, such as negative, missing, or non-numeric values",
|
||||
"Identifies the failure window where the charge succeeds but the database insert fails",
|
||||
"Each finding includes a triggering request and a practical correction",
|
||||
"Distinguishes confirmed defects from optional design suggestions"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"skill_name": "business-review",
|
||||
"evals": [
|
||||
{
|
||||
"id": 1,
|
||||
"prompt": "Does this change meet the requirement?\n\nRequirement (JIRA SHOP-88): \"Customers with Gold membership get free shipping on orders of 50 EUR or more. Silver members get free shipping from 100 EUR. Everyone else pays shipping.\"\n\nImplementation:\n```ts\nfunction shippingCost(order: Order, customer: Customer): number {\n if (customer.tier === 'gold' && order.subtotal > 50) return 0;\n if (customer.tier === 'silver' && order.subtotal > 100) return 0;\n return standardShipping(order);\n}\n```",
|
||||
"expected_output": "Should identify actors (Gold, Silver, other customers) and acceptance criteria from SHOP-88. Should flag that the implementation uses > instead of >=, so orders of exactly 50 EUR (Gold) or 100 EUR (Silver) are wrongly charged. Should ask about material ambiguity rather than inventing policy, e.g. whether 'order' value means subtotal before or after discounts or including VAT. Should report gaps with affected actor, workflow, evidence, impact, and the decision needed.",
|
||||
"assertions": [
|
||||
"Identifies Gold, Silver, and other customers as the affected actors",
|
||||
"Flags the boundary error where exactly 50 EUR or exactly 100 EUR orders are charged shipping",
|
||||
"Cites the requirement text as evidence for the gap",
|
||||
"Raises the ambiguity of whether the threshold applies to subtotal before or after discounts or VAT as a question",
|
||||
"Does not invent a business rule to resolve that ambiguity",
|
||||
"Each gap names the affected actor and its impact"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"prompt": "Product wants: \"Managers can approve expense reports of their direct reports.\" Here's the PR summary: added an `Approve` button on the expense report page, visible when `currentUser.role === 'Manager'`, and the API `POST /expenses/{id}/approve` checks `user.role == Manager`. Approved reports go to Finance. Does this satisfy the business requirement?",
|
||||
"expected_output": "Should trace the workflow including permissions and handoffs. Should identify that any Manager can approve any report, not only those of their direct reports, which violates the requirement. Should consider related cases: self-approval by a manager on their own report, reports already approved or rejected, a manager whose report changed teams. Should separate stated requirements, observed behavior, and assumptions, and ask about material ambiguity (e.g. may managers approve their own expenses, delegation during absence) rather than inventing policy.",
|
||||
"assertions": [
|
||||
"Flags that the role check allows any manager to approve any report, not only direct reports",
|
||||
"Identifies the self-approval case as a gap or open question",
|
||||
"Considers report states such as already approved or rejected",
|
||||
"Separates the stated requirement from observed behavior",
|
||||
"Asks about ambiguous policy rather than inventing it",
|
||||
"Does not focus on code style or implementation preferences"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"prompt": "Review this change from a business perspective: we renamed the React component `UserProfileCard` to `ProfileCard`, moved it into `components/profile/`, and switched its styling from CSS modules to Tailwind. No visible change in the UI. I personally think the old CSS modules were cleaner.",
|
||||
"expected_output": "There is no stated business requirement or workflow change; the change is a refactor with no visible behavior change. Should state that no business-level gaps are evident or ask what business goal the change was meant to serve. Should not substitute implementation preference (CSS modules vs Tailwind) for business intent. May note that it could not verify the 'no visible change' claim.",
|
||||
"assertions": [
|
||||
"States that no business requirement or user workflow is affected, or asks for the intended business goal",
|
||||
"Does not report the CSS modules versus Tailwind choice as a business gap",
|
||||
"Does not invent business requirements for the refactor",
|
||||
"Notes whether the no-visible-change claim was verified"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"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": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"skill_name": "performance-review",
|
||||
"evals": [
|
||||
{
|
||||
"id": 1,
|
||||
"prompt": "Review this change for performance. It runs on every product page view (~2k req/s at peak); `relatedIds` is typically 20-40 items.\n\n```ts\nasync function getRelatedProducts(relatedIds: string[]) {\n const products = [];\n for (const id of relatedIds) {\n products.push(await productApi.get(id)); // HTTP call, ~15ms p50\n }\n return products.filter(p => p.inStock).sort((a, b) => a.rank - b.rank);\n}\n```",
|
||||
"expected_output": "Should identify the execution path frequency (every page view, 2k req/s) and input size (20-40). Should trace the sequential network calls: 20-40 x ~15 ms = roughly 300-600 ms added latency per request, plus 40-80k outbound calls/s. Should clearly label this as a reasoned estimate, not a measurement. Should propose the smallest useful correction (batch endpoint or bounded parallel requests) and check that ordering and failure behavior are preserved. Should not focus on micro-optimizing the filter/sort of 40 items.",
|
||||
"assertions": [
|
||||
"Identifies sequential awaited HTTP calls in the loop as the main cost",
|
||||
"Estimates added latency in the range of roughly 300 to 600 ms per request from 20-40 calls at 15 ms",
|
||||
"Labels the latency figure as an estimate rather than a measurement",
|
||||
"Considers the outbound call volume at 2k requests per second",
|
||||
"Proposes batching or bounded concurrency as the correction",
|
||||
"Addresses failure or ordering behavior of the proposed change",
|
||||
"Does not recommend optimizing the filter or sort of a few dozen items"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"prompt": "We added an in-memory cache to speed up permission checks:\n\n```csharp\nprivate static readonly Dictionary<Guid, UserPermissions> _cache = new();\n\npublic UserPermissions Get(Guid userId)\n{\n if (!_cache.TryGetValue(userId, out var p))\n {\n p = _repo.Load(userId);\n _cache[userId] = p;\n }\n return p;\n}\n```\nThe service is an ASP.NET Core singleton handling concurrent requests; permissions can be changed by admins at any time. Benchmarks show the check went from 4 ms to 0.01 ms. Ship it?",
|
||||
"expected_output": "Should check whether the cache preserves invalidation and correctness: permission changes are never reflected (no invalidation or expiry), which is a correctness and security risk. Should flag that Dictionary is not thread-safe under concurrent writes from a singleton. Should flag unbounded memory growth with the number of users. Should acknowledge the benchmark as a measured result but note it does not cover correctness or memory growth. Should propose a minimal fix (thread-safe bounded cache with expiry and invalidation on permission change).",
|
||||
"assertions": [
|
||||
"Flags missing invalidation so admin permission changes are not reflected",
|
||||
"Flags that Dictionary is not thread-safe for concurrent writes in a singleton",
|
||||
"Flags unbounded memory growth of the static cache",
|
||||
"Treats the 4 ms to 0.01 ms figure as a measured result while noting it does not prove correctness",
|
||||
"Proposes a bounded, thread-safe cache with expiry or explicit invalidation",
|
||||
"Does not approve shipping as-is"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"prompt": "Performance review please. This runs once at app startup to load 12 feature flags from a config file:\n\n```python\nflags = {}\nfor line in open('flags.txt').read().splitlines():\n k, v = line.split('=')\n flags[k.strip()] = v.strip().lower() == 'true'\n```\nA colleague says we should rewrite it with a compiled regex and a generator for speed.",
|
||||
"expected_output": "Execution frequency is once at startup with 12 lines; cost is negligible. Should say there is no meaningful performance concern and not recommend the micro-optimization, since it lacks plausible user impact. Should not recommend a benchmark because it would not answer a concrete uncertainty. May mention non-performance observations only if clearly separated.",
|
||||
"assertions": [
|
||||
"Identifies that the code runs once at startup on about 12 lines",
|
||||
"Concludes there is no meaningful performance risk",
|
||||
"Does not recommend the compiled regex or generator rewrite for performance",
|
||||
"Does not recommend a benchmark or profiler for this code",
|
||||
"Does not present theoretical concerns as confirmed regressions"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"skill_name": "security-review",
|
||||
"evals": [
|
||||
{
|
||||
"id": 1,
|
||||
"prompt": "Security review this new file-download endpoint (Node/Express). Authenticated users should only download files from their own folder under `/data/uploads/<userId>/`.\n\n```js\napp.get('/download', requireAuth, (req, res) => {\n const file = req.query.name;\n const p = path.join('/data/uploads', req.user.id, file);\n res.sendFile(p);\n});\n```",
|
||||
"expected_output": "Should map the trust boundary (query parameter from an authenticated user) and the resource (filesystem). Should identify path traversal: name=../<otherUserId>/secret.pdf or ../../../etc/passwd escapes the user folder since path.join normalizes '..'. Should build a plausible attack path (attacker capability: any authenticated user; input; missing control: no containment check; impact: read other users' files or server files). Should state severity, preconditions, impact, and a practical fix (resolve the path and verify it stays within the user's base directory, or use sendFile's root option), failing closed. Should separate confirmed vulnerability from defense-in-depth suggestions.",
|
||||
"assertions": [
|
||||
"Identifies path traversal via the name query parameter",
|
||||
"Gives a concrete attack input such as ../ sequences reaching another user's folder or system files",
|
||||
"States the precondition that the attacker only needs to be authenticated",
|
||||
"States severity and impact",
|
||||
"Proposes a fix that resolves the path and verifies it stays inside the user's directory, or uses an equivalent root option",
|
||||
"The fix fails closed by rejecting paths outside the allowed directory",
|
||||
"Separates the confirmed vulnerability from defense-in-depth suggestions"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"prompt": "Can you check this config change for security issues?\n\n```yaml\n# docker-compose.prod.yml\nservices:\n api:\n environment:\n - DB_PASSWORD=Pr0d-S3cret!\n - CORS_ORIGINS=*\n - ASPNETCORE_ENVIRONMENT=Development\n ports:\n - \"0.0.0.0:5432:5432\"\n```\nThis file is committed to the repo.",
|
||||
"expected_output": "Should report evidence-backed findings: hardcoded production database password committed to the repository (secret exposure; requires rotation); database port exposed on all interfaces; ASPNETCORE_ENVIRONMENT=Development in production (likely detailed error pages leaking internals); CORS wildcard (impact depends on credential use; may be defense-in-depth unless credentials allowed). Each with severity, preconditions, impact, and practical fix. Should recommend rotating the leaked secret, not just removing it.",
|
||||
"assertions": [
|
||||
"Flags the committed production DB password as secret exposure",
|
||||
"Recommends rotating the exposed password in addition to removing it from the file",
|
||||
"Flags exposing port 5432 on all interfaces",
|
||||
"Flags running with ASPNETCORE_ENVIRONMENT=Development in production",
|
||||
"Discusses the CORS wildcard and qualifies its impact or classifies it appropriately",
|
||||
"States severity and preconditions for each finding"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"prompt": "Security review this helper. Be thorough, list every possible vulnerability.\n\n```python\nALLOWED_SORT = {'name', 'created_at'}\n\ndef list_projects(conn, user_id: int, sort: str):\n if sort not in ALLOWED_SORT:\n raise ValueError('invalid sort')\n return conn.execute(\n f\"SELECT id, name FROM projects WHERE owner_id = %s ORDER BY {sort}\",\n (user_id,),\n ).fetchall()\n```\n`user_id` comes from the authenticated session, not from the request.",
|
||||
"expected_output": "Despite the request to list every possible vulnerability, should report only evidence-backed findings. The interpolated sort is validated against an allowlist, user_id is parameterized and comes from the session, and results are scoped by owner. Should conclude there is no confirmed vulnerability and not invent attack scenarios. May list defense-in-depth notes separately and clearly labeled.",
|
||||
"assertions": [
|
||||
"Recognizes that sort is validated against an allowlist before interpolation",
|
||||
"Recognizes that user_id is parameterized and sourced from the session",
|
||||
"States that no confirmed vulnerability was found",
|
||||
"Does not report SQL injection as a confirmed vulnerability",
|
||||
"Labels any remaining suggestions as defense-in-depth rather than vulnerabilities"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"skill_name": "ui-ux-review",
|
||||
"evals": [
|
||||
{
|
||||
"id": 1,
|
||||
"prompt": "Review the UX of our new sign-up form:\n\n```html\n<form id=\"signup\">\n <input type=\"text\" placeholder=\"Email\">\n <input type=\"password\" placeholder=\"Password\">\n <div class=\"btn\" onclick=\"submitSignup()\">Create account</div>\n</form>\n<script>\nasync function submitSignup() {\n const r = await fetch('/api/signup', {...});\n if (!r.ok) { document.getElementById('signup').reset(); alert('Error'); }\n}\n</script>\n```\nPassword rules (min 12 chars, one digit) are only enforced server-side.",
|
||||
"expected_output": "Should identify the user goal (create an account) and walk through normal, loading, error, and recovery states. Should flag: placeholders used as the only labels (no accessible names), the div acting as a button (not keyboard-focusable or semantic), the form being reset on error (entered data lost), generic 'Error' alert with no explanation or recovery guidance, password rules not communicated before submission, no loading state or duplicate-submit prevention, and email field type. Each finding tied to a user task with impact and a focused improvement. Should not redesign unrelated parts.",
|
||||
"assertions": [
|
||||
"Flags that inputs lack labels or accessible names because only placeholders are used",
|
||||
"Flags that the div button is not keyboard accessible or semantic",
|
||||
"Flags that resetting the form on error loses the user's entered data",
|
||||
"Flags the generic Error alert as giving no recovery guidance",
|
||||
"Flags that password rules are not shown before submission",
|
||||
"Flags the missing loading or submitting state",
|
||||
"Ties each finding to the sign-up task with impact and a focused fix"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"prompt": "Here's our project list screen description for review: a table of projects; each row has a red trash icon button (no label, no tooltip) that deletes the project immediately on click with no confirmation and no undo. When there are no projects, the table shows only the header row. Other screens in the app (Teams, Clients) use a kebab menu with a \"Delete…\" item that opens a confirmation dialog.",
|
||||
"expected_output": "Should flag prevention of accidental destructive actions: immediate delete without confirmation or undo. Should flag the unlabeled icon button (no accessible name, unclear meaning). Should flag inconsistency with nearby screens' kebab menu and confirmation pattern. Should flag the empty state that gives no guidance on the next action. Should tie each to the user task and propose focused improvements, distinguishing defects from stylistic preferences.",
|
||||
"assertions": [
|
||||
"Flags immediate deletion without confirmation or undo as risking accidental data loss",
|
||||
"Flags the icon-only button for lacking an accessible name or label",
|
||||
"Flags inconsistency with the delete pattern used on the Teams and Clients screens",
|
||||
"Flags the empty state for not guiding the user to the next action",
|
||||
"Proposes focused improvements without redesigning the whole screen",
|
||||
"Distinguishes usability defects from stylistic preferences"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"prompt": "UX review: we changed the primary button color on the Settings page from #2563EB to #1D4ED8 (white text, contrast passes AA either way) and made the corners 6px instead of 4px. While you're at it, feel free to propose a new navigation structure for the whole app.",
|
||||
"expected_output": "The change is purely stylistic with no task impact; contrast remains adequate. Should state that no usability defect was found, distinguishing stylistic preference from defect. Should decline to redesign the app navigation since it is unrelated to the change under review.",
|
||||
"assertions": [
|
||||
"States that no usability defect was found in the color and corner radius change",
|
||||
"Treats any comments on color or radius as stylistic preference, not defects",
|
||||
"Does not propose a new navigation structure for the whole app",
|
||||
"Explains that unrelated redesign is out of scope for this review"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"skill_name": "wpf-review",
|
||||
"evals": [
|
||||
{
|
||||
"id": 1,
|
||||
"prompt": "Review this WPF change:\n\n```csharp\npublic class CustomersViewModel : INotifyPropertyChanged\n{\n public List<Customer> Customers { get; } = new();\n private string _filter;\n public string Filter { get => _filter; set { _filter = value; } }\n\n public ICommand RefreshCommand => new RelayCommand(async () =>\n {\n var data = await Task.Run(() => _service.Load());\n Customers.Clear();\n Customers.AddRange(data);\n });\n public event PropertyChangedEventHandler PropertyChanged;\n}\n```\n```xml\n<TextBox Text=\"{Binding Filtr, UpdateSourceTrigger=PropertyChanged}\"/>\n<ListBox ItemsSource=\"{Binding Customers}\"/>\n<Button Content=\"Refresh\" Command=\"{Binding RefreshCommand}\"/>\n```",
|
||||
"expected_output": "Should trace bindings and change notification: the binding path Filtr is misspelled (silent binding failure), the Filter setter does not raise PropertyChanged, and List<T> does not notify the ListBox of Clear/AddRange (should be ObservableCollection or replaced with notification). Should review the command: async void lambda with no exception handling, no enablement/CanExecute to prevent concurrent refresh, no cancellation, and the command creates a new instance on every get. Should report with view/binding path and user-visible impact and recommend focused WPF verification (e.g. binding error output).",
|
||||
"assertions": [
|
||||
"Flags the misspelled binding path Filtr as a silent binding failure",
|
||||
"Flags that the Filter setter does not raise PropertyChanged",
|
||||
"Flags that List<Customer> does not notify the ListBox of changes and suggests ObservableCollection or equivalent",
|
||||
"Flags missing exception handling in the asynchronous command",
|
||||
"Flags that the Refresh command can run concurrently without enablement control",
|
||||
"Describes the user-visible impact of each finding",
|
||||
"Recommends focused verification such as checking binding errors in the debug output"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"prompt": "Review this dialog code-behind:\n\n```csharp\npublic partial class OrderDetailWindow : Window\n{\n public OrderDetailWindow(OrderViewModel vm, IEventBus bus)\n {\n InitializeComponent();\n DataContext = vm;\n bus.OrderUpdated += OnOrderUpdated;\n _timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) };\n _timer.Tick += (_, _) => vm.Reload();\n _timer.Start();\n }\n private void OnOrderUpdated(object s, OrderEvent e) => StatusText.Text = e.Status;\n}\n```\n`IEventBus` is an application-wide singleton and raises events from background threads. The window is opened many times per session.",
|
||||
"expected_output": "Should check view lifetime and subscriptions: the window subscribes to a singleton event and never unsubscribes, so closed windows remain referenced (leak, stale handlers). The DispatcherTimer is never stopped, keeping the window alive and reloading after close. OnOrderUpdated updates a UI element from a background thread, violating UI-thread affinity (cross-thread exception). Should recommend unsubscribing and stopping the timer on Closed, and marshaling to the Dispatcher. Report with lifecycle path and user-visible impact.",
|
||||
"assertions": [
|
||||
"Flags the event bus subscription that is never removed as a memory leak or stale reference",
|
||||
"Flags the DispatcherTimer that is never stopped after the window closes",
|
||||
"Flags updating StatusText from a background thread as a UI-thread affinity violation",
|
||||
"Recommends unsubscribing and stopping the timer when the window closes",
|
||||
"Recommends marshaling the update to the Dispatcher or UI thread",
|
||||
"Describes user-visible impact such as growing memory or crashes after repeated openings"
|
||||
],
|
||||
"files": []
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"prompt": "WPF review: the diff only adds `AutomationProperties.Name=\"Search customers\"` to an existing icon-only search `Button` in `CustomersView.xaml`. Should we also migrate the whole app to MVVM Toolkit source generators and switch to .NET 9 while we're at it?",
|
||||
"expected_output": "The change is a correct accessibility improvement. Should confirm it with no concrete defects. Should not give framework-wide advice unrelated to the diff, such as migrating to MVVM Toolkit or upgrading .NET. May recommend focused verification such as checking the name with an accessibility inspector or screen reader.",
|
||||
"assertions": [
|
||||
"States that the AutomationProperties.Name addition is appropriate or has no defects",
|
||||
"Does not recommend migrating to MVVM Toolkit source generators as part of this review",
|
||||
"Does not recommend upgrading to .NET 9 as part of this review",
|
||||
"Recommends focused verification such as an accessibility inspector or screen reader check"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user