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-bug

SKILL.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.js turns prices in dollars into whole cents and formats cents for display.
  • src/cart.js keeps the cart's lines and adds up the subtotal.
  • src/coupons.js looks up coupon codes and works out their discount.
  • src/checkout.js puts it together: subtotal, shipping, discount, and total.
  • test/<name>.test.js has the tests for src/<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

  1. Run node --test to see where things stand before you change anything.
  2. Find the code behind the symptom. Start from what the report describes, read the files involved, and follow the calls with grep -rn.
  3. 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.
  4. Fix the cause, not the symptom, with the smallest change that works.
  5. Run node --test again, and keep going until every test passes.
  6. 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:test and node:assert/strict, with one test() 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/xai-org/xai-cookbook/fix-a-bug/badge)](https://verified-skill.com/skills/xai-org/xai-cookbook/fix-a-bug)

Something wrong with this skill or its page? Tell us.