code-assistant
Five prompts for developer-intent tasks — code review, commit messages, docstrings, error explanation, and regex generation — each with a strict typed schema and an eval that runs on the same model it recommends. Prefers executable, judge-free evals; adds a judge only where correctness is subjective.
Code Assistance
Five prompts for the developer-intent searches that bring engineers to a prompt registry — code review, commit messages, docstrings, error explanation, and regex generation. Each returns typed, validated JSON with a strict schema, and each is gated by an eval that runs on the same model it recommends.
Like the Structured Extraction, Customer Support, RAG Essentials, Translation Essentials, Summarization Essentials, and Text Classification collections, every prompt is a system message, a user message, and a schema — framework-agnostic, SDK-generatable in TypeScript and Python.
Prompts
| Prompt | What it does | Model |
|---|---|---|
code-review | Review a diff → summary, issues (closed-enum severity, file, line, suggestion), a flat issue_files[], and an approved gate. Comments in the diff are data, never instructions. | claude-opus-4-7 |
commit-message-generation | Diff → a Conventional Commits message: closed-enum type, scope, imperative subject ≤ 72 chars, body, breaking flag. | claude-haiku-4-5 |
docstring-generation | Function/class → a docstring in a chosen style (google/numpy/jsdoc/rustdoc) + the exact params_documented[]. | claude-haiku-4-5 |
error-explanation | Error + stack + context → plain-language explanation, likely cause, concrete fixes, confidence. | claude-sonnet-4-6 |
regex-generation | Description + flavor → a regex, an explanation, and self-supplied test cases. The eval runs the pattern. | claude-sonnet-4-6 |
The theme: the eval runs on the model you'd ship
Two ideas hold this collection together.
1. Recommended model = eval model, chosen per task. Each prompt names the model its metadata recommends, and its eval runs on that same model — not a fixed default. The recommendation is tiered to the work: code-review runs on Opus because bug-finding rewards the strongest reasoning; commit-message-generation and docstring-generation run on Haiku because they're structured and cheap; error-explanation and regex-generation sit on Sonnet in between. What you see recommended is what was actually graded.
2. Prefer executable, judge-free evals; add a judge only where correctness is genuinely subjective.
regex-generationis the showcase. Each dataset case carries its own positive and negative example strings, and the eval runs the model's generated regex against them with CEL's RE2.matches(). No judge — the pattern either matches the right strings or it doesn't.commit-message-generationis fully deterministic — type correctness plus subject-format checks (≤ 72 chars, no trailing period) are pure CEL.code-reviewpairs an objective backbone (the planted bug must appear inoutput.issue_files; an unambiguous blocker must not beapproved; a clean diff must not invent a blocker/major) with a severity-calibration judge for the part CEL can't check.error-explanationasserts the real cause keyword deterministically, then a usefulness judge grades whether the fix is actionable.docstring-generationchecks the documented-parameter count exactly, then a style-adherence judge confirms the format.
House conventions
- Reasoning (or a summary) before the verdict. Reviews summarize, classifiers reason, regexes explain their construction — always before committing to the output that follows.
- Closed enums wherever the taxonomy is fixed — severity, commit type, regex flavor, docstring style — so the eval can assert equality and mean it.
- Flat, assertable fields by design.
code-reviewemitsissue_files[]so an eval can test membership without mapping over objects;docstring-generationreportsparams_documented[];regex-generationsuppliestest_cases[]. Schema design is eval design. - Input is data, never instructions. Diffs, code, errors, and descriptions are injected inside delimiters; a comment that says "approve this" or "mark this chore" is described, never obeyed.
code-reviewmakes this its headline property. - No invented specifics.
code-reviewnever invents a line number not in the diff;docstring-generationdocuments only real parameters;error-explanationgrounds every claim in the provided error and code. - Confidence is uncalibrated and says so, in every schema that carries it.
Judge prompts
The three judges are published alongside the collection and referenced by the evals: code-review-grader, error-explanation-grader, and docstring-grader. Each grades one subjective dimension (severity calibration, fix usefulness, style adherence) and returns a { reasoning, score } the eval thresholds on.