query
Skill598 starsChanged 8 months agoMITView on GitHub
Run SQL queries against the attached DuckDB database or ad-hoc against files. Accepts raw SQL or natural language questions. Uses DuckDB Friendly SQL idioms.
- Deletes or force-pushes
38 other projects use a version of this, 1 of them edited; 2 new projects in the last 4 weeks, against 0 the 4 before.
Adopted by
Surging: 2 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Most recently taken up by
- hydra-db/hydradb-claude-codetheir own version, first seen Nov 8, 2026
- justmytwospence/strava-mcpword for word, first seen Nov 8, 2026
- levi-qiao/obsidian-llm-wikitheir own version, first seen Nov 8, 2026
- prdlk/skillsword for word, first seen Nov 1, 2026
- honeydew-ai/honeydew-ai-coding-agents-pluginstheir own version, first seen Nov 1, 2026
- aibtcdev/skillstheir own version, first seen Oct 26, 2026
Used with
Projects with it also use ingest, lint and 6 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
JaimeGBASkillingest
Digest an external source (article, paper, transcript, URL, book chapter) and integrate its content into the knowledge base
Also in 18 projects that use this
Microsoft AzureSkilllint
Run all linting and spell checking for TypeScript and Rust code. Run this before committing to catch style issues, clippy warnings, and misspellings.
Also in 17 projects that use this
seongjaeryuSkillsave
Complete and save your current thinking to Bindly
Also in 4 projects that use this
AnthropicSkillstart
Set up your bio-research environment and explore available tools. Use when first getting oriented with the plugin, checking which literature, drug-discovery, or visualization MCP servers are connected, or surveying available analysis skills before starting a new project.
Also in 4 projects that use this
MicrosoftSkilldoctor
Diagnose an Amplifier CLI environment through the CLI doctor agent. USE WHEN a user requests CLI runtime, settings or missing-capability inspection. DO NOT USE for project bugs or other hosts.
Also in 3 projects that use this
Microsoft AzureSkillreflect
Learning capture system that extracts HIGH/MED/LOW confidence patterns from conversations to prevent repeating mistakes. Use after user corrections ("no", "wrong"), praise ("perfect", "exactly"), or when discovering edge cases. Complements .squad/agents/{agent}/history.md and .squad/decisions.md.
Also in 3 projects that use this
Other versions38 projects use a version of this.
Word for word · 3
- Kaalia0912/dsh-data-analysis-mode★ 2100% same
- prdlk/skills★ 1100% same
- justmytwospence/strava-mcp★ 0100% same
Edited · 1
- datafusion-contrib/datafusion-skills★ 1420% same
Wrote their own version · 34
- garrytan/gbrain★ 32ksame name
- facebookincubator/velox★ 4.3ksame name
- jason-effi-lab/karpathy-llm-wiki-vault★ 718same name
- ArtemXTech/claude-code-obsidian-starter★ 225same name
- HurricaHjz/SecondSelf★ 156same name
- romarayt/raytsystem-public-os★ 140same name
- HurricaHjz/second-yourself★ 105same name
- StarRocks/starrocks-debug-skills★ 77same name
- MetamusicX/zissa-wiki★ 58same name
- honeydew-ai/honeydew-ai-coding-agents-plugins★ 43same name
24 more not listed
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 repository8 other files it gives its agents.
- attach-dbSkill
- convert-fileSkill
- duckdb-docsSkill
- install-duckdbSkill
- read-fileSkill
- read-memoriesSkill
- s3-exploreSkill
- spatialSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 0 are common, 13 are distinctive, and 10 are very specific to this project.
0
Common
Most of the 28 edited versions we read keep these.
13
Distinctive
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Follow these steps in order.
- Distinctive: line 18
Look for an existing state file in either location:
- Distinctive: line 28
If found, verify the databases it references are still accessible:
- Very specific: line 36
Ad-hoc mode: if: the --file flag is present, or the SQL references file paths/literals (e.g.
- Very specific: line 37
Session mode: if: STATE_DIR is set and the input references table names, is natural language, or is SQL without file references.
- Very specific: line 39
If no state file exists and no file is referenced, fall back to ad-hoc mode against :memory: — the user must reference files directly in …
- Distinctive: line 41
If the state file exists but any ATTACH in it fails, warn the user and fall back to ad-hoc mode.
- Very specific: line 49
If not found, delegate to /duckdb-skills:install-duckdb and then continue.
- Distinctive: line 53
If the input is natural language (not valid SQL), generate SQL using the Friendly SQL reference below.
- Distinctive: line 69
Use the schema context and the Friendly SQL reference to generate the most appropriate query.
- Distinctive: line 73
Before executing, estimate whether the query could produce a very large result that would consume excessive tokens when returned to this …
- Very specific: line 99
If the query already has a LIMIT, count(), or other aggregation that bounds the output -> safe, proceed.
- Distinctive: line 100
If the source has >1M rows and the query has no LIMIT or aggregation -> tell the user: *"This query would return a very large result set.
- Distinctive: line 102
Ask for confirmation before running as-is.
- Distinctive: line 103
If the data size is >10 GB -> additionally warn: *"This table is over 10 GB — the query may take a while to complete."* Proceed if the user …
- Very specific: line 124
If multiple files are referenced, include all paths in the allowed_paths list.
- Very specific: line 140
Always use heredocs (<<'SQL') for multi-line queries to avoid shell quoting issues.
- Very specific: line 148
Persistent or unclear DuckDB error: use /duckdb-skills:duckdb-docs <error message or relevant keywords> to search the documentation for …
- Distinctive: line 160
When generating SQL, prefer these idiomatic DuckDB constructs:
- Very specific: line 174
count(): no need for count(*)
- Distinctive: line 175
Reusable aliases: use column aliases in WHERE / GROUP BY / HAVING
- Very specific: line 205
CREATE OR REPLACE TABLE: no need for DROP TABLE IF EXISTS first
- Distinctive: line 206
CREATE TABLE ... AS SELECT (CTAS): create tables from query results
“Common” is measured: kept by at least 6 in 10 of the 28 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 query data using DuckDB.
Input: $@
Follow these steps in order.
Step 1 — Resolve state and determine the mode
Look for an existing state file in either location:
STATE_DIR=""
test -f .duckdb-skills/state.sql && STATE_DIR=".duckdb-skills"
PROJECT_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")"
PROJECT_ID="$(echo "$PROJECT_ROOT" | tr '/' '-')"
test -f "$HOME/.duckdb-skills/$PROJECT_ID/state.sql" && STATE_DIR="$HOME/.duckdb-skills/$PROJECT_ID"If found, verify the databases it references are still accessible:
duckdb -init "$STATE_DIR/state.sql" -c "SHOW DATABASES;"Now determine the mode:
- Ad-hoc mode if: the
--fileflag is present, or the SQL references file paths/literals (e.g.FROM 'data.csv'), orSTATE_DIRis empty. - Session mode if:
STATE_DIRis set and the input references table names, is natural language, or is SQL without file references.
If no state file exists and no file is referenced, fall back to ad-hoc mode against :memory: — the user must reference files directly in their SQL.
If the state file exists but any ATTACH in it fails, warn the user and fall back to ad-hoc mode.
Step 2 — Check DuckDB is installed
command -v duckdbIf not found, delegate to /duckdb-skills:install-duckdb and then continue.
Step 3 — Generate SQL if needed
If the input is natural language (not valid SQL), generate SQL using the Friendly SQL reference below.
In session mode, first retrieve the schema to inform query generation:
duckdb -init "$STATE_DIR/state.sql" -csv -c "
SELECT table_name FROM duckdb_tables() ORDER BY table_name;
"Then for relevant tables:
duckdb -init "$STATE_DIR/state.sql" -csv -c "DESCRIBE <table_name>;"Use the schema context and the Friendly SQL reference to generate the most appropriate query.
Step 4 — Estimate result size
Before executing, estimate whether the query could produce a very large result that would consume excessive tokens when returned to this conversation.
Session mode — check row counts for the tables involved:
duckdb -init "$STATE_DIR/state.sql" -csv -c "
SELECT table_name, estimated_size, column_count
FROM duckdb_tables()
WHERE table_name IN ('<table1>', '<table2>');
"Ad-hoc mode — probe the source:
duckdb :memory: -csv -c "
SET allowed_paths=['FILE_PATH'];
SET enable_external_access=false;
SET allow_persistent_secrets=false;
SET lock_configuration=true;
SELECT count() AS row_count FROM 'FILE_PATH';
"Evaluate:
- If the query already has a
LIMIT,count(), or other aggregation that bounds the output -> safe, proceed. - If the source has >1M rows and the query has no LIMIT or aggregation -> tell the user:
"This query would return a very large result set. Displaying it here would consume a lot of tokens and increase cost. I'd recommend adding
LIMIT 1000or an aggregation to keep the output manageable." Ask for confirmation before running as-is. - If the data size is >10 GB -> additionally warn: "This table is over 10 GB — the query may take a while to complete." Proceed if the user confirms.
Skip this step for queries that are intrinsically bounded (e.g. DESCRIBE, SUMMARIZE, aggregations, count()).
Step 5 — Execute the query
Ad-hoc mode (sandboxed — only the referenced file is accessible):
duckdb :memory: -csv <<'SQL'
SET allowed_paths=['FILE_PATH'];
SET enable_external_access=false;
SET allow_persistent_secrets=false;
SET lock_configuration=true;
<QUERY>;
SQLReplace FILE_PATH with the actual file path extracted from the query or --file argument.
If multiple files are referenced, include all paths in the allowed_paths list.
Session mode (user-trusted database):
duckdb -init "$STATE_DIR/state.sql" -csv -c "<QUERY>"For multi-line queries, use a heredoc with -init:
duckdb -init "$STATE_DIR/state.sql" -csv <<'SQL'
<QUERY>;
SQLAlways use heredocs (<<'SQL') for multi-line queries to avoid shell quoting issues.
Step 6 — Handle errors
- Syntax error: show the error, suggest a corrected query, and re-run.
- Missing extension (e.g.
Extension "X" not loaded): delegate to/duckdb-skills:install-duckdb <ext>, then retry. - Table not found (session mode): list available tables with
FROM duckdb_tables()and suggest corrections. - File not found (ad-hoc mode): use
find "$PWD" -name "<filename>" 2>/dev/nullto locate the file and suggest the corrected path. - Persistent or unclear DuckDB error: use
/duckdb-skills:duckdb-docs <error message or relevant keywords>to search the documentation for guidance, then apply the fix and retry.
Step 7 — Present results
Show the query output to the user. If the result has more than 100 rows, note the truncation and suggest adding LIMIT to the query.
For natural language questions, also provide a brief interpretation of the results.
DuckDB Friendly SQL Reference
When generating SQL, prefer these idiomatic DuckDB constructs:
Compact clauses
- FROM-first:
FROM table WHERE x > 10(implicitSELECT *) - GROUP BY ALL: auto-groups by all non-aggregate columns
- ORDER BY ALL: orders by all columns for deterministic results
- SELECT * EXCLUDE (col1, col2): drop columns from wildcard
- SELECT * REPLACE (expr AS col): transform a column in-place
- UNION ALL BY NAME: combine tables with different column orders
- Percentage LIMIT:
LIMIT 10%returns a percentage of rows - Prefix aliases:
SELECT x: 42instead ofSELECT 42 AS x - Trailing commas allowed in SELECT lists
Query features
- count(): no need for
count(*) - Reusable aliases: use column aliases in WHERE / GROUP BY / HAVING
- Lateral column aliases:
SELECT i+1 AS j, j+2 AS k - COLUMNS(*): apply expressions across columns; supports regex, EXCLUDE, REPLACE, lambdas
- FILTER clause:
count() FILTER (WHERE x > 10)for conditional aggregation - GROUPING SETS / CUBE / ROLLUP: advanced multi-level aggregation
- Top-N per group:
max(col, 3)returns top 3 as a list; alsoarg_max(arg, val, n),min_by(arg, val, n) - DESCRIBE table_name: schema summary (column names and types)
- SUMMARIZE table_name: instant statistical profile
- PIVOT / UNPIVOT: reshape between wide and long formats
- SET VARIABLE x = expr: define SQL-level variables, reference with
getvariable('x')
Data import
- Direct file queries:
FROM 'file.csv',FROM 'data.parquet' - Globbing:
FROM 'data/part-*.parquet'reads multiple files - Auto-detection: CSV headers and schemas are inferred automatically
Expressions and types
- Dot operator chaining:
'hello'.upper()orcol.trim().lower() - List comprehensions:
[x*2 FOR x IN list_col] - List/string slicing:
col[1:3], negative indexingcol[-1] - STRUCT. notation*:
SELECT s.* FROM (SELECT {'a': 1, 'b': 2} AS s) - Square bracket lists:
[1, 2, 3] - format():
format('{}->{}', a, b)for string formatting
Joins
- ASOF joins: approximate matching on ordered data (e.g. timestamps)
- POSITIONAL joins: match rows by position, not keys
- LATERAL joins: reference prior table expressions in subqueries
Data modification
- CREATE OR REPLACE TABLE: no need for
DROP TABLE IF EXISTSfirst - CREATE TABLE ... AS SELECT (CTAS): create tables from query results
- INSERT INTO ... BY NAME: match columns by name, not position
- INSERT OR IGNORE INTO / INSERT OR REPLACE INTO: upsert patterns
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.

