4.7 KiB
created, updated
| created | updated |
|---|---|
| 2025-10-08 07:17 | 2025-10-08 08:13 |
https://docs.claude.com/en/docs/claude-code/common-workflows#create-custom-slash-commands
Sure — here’s Prompt A in full isolation, ready to copy and paste:
⚙️ Prompt A — Ruthless Code Review (Codex / Claude)
Do a code review
Role: Critical code reviewer. Goal: List only problems and concrete fixes. Never include: praise, summaries, impact/likelihood/severity scores, percentages, or speculation. Assume: You can infer the language and common style guide (e.g., PEP 8, ESLint defaults, Swift API Design Guidelines).
Output format (exactly):
Issues
Issue N: <short, specific title>
Problem:
- <factual, concise description of what’s wrong>
Possible Fixes:
- <minimal-change fix, with code snippet>
- <more robust/refactor fix, with code snippet>
- <optional alternative, with code snippet>
Affected Locations:
- : (if known)
For each fix option, include a self-contained code snippet that can be dropped in, or a precise change description.
Prefer language-idiomatic solutions and remove dead code/duplication.
Cover: logic bugs, security, performance, naming, structure, error handling, API misuse, tests (if relevant), and readability.
If you’re uncertain, say “Uncertain:” and explain briefly—still no probabilities/percentages.
Code to review:
Awesome—here are tight, copy-pasteable prompts tuned for Codex-style models and Claude (terminal use). They produce a hard-nosed review with multiple fix options and then let you apply the chosen fix as a clean patch. No praise, no impact hand-waving, no fake percentages.
Prompt A — Review (Codex / Claude)!
Use this to start the review.
Role: Critical code reviewer. Goal: List only problems and concrete fixes. Never include: praise, summaries, impact/likelihood/severity scores, percentages, or speculation. Assume: You can infer the language and common style guide (e.g., PEP 8, ESLint defaults, Swift API Design Guidelines).
Output format (exactly):
Issues
Issue N: <short, specific title>
Problem:
- <factual, concise description of what’s wrong>
Possible Fixes:
- <minimal-change fix, with code snippet>
- <more robust/refactor fix, with code snippet>
- <optional alternative, with code snippet>
Affected Locations:
- : (if known)
For each fix option, include a self-contained code snippet that can be dropped in, or a precise change description.
Prefer language-idiomatic solutions and remove dead code/duplication.
Cover: logic bugs, security, performance, naming, structure, error handling, API misuse, tests (if relevant), and readability.
If you’re uncertain, say “Uncertain:” and explain briefly—still no probabilities/percentages.
Code to review:
Prompt B — Apply a Chosen Fix (Codex / Claude)
Use this after you pick a fix (e.g., “Apply Fix 2 for Issue 3”).
Task: Apply the selected fix(es) to the provided code. Constraints:
No praise, no summaries, no impact analysis, no percentages.
Return only one of the following, in full:
-
A unified diff patch (preferred), or
-
The fully rewritten file(s).
If using a patch, it must be valid unified diff with correct file paths so it can be applied via patch -p0 or git apply.
Selection: Apply fix for Issue .
Output format (choose one and use only that):
*** PATCH --- a/<path/to/file.ext> +++ b/<path/to/file.ext> @@
...
OR
// path: <path/to/file.ext>
Original code context:
Tips for Terminal Workflow
Codex-like models (CLI):
Review: paste Prompt A + your code.
Choose: reply “Apply fix 2 for Issue 1 and fix 1 for Issue 4.”
Apply: paste Prompt B + the current file(s).
Save patch to change.patch and run:
git apply change.patch || patch -p0 < change.patch
Claude (terminal):
Same flow. If Claude returns full files instead of a diff, pipe to file:
cat > path/to/file.ext <<'EOF' EOF
Optional Add-Ons (drop into Prompt A if useful)
Style gate: “Enforce <STYLE> (e.g., Black/PEP8, ESLint recommended). If code violates it, include a fix option that aligns with the style.”
Test nudge: “If a bug fix needs a test, include a minimal test snippet or assertion in one of the fix options.”
Security pass: “Flag any input handling, deserialization, command execution, or SQL usage that can be unsafe; offer a safe alternative.”
If you want, tell me your primary languages/frameworks and I’ll pre-bake language-specific checks (e.g., Python async pitfalls, Node.js stream/backpressure gotchas, Swift concurrency rules, etc.).