Agent skill

Text2sql Adhoc

by larry-zy in larry-zy/cognida

“即席取数技能,把一句话的具体数据问题翻译成 SQL 并执行返回结果。”

— description from SKILL.md by larry-zy
MITAuto-check passedDatabases

Install Text2sql Adhoc

skills CLI
$ npx skills add larry-zy/cognida --skill text2sql-adhoc -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install larry-zy/cognida text2sql-adhoc --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/larry-zy/cognida.git skills-src && mkdir -p .claude/skills && cp -r skills-src/services/cognida-go/skills/text2sql-adhoc .claude/skills/text2sql-adhoc && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
text2sql-adhoc
GitHub stars
182
Token cost
~390 tokens
SKILL.md length
65 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
MIT

At a glance

  • SKILL.md covers 何时用 / 何时不用, 标准流程, 工具 and 约束, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

About this skill

Text2sql Adhoc is a skill in larry-zy/cognida (182 stars). Its SKILL.md is about 390 tokens. Licence: MIT.

What it can do on your machine

Read from SKILL.md and the folder at commit bf76257. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are json).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Text2sql Adhoc loads about 390 tokens when it runs. Until then it costs about 12 tokens; SKILL.md has 65 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~12
When it runs · the whole SKILL.md, loaded when a task matches
~390

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from larry-zy/cognida at commit bf76257, republished under its MIT licence (© larry-zy). 65 words, ~390 tokens.

