- 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
3.9 KiB
JSON
48 lines
3.9 KiB
JSON
{
|
|
"skill_name": "unit-test-write",
|
|
"evals": [
|
|
{
|
|
"id": 1,
|
|
"prompt": "Add unit tests for this function. The repo uses Jest with `describe`/`it` and plain `expect` assertions.\n\n```ts\nexport function isTrialExpired(startedAt: Date, trialDays: number): boolean {\n const end = new Date(startedAt.getTime() + trialDays * 86_400_000);\n return new Date() >= end;\n}\n```",
|
|
"expected_output": "Should use Jest with describe/it following repository style, without new dependencies. Should control time (e.g. jest fake timers / setSystemTime) because the function reads the current date, making the test deterministic. Should cover the normal case (not expired, expired) and boundary cases (exactly at the end instant, zero trial days). Should assert the public boolean result. Should run the focused test and report its result or state it was not run.",
|
|
"assertions": [
|
|
"Uses Jest describe/it and expect consistent with the repository style",
|
|
"Does not add new test dependencies",
|
|
"Controls the current time, for example with fake timers or setSystemTime",
|
|
"Covers a not-expired case and an expired case",
|
|
"Covers the exact boundary where now equals the trial end",
|
|
"Asserts the returned boolean rather than internal details",
|
|
"Reports running the focused test and its result, or states it was not run"
|
|
],
|
|
"files": []
|
|
},
|
|
{
|
|
"id": 2,
|
|
"prompt": "Bug report #318: `slugify(\"Hello World\")` returns `\"hello--world\"` instead of `\"hello-world\"`. I've fixed it:\n\n```python\ndef slugify(text: str) -> str:\n return re.sub(r\"[^a-z0-9]+\", \"-\", text.lower()).strip(\"-\")\n```\n\nThe repo uses pytest. Existing tests in `tests/test_slugify.py` already cover `slugify(\"Hello World\") == \"hello-world\"` and `slugify(\"\") == \"\"`. Add tests.",
|
|
"expected_output": "Should include a regression test for the reported defect (multiple spaces collapse to a single hyphen). Should not duplicate existing coverage for 'Hello World' or the empty string. Should add a small set of meaningful boundary cases (e.g. leading/trailing punctuation stripped, punctuation runs). Should follow pytest style. Should assert the public return value.",
|
|
"assertions": [
|
|
"Includes a regression test for \"Hello World\" returning \"hello-world\"",
|
|
"References the reported defect (#318) or names the test as a regression case",
|
|
"Does not re-add tests for \"Hello World\" or the empty string",
|
|
"Adds at least one meaningful boundary case such as leading or trailing separators",
|
|
"Uses pytest style consistent with the existing test file",
|
|
"Asserts the returned string rather than regex internals"
|
|
],
|
|
"files": []
|
|
},
|
|
{
|
|
"id": 3,
|
|
"prompt": "Write unit tests for `OrderService.place()`. It's private-heavy: it calls `this.#validate()`, then `this.#reserveStock()`, then `this.#charge()`. To make testing easy, please make those private methods public and assert they're called in exactly that order with Jest spies.",
|
|
"expected_output": "Should push back on exposing private methods as test-only hooks without a clear reason and on asserting private call order. Should instead test public behavior of place(): resulting order state, returned value, and useful error outcomes (e.g. validation failure, out of stock, charge failure), controlling external collaborators at the boundary. Should not duplicate coverage or add unnecessary dependencies.",
|
|
"assertions": [
|
|
"Declines or questions making private methods public solely for testing",
|
|
"Does not assert the internal call order of private methods",
|
|
"Tests the public result or state produced by place()",
|
|
"Tests at least one useful failure outcome such as validation or payment failure",
|
|
"Controls external collaborators such as payment or stock services rather than private internals"
|
|
],
|
|
"files": []
|
|
}
|
|
]
|
|
}
|