Choose a result you can verify
Use terminal Claude Code in a project where you can experiment. This exercise reviews the diff you paste into the conversation. Inspect that text for credentials, personal data and confidential material before sharing it.
The skill should connect each finding to a changed behaviour, a reproducible input and an expected result. You can assess those properties even when the wording differs between runs.
Create the project skill file
Save the following file at .claude/skills/review-diff/SKILL.md. Claude Code also documents ~/.claude/skills for personal skills across projects. This example uses project scope.
The YAML metadata names the procedure and describes its purpose. Keep the folder name and name field aligned. The procedure below is an original editorial exercise.
---
name: review-diff
description: Review a user-provided diff before a commit for concrete regressions. Use for requests to review changes. Exclude general code explanations and requests to write new functions.
---
# Review the supplied diff
Use the diff and requirements supplied in the conversation.
If the diff is missing, ask the user to paste it after checking
for confidential data. Identify any context that is missing.
For each possible regression
1. Identify the behaviour that changes.
2. Compare it with the user’s requirement.
3. Describe an input that reproduces the error.
4. Propose a calculation or test and its expected outcome.
5. Discard style preferences with no effect on behaviour.
Report checkable findings in impact order. Include the file,
line, observable behaviour and proposed verification.
Finish with the information still missing.
Keep the review read-only. Applying fixes, creating commits or
publishing changes requires a new request. An empty findings
list leaves checks you have not performed outstanding. Invoke it with a concrete requirement
Start your message with /review-diff, then paste the requirement and change below. For a separate automatic-invocation check, start a new conversation and ask for a review before a commit without writing the command.
The description helps Claude select a relevant skill. Setting disable-model-invocation to true makes invocation manual. Leave the example as written when comparing both cases.
Requirement
discountedPrice returns the final price after a discount.
Prices are in cents. For 1000 and 20 the expected result is 800.
diff --git a/discount.mjs b/discount.mjs
--- a/discount.mjs
+++ b/discount.mjs
@@ -1,3 +1,3 @@
export function discountedPrice(priceCents, percent) {
- return Math.round(priceCents * (1 - percent / 100));
+ return Math.round(priceCents * percent / 100);
} Check the arithmetic independently
The changed function returns 200, the discount amount, when the requirement calls for the final price of 800. At zero discount it returns zero instead of 1000. A useful report connects the changed line to those observable errors.
Save this code as check-discount.mjs in a scratch directory and run node check-discount.mjs. Node.js is required. Compare the findings with the calculation and reproduce any additional finding before accepting it.
function originalPrice(priceCents, percent) {
return Math.round(priceCents * (1 - percent / 100));
}
function changedPrice(priceCents, percent) {
return Math.round(priceCents * percent / 100);
}
console.log('Expected final price', originalPrice(1000, 20));
console.log('Result after the change', changedPrice(1000, 20));
console.log('Zero discount, expected 1000', changedPrice(1000, 0));