The reproducible bug
function total(unitPrice, quantity) {
return unitPrice * (quantity || 1);
}
// total(12, 0) returns 12. Expected: 0.Practical guide · 3 min read
Start with a small change, a clear check and a way to undo it.
What you’ll finish with One reviewable code change with evidence that it works.
AI-generated guide · Content revised · Allow about 20 minutes for the exercise
Start with a reproducible bug, a small form validation change or a missing test. Write down the current behavior and the behavior you want. Avoid combining a redesign, dependency upgrade and database migration in the same first task.
Point it to the relevant files, project instructions and test command. Ask it to inspect the existing approach before editing. Keep credentials out of prompts and give only the permissions needed for the task.
Work on a branch or a recoverable copy. Request the smallest change that fixes the issue. Let the agent explain assumptions before it introduces new dependencies or changes a public interface.
Read the diff and run a check that would fail with the original bug. Try the changed behavior in the application. A confident explanation and a passing test that merely repeats the implementation are not enough.
Replace the bracketed sections with your own details.
Investigate [bug] in [files]. Expected behavior: [result]. First explain the cause. Make the smallest appropriate change using the project conventions. Run [test command] and add a regression check if needed. Summarize what changed, the checks you actually ran and anything still unverified.
A self-contained JavaScript exercise: zero items should cost zero. The example is independent of a framework and uses no credentials, dependencies or database.
function total(unitPrice, quantity) {
return unitPrice * (quantity || 1);
}
// total(12, 0) returns 12. Expected: 0.Fix zero-quantity handling in total(). Accept finite, nonnegative numeric prices and quantities. Reject invalid inputs with RangeError. Keep the function name and argument order. Do not change unrelated files. Report the checks actually run.
function total(unitPrice, quantity) {
if (!Number.isFinite(unitPrice) || !Number.isFinite(quantity)
|| unitPrice < 0 || quantity < 0) {
throw new RangeError('Use finite, nonnegative numbers');
}
return unitPrice * quantity;
}// Save the corrected function above and these checks in check-total.cjs.
const assert = require('node:assert/strict');
assert.equal(total(12, 0), 0);
assert.equal(total(12, 3), 36);
assert.equal(total(0, 3), 0);
for (const quantity of [-1, NaN, Infinity, '3']) {
assert.throws(() => total(12, quantity), RangeError);
}
console.log('PASS');
// Run: node check-total.cjsThe important change removes the fallback that treated zero as missing. In this exercise, omitted quantities are invalid rather than silently becoming one; that is an explicit requirement, not a universally correct API choice. In a real project, inspect all callers before changing that contract. Keep a recoverable original and revert only this patch if verification fails. Do not discard unrelated local edits.
The agent fixes zero but silently allows numeric strings or changes the function's defaults.
Restate the accepted input types and compatibility requirements. Run a check for the edge case that originally failed and inspect the diff.
The original zero-quantity case fails against the old function and passes against the corrected one; invalid inputs are rejected.
Compare total cost for a finished task, including retries. Check agent usage, GitHub AI credits, the shared Cursor and Grok usage pool and hosting charges where they apply; a monthly subscription may not cover every action.
References checked October 22, 2026. Feature access, sharing and plan limits can change; check the linked documentation before committing.
Choose around the task and access you have. These are options to try, not a measured ranking.

GitHub (Microsoft)
Developers who want AI help inside the editor they already use, with a choice of models on one bill.
Read the overview →Visit GitHub Copilot ↗
Cursor (SpaceX)
Developers who want AI woven through the whole editor, especially those who will use the included Grok models.
Read the overview →Visit Cursor ↗
Anthropic
Delegating multi-step coding tasks across a codebase, from wherever you work.
Read the overview →Visit Claude Code ↗
OpenAI
ChatGPT subscribers who want a coding agent included in a plan they already pay for.
Read the overview →Visit Codex ↗Developers who want a free coding agent, or Google AI subscribers who want Gemini 4 Argon for coding.
Read the overview →Visit Google Antigravity ↗Meta
Developers who want a low-cost coding subscription, or access to Muse Wonder Full, which is not sold through the API.
Read the overview →Visit Muse Code ↗
Replit
Prototyping and deploying small apps without local setup, including for people who do not write code.
Read the overview →Visit Replit ↗


Choose the workspace based on what you need to publish, share and maintain.
Read guide 4 min read



Try the same real task in two assistants and find out which one earns a place in your routine.
Read guide 3 min read



Build a brief you can trace back to its sources, including the places where they disagree.
Read guide