From cortex
This skill should be used when the user asks to "display data", "add a chart", "show a number", "create a data component", "fix wrong data", "debug null values", "add a pipeline source", "handle data freshness", "fix stale cache", or before any code that displays, transforms, or stores data in the current project. Enforces 'every number must be accurate and traceable.'
How this skill is triggered — by the user, by Claude, or both
Slash command
/cortex:data-integrityThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**TL;DR**: Every number must be accurate and traceable. 10 rules for displaying, transforming, and storing financial data.
TL;DR: Every number must be accurate and traceable. 10 rules for displaying, transforming, and storing financial data.
Every number displayed in the UI must trace to a specific database table and column. When adding a data display, document the chain: source API → ingestion function → DB table.column → cached loader → component prop.
Never display null, undefined, NaN, or empty strings as data values.
formatDollar(val) for currency (returns "-" for null)formatCompact(val) for large numbersval ?? "-" as the minimum fallbackT | null and null-guard before calling .toFixed(), .replace(), etc.Pipeline failures must never corrupt or lose existing data.
no_quote_streak for tickers in failed batches'use cache' functions must throw on Supabase errors — never cache null resultsrevalidate values in cached-loader functionsTier check happens at data fetch time, not after fetching all data and filtering client-side.
src/lib/constants.ts — never hardcode limitsMath.round() / int() at ingestion boundary for: dollar amounts, volume, share counts (whole), market capdata_source_health tabledata_source_health tracks freshness server-side]Always display:
$) on dollar amounts%) on percentagesK/M/B/T) on large numbers via formatCompact()+/-) on changes via formatSignedColor()batchUpsert() from src/lib/utils/batch-upsert.ts handles 500-row chunks with count verification| Gotcha | Symptom | Fix |
|---|---|---|
formatDollar(null) | Displays "$NaN" | Function handles null → returns "-" |
PostgREST bad column in .select() | Returns null data + error (no throw) | Verify column names against schema |
.in() query exceeds max_rows | Silently truncated results | Chunk queries (100 tickers per chunk) |
| Yahoo batch failure | Mass false delistings | Track failed batch tickers, exclude from streak |
| Cache null result | Stale error cached for TTL | Throw inside 'use cache' functions |
See references/data-source-map.md for the data source inventory template.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub crombieman/undercurrent-cortex --plugin cortex