cart-managementReact cart state management: duplicate prevention, localStorage persistence, CartContext patterns. Use when building or fixing shopping carts, product lists,...
Install via ClawdBot CLI:
clawdbot install konscious0beast/cart-managementPatterns for React cart state: duplicate prevention, persistence, context design.
productIdsInCart.includes(item.id) before addlocalStorage.getItem('cart') on mountlocalStorage.setItem('cart', JSON.stringify(cartItems))localStorage.setItem('cart_ids', JSON.stringify(ids))const addToCart = (item: CartItem) => {
if (!productIdsInCart.includes(item.id)) {
setCartItems(prev => [...prev, item]);
setProductIdsInCart(prev => [...prev, item.id]);
localStorage.setItem('cart', JSON.stringify([...cartItems, item]));
}
};
For same-product quantity: use cartItems.map() to update item.quantity, don't create duplicate entries.
Generated Mar 1, 2026
Implementing a shopping cart for online retail platforms to manage product additions, prevent duplicate items, and persist cart data across user sessions. Useful for stores selling physical goods, digital products, or subscriptions where cart state needs to survive page refreshes.
Building a cart for food ordering apps to handle menu items, track quantities, and ensure users don't accidentally add the same dish multiple times. Persistence helps users resume orders after closing the app briefly.
Managing cart state for ticket purchases, preventing duplicate seat selections, and persisting choices during the checkout flow. Ensures users don't lose selected tickets if they navigate away or refresh the page.
Creating a cart for software service plans where users can add different tiers or add-ons, with duplicate prevention to avoid overlapping subscriptions. Persistence aids in multi-step signup processes.
Developing a cart for travel sites to hold room selections, dates, and extras like breakfast or parking, with checks to prevent double-booking the same room. localStorage keeps choices intact during browsing.
Direct sales to consumers through an online store, using the cart to drive conversions and reduce cart abandonment with persistent state. Revenue comes from product markups, shipping fees, and upsells during checkout.
Connecting multiple sellers with buyers, where the cart manages items from different vendors, prevents duplicate listings, and syncs data for a seamless shopping experience. Revenue is generated via commission fees on transactions.
Offering recurring access to products or content, with the cart handling plan selections and add-ons, ensuring users don't subscribe to the same tier twice. Revenue streams include monthly or annual subscription fees.
💬 Integration Tip
Use CartContext to centralize logic and avoid duplicating code in components; initialize state from localStorage on app mount to maintain persistence across sessions.
Create jobs and transact with other specialised agents through the Agent Commerce Protocol (ACP) — extends the agent's action space by discovering and using agents on the marketplace, enables launching an agent token for fundraising and revenue, and supports registering service offerings to sell capabilities to other agents.
Write, structure, and update a business plan for a solopreneur. Use when creating a plan from scratch, updating an existing plan after a pivot or new phase, or preparing a plan to share with investors, partners, or even just to clarify your own strategy. Covers executive summary, market analysis, competitive positioning, revenue model, operations plan, financial projections, and risk assessment — all adapted for a one-person business. Trigger on "write a business plan", "business plan", "create my plan", "business plan template", "update my business plan", "plan for my business", "investor pitch plan".
Executive leadership guidance for strategic decision-making, organizational development, and stakeholder management. Includes strategy analyzer, financial scenario modeling, board governance frameworks, and investor relations playbooks. Use when planning strategy, preparing board presentations, managing investors, developing organizational culture, making executive decisions, or when user mentions CEO, strategic planning, board meetings, investor updates, organizational leadership, or executive strategy.
Strategic product leadership toolkit for Head of Product including OKR cascade generation, market analysis, vision setting, and team scaling. Use for strategic planning, goal alignment, competitive analysis, and organizational design.
B2B SaaS competitive intelligence with 24 scenarios across Sales/HR/Fintech/Ops Tech
Multi-agent war room for brainstorming, system design, architecture review, product specs, business strategy, or any complex problem. Use when a user wants to run a structured multi-agent session with specialist roles, when they mention "war room", when they need to brainstorm a project from scratch, design a system with multiple perspectives, stress-test decisions with a devil's advocate, or produce a comprehensive blueprint/spec. Works for software, hardware, content, business — any domain.