Coding & automation

Use Ponytail Review to catch negative totals and invalid cart quantities

Short code can still calculate the wrong amount. Read the actual review,inspect a separate fix,and run the same13 checks before and after the change.

Claude Code
AI-generated editorial illustration, not an actual product screenshot.
On this page
THE QUICK TAKE
  • Review requirements,callers and checks together with the target function.
  • parseInt can hide invalid fractions or suffixes by extracting a leading integer.
  • Separate review,editing and execution;correct rejection matters more than line count.

An actual read-only review,a separate fresh-session fix and independent tests of fictional code. This is not a security certification of a payment service or a measured success rate.

Files for this exercise

AIHotple example files and prompts. Try the exercise before substituting real work data.

Quantity -1 produced a negative total

The fictional unit price is12,000KRW and quantities must be integers1 through10. The original helper only checked the upper limit after calling parseInt. It returned-12000 for-1,12000 for1.5 and24000 for the string2abc.

The actual review identified these concrete cases. The useful outcome is not a shorter function:it is preventing invalid quantities from reaching a calculated total. This sample has no real checkout integration.

InputOriginal observed resultRequired behavior
-1-12000KRWReject
00KRWReject
1.512000KRWReject
String2abc24000KRWReject
224000KRWAccept

1. Prepare requirements and connected code

The archive contains before and after folders plus actual requests and responses. README.md requires a number or canonical digit string representing an integer1..10. Spaces,signs,leading zeros,blanks,booleans,fractions and suffixes are outside this exercise’s accepted input.

cart.mjs owns totalFor. checkoutPreview and invoicePreview in callers.mjs both call it. Those names describe fictional number-returning functions,not a payment API. Reading callers makes it possible to repair the shared rule once.

Original cart.mjs
export function totalFor(quantity){
 const count=Number.parseInt(quantity,10);
 if(!Number.isFinite(count)||count>10)
  throw new Error('수량은 1~10 사이 정수여야 합니다.');
 return count*12000;
}

2. Ask for a review before an edit

Confirm Ponytail is available,then name the exact files. Leaving the target unspecified can produce a broader review than your current task needs.

Our review session allowed only Skill and Read. It changed no file. Despite a Korean request,the response was English,in line with the review skill’s output template. The English original is included in the ZIP;the Korean article explanation is an editorial translation.

Three original invalid quantity cases: negative, fractional and suffixed input
Editorial diagram from the actual review and original code, not Claude’s original UI. · Open full-size image ↗
  1. Extract the archive and open before.

    Confirm cart.mjs, callers.mjs, README.md and check.mjs are together. Start with the fictional sample rather than production checkout code.

  2. Open Claude Code there and send the review request.

    Paste the /ponytail: ponytail-review request below into the conversation and press Enter. Explicitly ask for no edits at this stage.

  3. Find a concrete input and its code location in the review.

    Inspect Must fix for missing lower bounds and parseInt truncation. The actual English reply is review-actual-response.md in the ZIP; the article diagram is editorial explanation.

Copy and adapt this prompt
/ponytail:ponytail-review
Read cart.mjs,callers.mjs,README.md and check.mjs. Identify concrete inputs producing an incorrect amount or violating the requirements. Suggest the smallest fix. Do not modify files,and distinguish inspected code from executed checks.

Install and verify Ponytail →

3. Examine the evidence behind each finding

The first finding was the missing lower bound:count>10 cannot reject zero or negative values. The second concerned parseInt,which reads a leading integer and can turn2abc into2 or1.5 into1. Invalid input then looks like a valid quantity.

The review traced both callers to totalFor and recommended correcting the shared helper. It also suggested missing cases such as spaces,leading zeros,scientific notation and arrays. We treated these as claims to check,not authority to accept without inspection.

FindingEvidence to inspect
Missing lower boundA real rejection for0 and-1
Truncated inputFractions and suffixes converted into integers
Shared impactBoth callers use totalFor
Incomplete checksInputs that would survive a partial fix

4. Reproduce the failure first

Run the following from the extracted archive. Failure is expected in before:our observed result was6 passed and7 failed with exit code1. It shows the sample bug rather than a broken installation.

The original passing cases include2,the string3 and the upper bound10. Rejections for negative,zero,fractional and suffixed input fail,as do the affected caller checks. Having a test file is different from passing it. The review model ran no commands;these results came from independent editorial Node execution.

