tdx2db: Instructions file for Claude Code

CLAUDE.md

tdx2db CLAUDE.md is an instructions file for Claude Code from xbfighting/tdx2db. It costs 1,771 tokens per session, scanned C, original, MIT.

Repository instructions for tdx2db, a tool that copies stock-market data from the local TongdaXin application into a database.

In plain words
What is it for?
Use it when developing tdx2db, installing its dependencies, syncing daily and minute-level Chinese stock data, checking database status, or updating stock and sector information.
Why use it?
It gives coding agents the project overview, setup commands, and the approved way to update and check data. It also separates contributor work from database querying.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is xbfighting/tdx2db's own configuration. It tells Claude Code how to work on tdx2db itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything tdx2db configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/xbfighting/tdx2db/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/xbfighting/tdx2db

Made for: Claude Code.

Wrote 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.

agentmods badge for tdx2db CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/xbfighting/tdx2db/claude-md/github.svg)](https://agentmods.dev/instructions/xbfighting/tdx2db/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/xbfighting/tdx2db/claude-md"><img src="https://agentmods.dev/badge/instructions/xbfighting/tdx2db/claude-md/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.

agentmods 80×15 button for tdx2db CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/xbfighting/tdx2db/claude-md"><img src="https://agentmods.dev/badge/instructions/xbfighting/tdx2db/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,771 This file is loaded in full into every session.
When invoked 1,771 The same file — it is already loaded in full.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.01771 $0.01771
Opus 5.5 $0.00708 $0.00708
Sonnet 5.5 $0.00354 $0.00354
Haiku 4.5 $0.00177 $0.00177

Measured 2mo ago against content hash 99e6bc17e5c3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

tdx2db CLAUDE.md scanned grade C with 1 finding 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf dist && uv build
CLAUDE.md · 97 lines

How it starts

The opening of the file, as written. The whole thing — 97 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

项目概述

tdx2db:从本地通达信(TDX)行情软件读取 A 股数据,增量同步到数据库。是量化分析工作站的数据入口。

本文件面向贡献者(改 tdx2db 代码)。如果你是在消费数据库(查询 daily_data 等表做分析),请读 AGENTS.md——schema、典型查询、陷阱清单都在那里,配套 skill 见 .claude/skills/tdx2db-query/。

常用命令

# 安装依赖(开发模式,含 postgres/mysql 驱动)
pip install -e '.[all]'

# 一键增量同步(日线 + 5/15/30/60 分钟线)— 日常使用这一个命令即可
tdx2db sync

# 单独同步
tdx2db daily --db-only --auto-start --incremental
tdx2db minutes --db-only --auto-start --incremental

# 同步股票列表
tdx2db stock-list --db-only

# 数据库状态一览(只读,不需要 TDX_PATH;--json 机器可读)
tdx2db status

# 板块-个股关系同步(sync 已自动包含,也可单独跑)
tdx2db blocks --db-only

板块数据链(blocks.py,issue #39):概念/指数/风格 ← T0002/hq_cache/infoharbor_block.dat(文本,板块名 8 字节截断需经 880 码还原全名);行业 ← tdxhy.cfg X 码 × tdxzs3.cfg 类别 12(881 研究行业多级);跨市场指数成分 ← spblock.dat;地区 ← base.dbf DY 字段 × tdxzs.cfg 类别 3。全量替换式快照(DELETE+INSERT),与行情表的增量语义不同。旧二进制 block_zs/gn/fg.dat 在新版通达信不存在,pytdx BlockReader 不适用。

python main.py <子命令> 与 tdx2db <子命令> 等价(main.py 是薄封装,保留老用户习惯)。包目录为 tdx2db/(v0.3.0 起从 src/ 改名,发布到 PyPI)。psycopg2-binary/pymysql 为可选依赖(extras: postgres/mysql/all),默认安装仅支持 SQLite。

测试:pytest tests/。CI 矩阵:ubuntu + windows × 3.9/3.11(+ ubuntu 3.10)——Windows 是用户主场景必须覆盖。tests/fixtures/ 存 .day/.lc5 二进制解析 fixture(合成字节,生成器 make_fixtures.py;断言值与生成参数一一对应)。数据正确性验证仍以运行 sync 后检查数据库为准。

发布 PyPI(维护者)

版本号需同步 bump 两处:pyproject.toml 与 tdx2db/__init__.py(教训:v0.3.0 曾漏改后者)。发布 token 为项目级,存本地 .env 的 PYPI_PROJECT_TOKEN(gitignored,勿打印其值):

rm -rf dist && uv build
UV_PUBLISH_TOKEN=$(grep '^PYPI_PROJECT_TOKEN=' .env | cut -d= -f2-) uv publish

发布后必须在全新 venv pip install tdx2db==<版本> 验证(含从工作目录读 .env 的脚本入口场景,教训见 v0.3.1)。增量/幂等类改动的冒烟必须跑两轮(首轮全量 + 次轮增量)。

架构

四层管道,单向数据流:

CLI (cli.py)  → Reader (reader.py) → Processor (processor.py) → Storage (storage.py)
    ↓                ↓                      ↓                        ↓
 argparse        pytdx 读取本地       校验 + 重采样 + 均线      SQLAlchemy 批量写库
 命令分发 +      .day/.lc5 文件       (OHLCV 校验, resample,   支持增量 ON CONFLICT
 同步编排                              MA5~MA250)               表名白名单保护

Read the full file on GitHub · 97 lines

Changes

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.

  1. 2mo ago First seen · 97 lines · 1,771 tokens per session scan C 99e6bc17e5c3

Subscribe to this mod's changes

tdx2db CLAUDE.md is an instructions file published in the GitHub repository xbfighting/tdx2db (177 stars, last pushed 1mo ago), licensed MIT. It adds 1,771 tokens to every session, about $0.0071 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

tdx2db CLAUDE.md compared with instructions from other repositories

tdx2db CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
tdx2db CLAUDE.mdxbfighting/tdx2dbInstructions file1771mo agoMITC1,771Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file275k2d agoMITA4,313Codex, OpenCode