CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

data-ops

Script catalog, data migration pipelines, and reconciliation tools for POSCursor

52

Quality

65%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Fix and improve this skill with Tessl

tessl review fix ./.agents/skills/data-ops/SKILL.md
SKILL.md
Quality
Evals
Security

Data Operations Skill — POSCursor (WatermelonDB/Supabase Offline-First)

Script Catalog

All scripts are in scripts/. Most use dotenv to load .env and connect to Supabase directly.

Auth & User Management

ScriptPurposeUsage
seed-test-users.mjsCreates admin + collector users with authnode scripts/seed-test-users.mjs
seed-collectors.mjsSeeds collector records in app_collectorsnode scripts/seed-collectors.mjs
signup-collectors.jsSigns up collectors via Supabase Auth APInode scripts/signup-collectors.js
create_test_user.jsCreates one test usernode scripts/create_test_user.js
create_user.jsGeneric user creationnode scripts/create_user.js
signup-bernie.jsCreates specific user "Bernie"node scripts/signup-bernie.js
link-profile.mjsLinks auth user to user_profilenode scripts/link-profile.mjs
auth-and-link.mjsCombined auth creation + profile linknode scripts/auth-and-link.mjs

Data Import & Migration

ScriptPurposeInputOutput
extract-excel.jsExtracts borrower/loan data from Excel → JSONbrayan Import migration cleanup.xlsxsrc/assets/migration_data.json
extract-excel.tsTypeScript version of aboveSameSame
migrate_excel.jsFull Excel → Supabase migration with rollover detectionDCM-as-of-march-21.xlsxDirect DB writes
migrate_savings_cbu_v2.mjsImport Savings/CBU from Excel, de-duplicate and fuzzy matchsavings and cbu2025 (1).xlsxSupabase
migrate-brayan.tsLegacy migration script (15KB)Excel fileSupabase
import-weekly-borrowers.mjsImports weekly borrower batch-app_borrowers
import_excel.jsGeneric Excel import-Supabase
sync_excel_payments.jsSyncs payment records from Excel-app_payments

Verification & Audit

ScriptPurpose
verify-auth.mjsChecks auth.users ↔ user_profiles sync
verify_balances.jsValidates cash balance calculations
verify_db_balances.jsChecks DB-level balance integrity
verify-color-balance.jsChecks color-coded balance matches
verify_collector_logins.mjsTests collector login credentials
verify_dupes.jsFinds duplicate records
verify_excel_vs_supabase.jsCompares Excel data against Supabase
verify-connection.mjsTests Supabase connectivity
deep_verify.jsDeep verification with multi-table checks
check-migration-net-loans.jsValidates migration net loan calculations

Data Fixes & Cleanup

ScriptPurpose
fix_schedule_statuses.jsFixes payment schedule statuses
fix_net_loan_released.jsCorrects net loan released amounts
fix_missing_tables.sqlSQL to create missing tables
fix_rls_local.sqlDisables RLS for local development
cleanup-undefined.tsRemoves records with undefined values
adjust_balances.jsAdjusts balance discrepancies

Sync & Reconciliation

ScriptPurpose
sync-execution.jsMonitors sync execution
sync-global.jsGlobal sync operations
sync-loan-alignment.jsAligns loan data between sources
recompute-schedules.jsRecomputes payment schedules from loan terms
reconcile-master-import.jsMaster import reconciliation
backfill-payment-schedules.jsGenerates missing payment schedules

Reports & Analysis

ScriptPurpose
collector_totals_report.jsGenerates collector totals report
combined_analysis.jsMulti-dimensional data analysis
discrepancy_details.jsDetails on data discrepancies
final_reconciliation_audit.jsFinal audit report

Backup & Restore

ScriptPurpose
backup.jsCreates Supabase data backup
restore_local.jsRestores from backup
create_empty_backups.jsCreates empty backup structure
merge_backup.jsMerges multiple backup files

Schema & Debug

ScriptPurpose
check-schema.mjsChecks Supabase schema
check-columns.mjsLists table columns
check-users.mjsLists auth users
check_project.mjsChecks project config
check_schedules.mjsValidates payment schedules
debug_schema.jsDebug schema issues
fetch_schema.mjsFetches full schema
setup_local_schema.sqlSQL for local schema setup
test-admin.mjsTest admin functionality
test-login.mjsTest login flow
test_insert.mjsTest insert operations

Specialized

ScriptPurpose
generate_hash.jsGenerates bcrypt password hashes
build-loan-map.jsBuilds borrower→loan mapping
count-json.jsCounts records in JSON files
inject_penalties.jsInjects penalty records
map-collectors.jsMaps collector names
split_names.jsSplits full names → first/last
run_memu.ps1PowerShell script for MEmu emulator

⚠️ Legacy/Temporary (Safe to Delete)

These tmp_* files are one-off debugging scripts created during development. They are not referenced anywhere and can be safely removed:

ScriptSizePurpose
tmp_check_row_690.js413BChecked specific Excel row
tmp_find_all_florenda.js578BSearched for specific borrower
tmp_inspect_keys.js645BInspected object keys
tmp_list_all_headers.js406BListed Excel headers
tmp_read_excel_struct.js715BRead Excel structure
tmp_read_headers.js479BRead Excel headers
tmp_search_excel.js1KBSearched Excel data
tmp_search_florenda_data.js452BSearched for specific data
tmp_search_loan.js1KBSearched loan records
tmp_search_name.js1.2KBSearched by name
tmp_test_event.js621BTested event handling

Total: 11 files, ~7KB — All safe to delete.

Excel → Supabase Migration Pipeline

Overview

The primary migration tool is scripts/migrate_excel.js. It reads from DCM-as-of-march-21.xlsx and writes directly to Supabase.

Pipeline Steps

  1. Extract: Read Excel file with xlsx library
  2. Map Collectors: Match collector names to existing app_collectors records (create if missing)
  3. Create Borrowers: Split names (handles "Last, First" format), create app_borrowers records, deduplicate
  4. Create Loans: Parse dates (handles Excel serial numbers), calculate interest rates, detect paid/active status from balance
  5. Rollover Detection: Automatically detects loan rollovers by comparing Net Loan proceeds with expected amounts. Marks previous loans as paid and links via previous_loan_id
  6. Payment Extraction: Reads payment amounts from date-header columns in the Excel sheet
  7. Batch Insert: All records inserted in batches of 50 to avoid Supabase rate limits

Key Functions

  • excelDateToJSDate(serial) — Converts Excel serial number to JS Date
  • splitName(fullName) — Handles "Last, First" and "First Last" formats
  • Rollover detection formula: |principal - previousBalance - netLoanProceeds| < 5

Running a Migration

# 1. Ensure .env has correct Supabase credentials
# 2. Place Excel file in project root
# 3. Run migration
node scripts/migrate_excel.js

# 4. Verify
node scripts/verify_excel_vs_supabase.js
node scripts/verify_balances.js

Post-Migration Steps

  1. Run scripts/backfill-payment-schedules.js to generate payment schedules
  2. Run scripts/recompute-schedules.js if schedule statuses need recalculation
  3. Run scripts/verify_balances.js to confirm cash calculations match
  4. Sync app: force sync from the Sync Center screen
Repository

zazakia/JetFarm

Path

.agents/skills/data-ops/SKILL.md

Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.