Install
openclaw skills install @thomaszhou22/file-to-databaseUse when the user wants to build a database from data files (CSV/Excel/JSON/JSONL/TSV), design a schema from raw data, or turn flat files into tables — AND when the user later talks to that database in natural language (add, query, update, delete records; 'how many...'; 'show me...'). Scans files, infers column types, detects candidate foreign keys, applies the methodology in references/methodology.md to produce DDL, ERD, seed scripts, and validation; runtime operations follow references/operations.md (intent → SQL → safe execution → natural-language report). Do NOT use for ORM code generation or pure database concept discussions.
openclaw skills install @thomaszhou22/file-to-databaseTurn data files (CSV / Excel / JSON / JSONL / TSV) into a validated database:
scan → infer → model → DDL → verify, following the pluggable methodology in references/methodology.md throughout.
references/methodology.md (the methodology is the soul of this skill; read it first, always)python3 --version ≥ 3.8 → script engine availableWhen the user provides files that are not CSV/Excel/JSON/JSONL/TSV (e.g. PDF textbooks, PPTX, DOCX, images), never enter the build pipeline directly and never refuse service — follow the triage in references/intake.md:
Generate a statistical profile for every data file:
python3 scripts/infer_schema.py --input <file-or-dir> [--sample N] --json
Output: per-column type inference (int/float/bool/date/uuid/text), null rate, cardinality, uniqueness, max length, sample values. Done when: one profile per file; the agent reviews ambiguous columns (mixed types, overlong text).
python3 scripts/detect_relations.py --profiles <profiles.json> --json
Output: primary-key candidates, foreign-key candidates (name matching + value-set containment, with confidence scores). Done when: every FK candidate carries confidence and evidence; low-confidence ones are listed for the user — never silently guessed.
Output per the layout in references/output-format.md:
schema.sql (DDL: tables, constraints, indexes — each index annotated with the query it serves)ERD (Mermaid erDiagram)seed.py or seed.sql (script importing data from source files, including type conversions)migrations/ (reversible migrations, expand-and-contract mode)# With a local Postgres / Docker / Supabase branch:
psql -f schema.sql && python3 seed.py
# One negative test per constraint: insert a forbidden row, assert rejection
# EXPLAIN the key queries to confirm the planned indexes are actually used
Without a database: walk through the Step 7 checklist from the methodology item by item and output the walkthrough report.
Once the database exists, the skill enters runtime mode: the user issues creates, reads, updates, and deletes in natural language; the agent handles intent recognition → SQL generation → safe execution → natural-language reporting. Full rules in references/operations.md (trigger rules, SQL generation rules, safety gates, reporting templates). Key points:
references/operations.mdOn top of the base build-and-run flows, read and enforce these four items from references/engineering.md:
.applied.json prevents duplicate or out-of-order execution; a historical migration whose checksum changed must halt with an error; rehearse one rollback for real before deliveryHonest boundary (generate but do not execute): production deploys, monitoring, load testing, capacity planning, credential custody.
| Situation | Handling |
|---|---|
| File too large for a full scan | --sample N sampling + inform the user that confidence dropped |
| Python unavailable | Pure LLM mode: read the first 100 lines of each file and profile by hand |
| FK relationship undeterminable | List candidates and ask the user; never choose silently |
| DDL execution failure | Print the full error + locate the column; fix and re-run verification |
docker-compose.yml / ORM config / a Supabase project; ask when inference fails