text-to-sql
Skill26 starsChanged 8 days agoMITView on GitHub
Write SQL (or a dbt model's SELECT) for a question about a database whose schema EKOS has compiled, using the ekos MCP tools to ground every table, column, join and value, and ekos_sql_check to catch mistakes before answering. Use whenever the user asks for a query, report SQL, a metric definition or a dbt model against tables in an EKOS project — "write SQL that…", "how many X per Y", "build a model for…" — even if they never say "EKOS".
1 other project uses a version of this.
Adopted by
Most recently taken up by
- nicholyx/ai-skillstheir own version, first seen May 16, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- nicholyx/ai-skills★ 6same 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 repository4 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ekos-knowledgeSkill
- memorySkill
- session-memorySkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Learn the engine's rules: Call ekos_sql_check with only dialect (or none, for the project's): it returns that engine's rules — row limits …
- Distinctive: line 67
Do not invent a column because the question uses a word for it — search, then ask if absent.
- Distinctive: line 68
Do not trust an empty findings list as proof: the check is static and cannot see values or row counts.
- Very specific: line 70
Do not run anything that writes.
≈ “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
Text-to-SQL over an EKOS project
EKOS compiles a database's DDL, comments and foreign keys into its ledger. Use the ledger as
the schema: never guess a table, column, join or literal value you have not seen there or in
the data. Measured on BIRD Mini-Dev (RFC 0241/0242), most wrong answers ran fine and looked
plausible; the errors were in meaning — a value spelled differently in the data, rows repeated
by a join, a sentinel 0 averaged in, integer division, NULLs sorted first. The procedure below
targets exactly those.
Procedure
- Learn the engine's rules. Call
ekos_sql_checkwith onlydialect(or none, for the project's): it returns that engine's rules — row limits (FETCH FIRSTon Oracle,TOPon SQL Server), integer division, quoting, case sensitivity, dates. Follow them while drafting. - Find the tables.
ekos_searchwith the question's nouns (2–3 keywords), orekos_eklFIND Object WHERE kind = 'Table'for a small schema. Read each candidate withekos_state(itscolumnsproperty holds names, types, keys and descriptions). - Find the join path. Join only on foreign keys the ledger records
(
ekos_neighborhoodon the table shows itsForeignKeyedges). Joining two child tables on a shared parent key multiplies rows — aggregate each side first, or countDISTINCT. - Check every literal. A value in the question ("Germany", "retail", "2017") must match
the stored spelling and format. If a database is available, look:
SELECT DISTINCT col … WHERE col LIKE '%Germany%' LIMIT 10. Text may be a list ('Artifact,Creature') →LIKE, or part of a longer value ('Berlin, Germany') →LIKE; dates are often text in a fixed format → compare in that format or withsubstr/strftime. - Decide the grain. What is one row of each table, and what does the question count —
entities, events, rows? Count
DISTINCTentities when a join repeats them. - Draft the SQL, returning exactly the columns asked, in the order asked.
- Run
ekos_sql_checkwith the draft (anddialectif not the project's). Fix everyerror; read everywarnand either fix it or say why it does not apply:L001unknown name → use the suggested real name.L002join off the foreign keys → use the path given, or justify the join.L003=on a list column →LIKE '%x%'.L005integer division → multiply the numerator by 1.0 (or cast it) for ratios and percentages.L006aggregate over a sentinel → filter the sentinel out.L007ascendingORDER BY … LIMITon a nullable column →IS NOT NULL.L008date literal format → match the stored format.L009row-limit form,L010ILIKE,L011identifier quoting → the dialect's own form.
- Preview when you can. A person (not the MCP server) can run
ekos sql check q.sql --database <name>(or--sqlite <file>): the same checks plus read-only probes on the live database — the result, value spellings, rows repeated by joins, ties.ekos sql generate "<question>" --database <name>runs this whole procedure as an agent. With any read-only connection: an empty result, a single NULL, or two rows tied at the top of anORDER BY … LIMIT 1all mean the query needs another look. - Answer with the SQL, the tables and join path it uses, and any assumption you made about a value or definition the ledger does not state.
dbt models
The same steps apply to a model's SELECT. Reference upstream models and sources with
{{ ref('…') }} / {{ source('…', '…') }} names that exist in the ledger (dbt models are
Table objects recovered from the project). Check the SELECT with ekos_sql_check before
templating it, with dialect set to the warehouse's (trino, postgres, snowflake, …).
What not to do
- Do not invent a column because the question uses a word for it — search, then ask if absent.
- Do not trust an empty findings list as proof: the check is static and cannot see values or row counts. Steps 3, 4 and 7 cover what it cannot.
- Do not run anything that writes. EKOS's tools are read-only; so must your previews be.
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.

