stock-operations

Enforce atomic, auditable stock movements across locations and product variations.

Updated Oct 10, 2025
One-click install
npx skills add https://github.com/doorscomputers/nextjspos --skill stock-operations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stock-operations
Source: https://github.com/doorscomputers/nextjspos/tree/main/.claude/skills/stock-operations
Command: npx skills add https://github.com/doorscomputers/nextjspos --skill stock-operations

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the risk of inconsistent stock updates by enforcing atomic, auditable stock movements across sales, purchases, transfers, returns, and adjustments.

Core Features & Use Cases

  • Atomic updates: Each stock change is executed through a validated library to ensure consistency.
  • Dual-record auditing: Creates both StockTransaction and ProductHistory records for every operation.
  • Multi-location support: Handles variations and locations with proper balance tracking and permissions.
  • Use Case: Process a sale and automatically adjust stock across locations while maintaining a full audit trail.

Quick Start

Start by importing updateStock from '@/lib/stockOperations' and calling it within a Prisma transaction to adjust stock for a given product variation and location.

Frequently Asked Questions about stock-operations

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

FAQPage Schema
How do I enforce atomic stock movements in Prisma to prevent inconsistent inventory updates?

Atomic stock movements are enforced by importing the updateStock function and executing it within a Prisma transaction. This validated API ensures data integrity by processing sales, purchases, transfers, and adjustments consistently across multiple locations.

Why do I need dual-record auditing for stock transactions and product history?

Dual-record auditing is needed to maintain a verifiable audit trail for stock operations. The system creates both StockTransaction and ProductHistory records for every movement, ensuring complete traceability for inventory adjustments across locations and product variations.

Can I handle multi-tenant inventory isolation and multi-location tracking with this approach?

Yes, this approach handles multi-tenant inventory isolation and multi-location tracking. It enforces tenant boundaries and manages product variations across different warehouses, maintaining correct stock balances and permissions for each operation.

What is the best way to adjust stock balances for purchases, returns, and warehouse transfers?

The best way to adjust stock balances is using a validated transactional API. It safely processes purchases, returns, and warehouse transfers by applying atomic updates that prevent data inconsistencies during concurrent stock movements.

How do I start using a validated stock operations library for Prisma transactions?

Start by importing updateStock from the stock operations library and calling it within a Prisma transaction. Pass the product variation and location details to safely execute stock adjustments while automatically generating the required audit records.