Download SKILL.mdSave it as .claude/skills/text2sql-adhoc/SKILL.md (or your agent's skills folder).
name
text2sql-adhoc
description
即席取数技能,把一句话的具体数据问题翻译成 SQL 并执行返回结果。
when_to_use
当用户要查一个具体的数字、明细或清单(如“上个月有多少订单”“列出金额 top10 的客户”),且不涉及治理指标口径、也不需要把多段查询整合成报告时使用。
category
data
tags
text2sql, sql, ad-hoc, query
version
1.0.0
author
Cognida Team

Text2SQL 即席取数

面向「单个具体问题 → 一条查询 → 一个结果」的词法 NL2SQL 场景。区别于综合报告(多段整合)与语义指标取数(走治理口径)。

何时用 / 何时不用

  • ✅ 用:一句话能说清的取数,答案是一个数、一张明细表或一个排行。
  • ❌ 不用(改走别的 skill):
    • 问的是有口径的指标(GMV、营收、客单价、复购率、客户数)→ semantic-metric
    • 要的是一份综合报告 / 多维度汇总 → report-composition

标准流程

1. get_schema 探明相关表结构与字段口径
   ↓
2. 构造最小可用 SQL(只查需要的列,带 LIMIT)
   ↓
3. sql_execute 执行
   ↓
4. 校验结果(空值/量级是否合理),说明数据来源与口径

工具

get_schema — 探表结构
json
{ "tool": "get_schema", "parameters": { "table": "orders" } }

不确定表名时先不传 table,拿到表清单再定位。

sql_execute — 执行查询
json
{ "tool": "sql_execute", "parameters": { "query": "SELECT COUNT(*) FROM orders WHERE created_at >= '2026-07-01'" } }

约束

  • 先 get_schema 再写 SQL,不要凭表名/字段名猜测。
  • 只读取所需列,避免 SELECT *;大表务必带 LIMIT。
  • 结果回答里标注:命中的表、时间范围、口径(如“订单数=去重 order_id”)。
  • 只做查询(SELECT);写操作不属于本技能范围。

结果呈现(渲染克制)

即席取数是「一个问题 → 一个结果」,渲染要与问题复杂度匹配,不要为一个简单问题堆一堆组件:

  • 单值/单行 → 一句话直接答;至多补一个 MetricCard,不必再加 Callout+图表。
  • 排行/明细(如 Top N)→ 一张 Table 足矣,配一句 Callout 说结论即可。
    • 不要再叠一张 BarChart 重复表格里同一列数字;
    • 不要为榜首单独堆 MetricCard 去重复表格第一行。
  • 只有当用户明确要「图/趋势/对比」,或分类项少、可视化确实更直观时,才加一张图表。
  • 多面板看板式布局属于 report-composition,不在本技能范围。

取表格里的单个单元格用 /table/rows/<行号>/<列名>(如榜首名称 /table/rows/0/商品名称),不是 /table/0/...。

© larry-zy, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in services/cognida-go/skills/text2sql-adhoc of larry-zy/cognida.

Open the folder on GitHubat commit bf76257

Compare with similar skills

Text2sql Adhoc next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Text2sql Adhoc compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Text2sql Adhoc this skilllarry-zy/cognida182—~390Automated safety check: PassMIT
Evolving The Data ModelTriliumNext/Trilium38k—~2.1kAutomated safety check: PassAGPL-3.0
Orchardcore Data MigrationOrchardCMS/OrchardCore8.2k—~1.7kAutomated safety check: PassBSD-3-Clause
SQL Optimization Patternsynulihao/AgentSkillOS61711 repos~3.3kAutomated safety check: PassNone
SQL PortabilityHL7/sql-on-fhir151—~512Automated safety check: PassCustom licence
StmoSAP/project-foxhound1802 repos~1.8kAutomated safety check: PassGPL-3.0

Similar skills

  • Evolving The Data Model

    TriliumNext/Trilium

    A skill your agent uses when adding a DB migration or a new column/field to a Becca entity in Trilium ("add a migration", "new column on notes/attributes", "ALTER TABLE", "add a field to…

    38k GitHub stars~2.1k tokensUpdated today
    DatabasesAuto-check passed
  • Orchardcore Data Migration

    OrchardCMS/OrchardCore

    Creates and updates OrchardCore data migrations (DataMigration classes with CreateAsync/UpdateFromX).

    8.2k GitHub stars~1.7k tokensUpdated today
    DatabasesAuto-check passed
  • SQL Optimization Patterns

    ynulihao/AgentSkillOS

    Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries.

    617 GitHub starsUsed in 11 repos~3.3k tokens
    DatabasesAuto-check passed
  • SQL Portability

    HL7/sql-on-fhir

    Analyse whether a SQL query is portable across database implementations using sqlglot transpilation.

    151 GitHub stars~512 tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • Stmo

    SAP/project-foxhound

    Official

    Manage Redash queries and dashboards on Mozilla's STMO (sql.telemetry.mozilla.org) using stmo-cli.

    180 GitHub starsUsed in 2 repos~1.8k tokens
    DatabasesAuto-check passed
  • DB Migrations

    kurealnum/dotfiles

    A skill your agent uses when generating or regenerating Drizzle migration files, changing database schema tables or columns, resolving migration sequence conflicts after rebase, reviewing migration…

    290 GitHub stars~820 tokensUpdated 5 mo ago
    DatabasesAuto-check passed

More from larry-zy/cognida

All 9 skills in this repo
  • Attribution Analysis

    larry-zy/cognida

    归因/根因分析技能,把指标的期间变化拆解到候选维度,定位驱动因子并给出置信与下钻建议. An agent skill from larry-zy/cognida.

    182 GitHub stars~524 tokensUpdated 1 mo ago
    Auto-check passed
  • Report Composition

    larry-zy/cognida

    综合报告生成技能,把多段取数(总览+趋势+分群等)整合成一份带洞察的结构化报告. An agent skill from larry-zy/cognida.

    182 GitHub stars~397 tokensUpdated 1 mo ago
    Auto-check passed
  • Semantic Metric

    larry-zy/cognida

    语义指标取数技能,先查治理好的指标语义模型,再按统一口径取指标,避免对物理表猜测. An agent skill from larry-zy/cognida.

    182 GitHub stars~329 tokensUpdated 1 mo ago
    Auto-check passed
  • Generate a comprehensive report of core e-commerce operating metrics (GMV, orders, average order value, repurchase)

    182 GitHub stars~470 tokensUpdated 1 mo ago
    Auto-check passed
  • Graph Retrieval

    larry-zy/cognida

    图谱与血缘检索技能,查询实体之间的关系、上下游依赖与数据血缘。

    182 GitHub stars~236 tokensUpdated 1 mo ago
    Auto-check passed
  • Trend Analysis

    larry-zy/cognida

    趋势分析技能,取带时间维度的序列并量化其增长/变化幅度与异常点。

    182 GitHub stars~428 tokensUpdated 1 mo ago
    Auto-check passed

Works with

Categories

Questions about Text2sql Adhoc

How do I install Text2sql Adhoc in Claude Code?

Run `npx skills add larry-zy/cognida --skill text2sql-adhoc -a claude-code`. Or copy the skill folder (services/cognida-go/skills/text2sql-adhoc in larry-zy/cognida) into .claude/skills/text2sql-adhoc in your project. Claude Code loads it when a task matches its description.

How do I install Text2sql Adhoc in Codex?

Run `npx skills add larry-zy/cognida --skill text2sql-adhoc -a codex`. Or copy the skill folder (services/cognida-go/skills/text2sql-adhoc in larry-zy/cognida) into .agents/skills/text2sql-adhoc in your project. Codex loads it when a task matches its description.

Can I use Text2sql Adhoc in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add larry-zy/cognida --skill text2sql-adhoc -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/text2sql-adhoc, .gemini/skills/text2sql-adhoc, .github/skills/text2sql-adhoc and .opencode/skills/text2sql-adhoc in your project.

What does Text2sql Adhoc need to run?

SKILL.md names no scripts, command-line tools or credentials: Text2sql Adhoc is instructions for the agent only.

Does Text2sql Adhoc access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Text2sql Adhoc safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Text2sql Adhoc use?

Text2sql Adhoc is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Text2sql Adhoc use?

About 390 tokens (SKILL.md is roughly 1.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Text2sql Adhoc?

Skills that share tags, products or a category with Text2sql Adhoc: Evolving The Data Model (TriliumNext/Trilium, 38k stars), Orchardcore Data Migration (OrchardCMS/OrchardCore, 8.2k stars), SQL Optimization Patterns (ynulihao/AgentSkillOS, 617 stars) and SQL Portability (HL7/sql-on-fhir, 151 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Text2sql Adhoc?

larry-zy (a GitHub user) maintains it in larry-zy/cognida, which has 182 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on August 31, 2026.

Source: larry-zy/cognida on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.