sickn33/agentic-awesome-skills · error · Error

Price and quantity must be non-negative

Error message

Price and quantity must be non-negative

What it means

Error "Price and quantity must be non-negative" thrown in sickn33/agentic-awesome-skills.

Source

Thrown at skills/kaizen/SKILL.md:80

    total += items[i].price * items[i].quantity;
  }
  return total;
};

// Iteration 2: Make it clear (refactor)
const calculateTotal = (items: Item[]): number => {
return items.reduce((total, item) => {
return total + (item.price \* item.quantity);
}, 0);
};

// Iteration 3: Make it robust (add validation)
const calculateTotal = (items: Item[]): number => {
if (!items?.length) return 0;

return items.reduce((total, item) => {
if (item.price < 0 || item.quantity < 0) {
throw new Error('Price and quantity must be non-negative');
}
return total + (item.price \* item.quantity);
}, 0);
};

````
Each step is complete, tested, and working
</Good>

<Bad>
```typescript
// Trying to do everything at once
const calculateTotal = (items: Item[]): number => {
  // Validate, optimize, add features, handle edge cases all together
  if (!items?.length) return 0;
  const validItems = items.filter(item => {
    if (item.price < 0) throw new Error('Negative price');
    if (item.quantity < 0) throw new Error('Negative quantity');

View on GitHub (pinned to 58d857988f)

When it happens

Trigger: Thrown at skills/kaizen/SKILL.md:80 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sickn33/agentic-awesome-skills@58d857988f (2026-08-26). Data as JSON: /api/errors/db16cdc1e5bf94a4. Report an issue: GitHub.