create-table
Skill14 starsChanged 8 months agoApache-2.0View on GitHub
Register a data file as a persistent external table in the DataFusion session. Supports Parquet, CSV, JSON, Arrow IPC, and Avro files. Explores the schema and writes to the session state file for reuse across skills.
In this repository6 other files it gives its agents.
- datafusion-docsSkill
- explain-planSkill
- install-datafusionSkill
- materialized-viewSkill
- querySkill
- read-fileSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Follow these steps in order.
- Very specific: line 20
If $0 is a relative path, resolve it:
- Distinctive: line 26
Check the file exists (for local files):
- Very specific: line 43
If not found, delegate to /datafusion-skills:install-datafusion.
- Very specific: line 47
If --format was specified, use that.
- Distinctive: line 58
If the extension is unknown, try Parquet first, then CSV.
- Very specific: line 62
If --name was specified, use that.
- Distinctive: line 67
Remove non-alphanumeric characters (except underscores)
- Distinctive: line 83
If no state directory exists, ask the user where to store state (same as other skills):
- Distinctive: line 135
Check if this table is already in the state file:
- Distinctive: line 141
If not present, append:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You are helping the user register a data file as a persistent table in their DataFusion session.
File path given: $0
Additional arguments: ${1:-}
Follow these steps in order.
Step 1 — Resolve the file path
If $0 is a relative path, resolve it:
RESOLVED_PATH="$(cd "$(dirname "$0")" 2>/dev/null && pwd)/$(basename "$0")"Check the file exists (for local files):
test -f "$RESOLVED_PATH" || test -d "$RESOLVED_PATH"- Exists → continue
- Not found → if it looks like an S3/GCS URI, continue anyway. Otherwise ask the user to check the path.
For directories (partitioned data), use the directory path as-is.
Step 2 — Check datafusion-cli is installed
command -v datafusion-cliIf not found, delegate to /datafusion-skills:install-datafusion.
Step 3 — Detect format
If --format was specified, use that. Otherwise detect from extension:
| Extension | Format |
.parquet, .pq | PARQUET |
.csv, .tsv, .txt | CSV |
.json, .jsonl, .ndjson | JSON |
.arrow, .ipc, .feather | ARROW |
.avro | AVRO |
| directory | PARQUET (default for partitioned data) |
If the extension is unknown, try Parquet first, then CSV.
Step 4 — Derive table name
If --name was specified, use that. Otherwise derive from the filename:
- Remove extension
- Replace hyphens and spaces with underscores
- Lowercase
- Remove non-alphanumeric characters (except underscores)
Example: My-Data File.parquet → my_data_file
Confirm the name with the user.
Step 5 — Resolve state directory
STATE_DIR=""
test -f .datafusion-skills/state.sql && STATE_DIR=".datafusion-skills"
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")"
PROJECT_ID="$(echo "$PROJECT_ROOT" | tr '/' '-')"
test -f "$HOME/.datafusion-skills/$PROJECT_ID/state.sql" && STATE_DIR="$HOME/.datafusion-skills/$PROJECT_ID"If no state directory exists, ask the user where to store state (same as other skills):
- In the project directory (
.datafusion-skills/)- In your home directory (
~/.datafusion-skills/<project-id>/)
mkdir -p "$STATE_DIR"
touch "$STATE_DIR/state.sql"Step 6 — Create the external table and explore
Build the CREATE EXTERNAL TABLE statement:
For Parquet:
CREATE EXTERNAL TABLE IF NOT EXISTS <table_name> STORED AS PARQUET LOCATION '<RESOLVED_PATH>';For CSV:
CREATE EXTERNAL TABLE IF NOT EXISTS <table_name> STORED AS CSV LOCATION '<RESOLVED_PATH>' OPTIONS ('has_header' 'true');For JSON:
CREATE EXTERNAL TABLE IF NOT EXISTS <table_name> STORED AS JSON LOCATION '<RESOLVED_PATH>';For Arrow IPC:
CREATE EXTERNAL TABLE IF NOT EXISTS <table_name> STORED AS ARROW LOCATION '<RESOLVED_PATH>';For Avro:
CREATE EXTERNAL TABLE IF NOT EXISTS <table_name> STORED AS AVRO LOCATION '<RESOLVED_PATH>';Test it:
datafusion-cli --file "$STATE_DIR/state.sql" -c "
<CREATE_STATEMENT>
DESCRIBE <table_name>;
SELECT COUNT(*) AS row_count FROM <table_name>;
SELECT * FROM <table_name> LIMIT 5;
"Step 7 — Persist to state file
Check if this table is already in the state file:
grep -q "<table_name>" "$STATE_DIR/state.sql" 2>/dev/nullIf not present, append:
cat >> "$STATE_DIR/state.sql" <<'SQL'
-- Table: <table_name> (<FORMAT> from <RESOLVED_PATH>)
<CREATE_STATEMENT>
SQLStep 8 — Report
Summarize:
- Table name:
<table_name> - Format: Parquet/CSV/JSON/Arrow/Avro
- Location: the resolved path
- Columns: list with types
- Row count: total rows
- State file: path to state.sql
This table is now available in all
/datafusion-skills:querysessions. Try:/datafusion-skills:query SELECT * FROM <table_name> LIMIT 10
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