Terminal in the extracted archive
node before/check.mjs
# Expected before: passed6,failed7,exit1

5. Make a separate scoped correction

We used a fresh session with the same requirements to request a cart.mjs-only correction. It was not an automatic continuation of the review conversation. Both callers,the unit price,the error message and the original check file stayed unchanged.

The resulting helper accepts only number/string values whose textual form exactly matches1..9 or10. This narrow expression fits the stated interval. It is not a general-purpose quantity validator for arbitrary ranges or fractional products.

Actual corrected helper
export function totalFor(quantity){
 if(!['number','string'].includes(typeof quantity)||
    !/^(10|[1-9])$/.test(String(quantity)))
  throw new Error('수량은 1~10 사이 정수여야 합니다.');
 return Number(quantity)*12000;
}
Copy and adapt this prompt
/ponytail:ponytail full
Read README.md,cart.mjs,callers.mjs and check.mjs. Modify only cart.mjs so it accepts numbers or canonical digit strings representing integers1..10. Reject blank,boolean,negative,zero,fractional and suffixed values. Preserve the error message,unit price and caller API. Add no files or packages.

6. Run unchanged checks and additional cases

The after/check.mjs file is byte-identical to the original13-case check. It now returned13 passed and0 failed. Both caller paths rejected their invalid quantities because they share totalFor.

The editor separately added extra-check.mjs from the review suggestions and verified11 rejections:space-prefixed3,03,+3,1e1,an array,null,an omitted argument,NaN,Infinity,an object and false. This file was not written or executed by the assistant.

StageObserved
Original13 before6 passed /7 failed
Same13 after13 passed /0 failed
Additional rejection inputs11 checked
Changed filecart.mjs only
Callers and original checksByte-identical
Continue from the same folder
node after/check.mjs
# Expected: passed13,failed0
node extra-check.mjs
# Expected: PASS: 11 additional rejected inputs
The same 13 checks: 6 passed 7 failed before, 13 passed 0 failed after, plus 11 additional rejected inputs
Visualization of the actual independent checks. Not a new execution or a success-rate benchmark. · Open full-size image ↗
  1. Open a terminal in the extracted archive’s top-level folder.

    Both before and after should be visible there. Running node before/check.mjs from inside before would point at the wrong nested path.

  2. Run the before check and read the failures.

    Use node before/check.mjs. Six passes, seven failures and exit 1 are expected for this fictional baseline.

  3. Run the after check from the same location.

    Use node after/check.mjs for 13 passes/zero failures, then node extra-check.mjs for 11 additional rejections. If a command fails, check Node, current folder and file names first.

Transfer the review process,not a blanket guarantee

Keep an original copy,write the expected input rules,read the review and select the repair target. Then check existing valid behavior and new rejection cases together. A useful conclusion does not have to be more rules or fewer lines.

Real payments also involve server validation,authorization,precision,stock,concurrency and refund rules. Passing this small exercise does not certify a real service. What it provides is a reproducible way to inspect a concrete bug,make a bounded change and verify the result.

Install and check Ponytail →

Try a native date input →

Sources & verification

On19October2026 we loaded official Ponytail5.3.2 commit09c434ab73ca43761c5d8b0c5d341926c2fba710 using --plugin-dir on Windows,Node.js24.20.0 and Claude Code2.1.301; the recorded model was claude-sonnet-5-5. We explicitly called the Skill tool with disableAllHooks=true and automatic memory disabled. We did not test permanent installation,automatic hooks,persisted modes,band,board,webhooks,Codex,another OS or comparative cost/performance. No additional payment or global configuration change was made. The review explicitly invoked ponytail:ponytail-review and read four files without editing;its reply was English despite a Korean request. A separate fresh session,not a continuation,modified only cart.mjs from the same requirements. The editor ran13 original checks:6 passed/7 failed before and13 passed/0 failed after,plus11 additional rejected inputs. Both callers and the original checks remained byte-identical. No real payment,network,concurrency or other codebase was tested.

  1. Ponytail · pinned review skill
  2. Ponytail · pinned coding skill
  3. MDN · parseInt behavior
  4. MDN · Number.isInteger
  5. Claude Code · plugin skills

Sources checked: 2026.10.19

Keep this guide for your next project.Report a correction