explain-plan
Skill14 starsChanged 8 months agoApache-2.0View on GitHub
Visualize and analyze DataFusion query execution plans. Shows logical and physical plans, identifies performance bottlenecks, and suggests optimizations. Supports EXPLAIN and EXPLAIN ANALYZE.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- mdaneshjoo/skillstheir own version, first seen Nov 8, 2026
- jocarrd/crux-agentstheir own version, first seen Nov 8, 2026
- rhawk117/cc-terraform-harnesstheir own version, first seen Oct 25, 2026
- hass-energy/haeotheir own version, first seen Oct 8, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- hass-energy/haeo★ 77same name
- jocarrd/crux-agents★ 4same name
- rhawk117/cc-terraform-harness★ 1same name
- mdaneshjoo/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- create-tableSkill
- datafusion-docsSkill
- install-datafusionSkill
- materialized-viewSkill
- querySkill
- read-fileSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 4 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
4
Distinctive
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
- Very specific: line 21
If not found, delegate to /datafusion-skills:install-datafusion.
- Very specific: line 35
If --analyze is present → use EXPLAIN ANALYZE (actually runs the query, shows real metrics)
- Very specific: line 40
If the input is natural language, generate SQL first (see /datafusion-skills:query for SQL generation guidelines).
- Distinctive: line 76
Check if filter pushdown is happening
- Very specific: line 94
Look for predicate in TableScan nodes
- Distinctive: line 123
Add indexes or sort data
- Distinctive: line 126
Use partitioned data layout
- Distinctive: line 130
If relevant, suggest DataFusion configuration changes:
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “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 understand and optimize query execution plans in Apache DataFusion.
Input: $@
Step 1 — Check datafusion-cli is installed
command -v datafusion-cliIf not found, delegate to /datafusion-skills:install-datafusion.
Step 2 — Resolve state
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"Step 3 — Determine the mode
- If
--analyzeis present → useEXPLAIN ANALYZE(actually runs the query, shows real metrics) - Otherwise → use
EXPLAIN(shows the plan without execution)
Extract the SQL query (remove --analyze flag if present).
If the input is natural language, generate SQL first (see /datafusion-skills:query for SQL generation guidelines).
Step 4 — Run EXPLAIN
Physical plan (default — shows the execution plan as a visual tree):
datafusion-cli ${STATE_DIR:+--file "$STATE_DIR/state.sql"} -c "
EXPLAIN $SQL;
"Verbose plan (full optimizer trace — initial logical plan, each optimization pass, initial physical plan, final physical plan with stats and schema):
datafusion-cli ${STATE_DIR:+--file "$STATE_DIR/state.sql"} -c "
EXPLAIN VERBOSE $SQL;
"With actual metrics (if --analyze) (runs the query, reports per-operator row counts, timing, memory, spill stats):
datafusion-cli ${STATE_DIR:+--file "$STATE_DIR/state.sql"} -c "
EXPLAIN ANALYZE $SQL;
"Step 5 — Analyze the plan
Parse the execution plan output and provide insights:
Key things to look for:
- Full table scans → Look for
TableScanwithout pushdown predicates- Suggest adding
WHEREclauses or partitioning - Check if filter pushdown is happening
- Suggest adding
- Sort operations →
SortExecorSortPreservingMergeExec- Expensive for large datasets
- Suggest pre-sorting data or using sorted Parquet files
- Hash joins vs merge joins →
HashJoinExecvsSortMergeJoinExec- Hash joins need memory for the build side
- Suggest which table should be the build side (smaller table)
- Repartitioning →
RepartitionExec- Shows data shuffling between partitions
- Can be expensive for large datasets
- Projection pushdown → Check if only needed columns are read
- DataFusion should push projections down to the scan
- Predicate pushdown → Check if filters are pushed to the scan level
- Look for
predicateinTableScannodes
- Look for
- Coalesce partitions →
CoalescePartitionsExec- Merging partitions back to single partition
- Expected at the top of the plan
For EXPLAIN ANALYZE, additionally check:
- Row counts at each stage → identify data amplification or reduction
- Execution time per operator → find the bottleneck
- Memory usage → identify memory-intensive operations
Step 6 — Present findings
Structure the analysis as:
Query Plan Summary
Brief description of what the plan does.
Plan Visualization
Present the plan as an indented tree (already DataFusion's default output format).
Performance Analysis
- Bottlenecks: Operations that are likely slowest
- Optimizations applied: Filter pushdown, projection pushdown, etc.
- Opportunities: Suggestions for improving performance
Recommendations
Actionable suggestions, such as:
- Add indexes or sort data
- Rewrite the query to enable better pushdown
- Adjust DataFusion configuration options
- Use partitioned data layout
Step 7 — Suggest configuration tuning
If relevant, suggest DataFusion configuration changes:
-- Increase target partitions for more parallelism
SET datafusion.execution.target_partitions = 8;
-- Increase batch size for throughput
SET datafusion.execution.batch_size = 16384;
-- Enable/disable optimizations
SET datafusion.optimizer.enable_round_robin_repartition = true;To explore these settings, try
/datafusion-skills:datafusion-docs configuration options.
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.

