Provides critical architectural patterns for the pricing engine. Covers database operations, B2B/B2C dual processing, background jobs, error handling, and performance patterns. Use before implementing pricing engine features, modifying background jobs, or reviewing pricing engine code changes.
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
This is a high-performance financial system processing hundreds of price change notifications per second with real money transactions. These patterns are critical.
MUST use QuickInsertService with PostgreSQL COPY protocol for inserting multiple records.
// CORRECT - Bulk insert
await quickInsertService.InsertAsync(items, cancellationToken);
// WRONG - Individual inserts in loop
foreach (var item in items)
await dbContext.AddAsync(item); // CRITICAL VIOLATION
New queries MUST consider indexes. Unindexed query on price_history_items (93M+ rows) = system degradation.
Append-only tables + _latest tables with triggers. Never update historical records.
Most entities have _b2b variants. If code touches B2C pricing, verify B2B is also handled.
| B2C Table | B2B Table |
|---|---|
price_history_items | price_history_items_b2b |
recommendations | recommendations_b2b |
buy_box_history | buy_box_history_b2b |
Missing B2B handling = 50% of pricing logic broken.
MUST accept and propagate CancellationToken to all async operations.
// CORRECT
public async Task ExecuteAsync(CancellationToken cancellationToken)
{
await dbContext.SaveChangesAsync(cancellationToken);
}
// WRONG - Missing cancellation token causes shutdown hangs
public async Task ExecuteAsync()
{
await dbContext.SaveChangesAsync(); // CRITICAL VIOLATION
}
Jobs that shouldn't run concurrently MUST use PostgresqlDistributedLock.
Via appsettings.json under Modules::{ModuleName}::BackgroundJobs.
MUST log start/completion/errors with context.
// CORRECT - Specific exception, logged and re-thrown
catch (DbUpdateException ex)
{
logger.LogError(ex, "Failed to save price update for {Sku}", sku);
throw; // Re-throw for retry logic
}
// WRONG - Silent swallow
catch (Exception) { } // CRITICAL VIOLATION in financial operations
// JSON parsing errors should be warnings, not crashes
catch (JsonException ex)
{
logger.LogWarning(ex, "Invalid JSON in notification");
}
IOptions<T> pattern/app/secrets/Modules/{Module}/Endpoints/Read/ - Read endpoints
Modules/{Module}/Endpoints/Write/ - Write endpoints
Contracts (request/response) in same file as endpoint. All I/O operations MUST be async.
/components/ui/ (shadcn components)Before any change: