order-builder

Automates shopping cart pricing and discount application in TypeScript with Decimal.js precision.

6|3|Updated Apr 8, 2022
One-click install
npx skills add https://github.com/Rytass/Utils --skill order-builder
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: order-builder
Source: https://github.com/Rytass/Utils/tree/main/.claude/skills/order-builder
Command: npx skills add https://github.com/Rytass/Utils --skill order-builder

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a reusable engine to calculate order totals and apply complex discounts across shopping carts, reducing manual pricing errors and time spent on promotions.

Core Features & Use Cases

  • Accurate multi-policy discounting: combine fixed, percentage, and step-based discounts across items.
  • Flexible pricing strategies: supports item- and order-level discount allocation, thresholds, and coupons.
  • Use Case: integrate with an e-commerce flow to automatically price a cart with promotions and generate item-level discount reports.

Quick Start

Install and import the Order Builder, instantiate with policies, and build a sample order to observe final price and discount breakdown.

Frequently Asked Questions about order-builder

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply multiple discount policies to a shopping cart in TypeScript?

You can apply multiple discount policies to a shopping cart by using an order builder engine to combine fixed, percentage, and step-based discounts across items and orders. This automates cart pricing and reduces manual calculation errors.

What is the best way to calculate order totals with coupons and threshold discounts?

The best way to calculate order totals with coupons is to use an automated pricing engine that supports item- and order-level discount allocation, applying threshold rules to generate item-level discount reports and final prices accurately.

Does order-builder require Decimal.js for precise e-commerce pricing calculations?

Yes, order-builder requires Decimal.js for precise arithmetic in a TypeScript environment. It relies on Decimal.js to prevent floating-point errors when calculating complex order totals and applying multiple discount policies.

Can I combine fixed and percentage discounts across items and order levels?

Yes, you can combine fixed and percentage discounts across both item and order levels. The engine supports flexible pricing strategies, allowing you to integrate multiple discount policies, thresholds, and coupons within e-commerce workflows.

How do I generate item-level discount reports for a shopping cart?

You generate item-level discount reports by instantiating the order builder with your pricing policies and building a sample order. The engine processes the cart to output the final price and a detailed breakdown of all applied discounts.