Borrowing it
Nothing to install: this file belongs to xbfighting/tdx2db. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/xbfighting/tdx2db/master/.claude/skills/tdx2db-query/SKILL.mdgit clone --depth 1 https://github.com/xbfighting/tdx2dbWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/xbfighting/tdx2db/tdx2db-query)<a href="https://agentmods.dev/skills/xbfighting/tdx2db/tdx2db-query"><img src="https://agentmods.dev/badge/skills/xbfighting/tdx2db/tdx2db-query/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/xbfighting/tdx2db/tdx2db-query"><img src="https://agentmods.dev/badge/skills/xbfighting/tdx2db/tdx2db-query.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00055 | $0.01563 |
| Opus 5.5 | $0.00022 | $0.00625 |
| Sonnet 5.5 | $0.00011 | $0.00313 |
| Haiku 4.5 | $0.00006 | $0.00156 |
Grade A, and why
tdx2db-query scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 109 lines — stays where its author put it; the contents beside it link to each section on GitHub.
tdx2db 数据库查询手册
数据库由 tdx2db sync 写入(PostgreSQL / MySQL / SQLite,连接配置见项目 .env)。查询前先读 AGENTS.md 的 schema 与陷阱清单;本 skill 提供可直接套用的操作模板。
第一步永远是确认数据状态
tdx2db status --json
关注三点:daily_data.latest 是否为预期交易日;rows/codes 是否符合常识(全市场约 4000+ 只);warnings 是否为空。任何分析在数据不新鲜/不完整时都是白做。
SQL 模板
单票日线(含缠论均线族)
SELECT date, open, high, low, close, volume, amount,
ma5, ma13, ma21, ma34, ma55, ma89, ma144, ma233
FROM daily_data
WHERE code = :code6 -- 6 位纯数字,如 '600036',不带 sh/sz 前缀!
AND date BETWEEN :start AND :end
ORDER BY date;
某日全市场截面(成熟股票)
SELECT code, close, ma5, ma13, ma21, ma34, ma55, ma89, ma144, ma233
FROM daily_data
WHERE date = :d AND ma233 IS NOT NULL; -- ma233 非空 ≈ 上市满一年,天然剔除次新股
最新可用交易日
SELECT MAX(date) FROM daily_data WHERE ma5 IS NOT NULL;
分钟线(表按周期选:minute5_data / minute15_data / minute30_data / minute60_data)
SELECT datetime, open, high, low, close, volume, amount
FROM minute30_data
WHERE code = :code6 AND datetime BETWEEN :start AND :end
ORDER BY datetime;
周线/月线:无独立表,取日线后 pandas resample('W')/resample('ME') 聚合(open=first, high=max, low=min, close=last, volume/amount=sum)。
板块成分 / 个股板块归属(block_type ∈ 行业/概念/指数/地区/风格/特殊)
-- 板块 → 成分(行业为 881 研究行业,一/二/三级各一行,按名或 block_code 定位)
SELECT code FROM block_stock_relation
WHERE block_type = '行业' AND block_name = '煤炭开采';
-- 全部二级行业(≈ 通达信导出 CSV 的行业口径,板块强弱迭代用这个)
SELECT DISTINCT block_name FROM block_stock_relation
WHERE block_type = '行业' AND block_level = 2;
-- 个股 → 全部板块归属
SELECT block_type, block_code, block_name FROM block_stock_relation WHERE code = :code6;
-- 板块成分 JOIN 行情(北交所成员在行情表无数据,JOIN 自然过滤)
SELECT d.code, d.close, d.ma233
FROM block_stock_relation b JOIN daily_data d ON d.code = b.code
WHERE b.block_type = '概念' AND b.block_name = '人形机器人' AND d.date = :d;
板块表为全量快照(随 sync 更新,无历史版本);板块名以 tdxzs.cfg 官方全名为准,跨口径对齐用 block_code。
换手率 / 次新股过滤(股本与上市日期在 stock_info,万股,快照口径)
-- 换手率(%):volume(手)/ltag(万股) 单位差恰好抵消;股本变动点前的历史值失真
SELECT d.date, d.volume / s.ltag AS turnover_pct
FROM daily_data d JOIN stock_info s ON RIGHT(s.code, 6) = d.code
WHERE d.code = :code6 ORDER BY d.date DESC LIMIT 20;
-- 剔除次新股(上市不足 500 天)
SELECT RIGHT(code, 6) FROM stock_info WHERE list_date < CURRENT_DATE - 500;
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 109 lines · 55 tokens per session scan A cf71bccd3686
tdx2db-query is a skill published in the GitHub repository xbfighting/tdx2db (177 stars, last pushed 1mo ago), licensed MIT. It adds 55 tokens to every session and 1,563 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
tdx2db-query compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| tdx2db-queryxbfighting/tdx2db | Skill | 177 | 1mo ago | MIT | A | 55 | Claude Code |
| accounting-software-selectionsickn33/agentic-awesome-skills | Skill | 49k | today | MIT | A | 37 | Claude Code |
| accounting-audit-system-buildersickn33/agentic-awesome-skills | Skill | 49k | today | MIT | A | 41 | Claude Code |
| erp-sqlmicrosoft/Dataverse-skills | Skill | 255 | today | MIT | A | 69 | Claude Code |
| trading-manual-writerdigoal/blog | Skill | 8.6k | 3d ago | GPL-2.0 | A | 185 | Claude Code, Codex |
| multi-expert-analyzerdigoal/blog | Skill | 8.6k | 3d ago | GPL-2.0 | A | 292 | Codex |
| retail-trading-manual-writerdigoal/blog | Skill | 8.6k | 3d ago | GPL-2.0 | A | 140 | Codex |