bmrc-debugging

Diagnoses recurring bug classes in the BMRC Logistics Next.js and Firebase codebase.

2|Updated Dec 24, 2025
One-click install
npx skills add https://github.com/iv-zhang/BMRC-Logistics --skill bmrc-debugging-iv-zhang
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: bmrc-debugging
Source: https://github.com/iv-zhang/BMRC-Logistics/tree/main/.claude/skills/bmrc-debugging
Command: npx skills add https://github.com/iv-zhang/BMRC-Logistics --skill bmrc-debugging-iv-zhang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Debugging the BMRC Logistics app often means rediscovering the same root causes: wrong stock numbers, stale config, Firestore Timestamp crashes, and permission quirks. This playbook maps each recurring symptom to its real cause and fix so you stop inventing theories and start from known failure classes. ## Core Features & Use Cases - Symptom-to-cause tables: Look up wrong numbers, lost or duplicated items, stale configuration, crashes, and auth weirdness, each mapped to the exact module and fix. - Emulator-first reproduction: Guides reproduction on the Firebase emulator with seeded data instead of poking production, including invariant test checks. - Cross-skill routing: Points to the right companion skill (domain, UI, testing, migrations) when the bug belongs to another concern. - Use Case: An item shows as expired even though the expired lot is used up. The playbook identifies the zero-stock tombstone batch carrying the old expiration and directs you to filter with batchHasStock(). ## Quick Start Use the bmrc-debugging skill to investigate why an item shows the wrong status in the BMRC Logistics app.

Frequently Asked Questions about bmrc-debugging

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

FAQPage Schema
How do I debug wrong stock counts in a Firestore inventory app?▼

Wrong stock counts usually come from pages re-implementing the math locally instead of importing shared functions like computeBagStock or getItemStatus. Also check whether decisions use totalItems (physical) instead of availableItems (deployable).

How do I reproduce BMRC Logistics bugs safely?▼

Reproduce on the Firebase emulator using npm run dev:emulator plus npm run seed, never against production. Inspect raw documents in the emulator UI at http://127.0.0.1:4000 to trace the failing write path.

Why does Firestore throw Unsupported field value: undefined?▼

Firestore rejects undefined values in write payloads. Wrap the payload in removeUndefined() or deepRemoveUndefined() from app/lib/audit.ts before writing to strip undefined fields recursively.

Why do Firestore dates crash with getTime is not a function?▼

A Firestore Timestamp object was passed where a JavaScript Date was expected. Call .toDate() when reading, or deep-hydrate documents like the hydrate() helper in scripts/emulator/harness.ts.

Why do admin settings changes not appear without a reload?▼

The config was read at module scope or from frozen constants like THRESHOLDS or LOCATIONS. Read configuration via useOrgConfig() or store getters inside render so edits propagate immediately.

When should I not use this debugging playbook?▼

Use it before proposing any fix for a suspected bug. Skip it only for pure UI rendering issues like dark-mode or layout problems, which belong to the design-system skill, or when building new features rather than investigating failures.