xai-org/xai-cookbook/fix-a-bug
Claude Code and agent skill by xai-org/xai-cookbook
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
How to reproduce and fix a bug in tiny-checkout, a store's cart, coupon, shipping, and total logic. Covers running the tests with node --test, where the code and tests live, and the steps and conventions every fix follows.
Install
npx vskill@latest install xai-org/xai-cookbook/fix-a-bugSKILL.md
Fixing a bug in tiny-checkout
tiny-checkout is the checkout logic of a small web store. It's plain JavaScript in ES modules with no dependencies, so there's nothing to install.
Where things are
src/money.jsturns prices in dollars into whole cents and formats cents for display.src/cart.jskeeps the cart's lines and adds up the subtotal.src/coupons.jslooks up coupon codes and works out their discount.src/checkout.jsputs it together: subtotal, shipping, discount, and total.test/<name>.test.jshas the tests forsrc/<name>.js.
Running the tests
- Every test:
node --test - One file:
node --test test/money.test.js
The output lists each test with ✔ or ✖, then a summary. A failing test shows the expected and actual values.
Steps
- Run
node --testto see where things stand before you change anything. - Find the code behind the symptom. Start from what the report describes, read the files involved, and follow the calls with
grep -rn. - Add a test that reproduces the report to the test file of the module you'll fix, and run it to watch it fail. A fix without a failing test first isn't done.
- Fix the cause, not the symptom, with the smallest change that works.
- Run
node --testagain, and keep going until every test passes. - Finish with two or three sentences on what was wrong and what you changed.
Conventions
- Amounts are whole cents everywhere. Dollars become cents once, in
toCents(), when a product goes into the cart. - Tests use
node:testandnode:assert/strict, with onetest()per behavior, named after the behavior in plain words, like the existing ones. - Keep the style of the file you're editing: two-space indents, double quotes, semicolons.
- Don't add dependencies or change
package.json.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingexamples/bug-report-to-fix/typescript/sample-repo/skills/fix-a-bug/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/xai-org/xai-cookbook/fix-a-bug)