tdx-dev-guide

tdx-dev-guide is a skill for Claude Code, Codex from Grid0723/skills. It costs 51 tokens per session (1,003 once invoked), scanned A, original, MIT.

A complete development process for adding a new TDX data fetcher. A fetcher retrieves data, while a cleaner converts it into the format used by the database.

In plain words
What is it for?
Use it to add a new market-data task, define its database table and field mappings, implement batch retrieval, connect it to the command-line scheduler, and validate dry-run output.
Why use it?
It gives developers a defined path through API research, database design, data cleaning, fetching, command registration, and verification, reducing the chance of missing a required integration step.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/grid0723/skills/tdx-dev-guide
Any agent
npx skills add Grid0723/skills --skill tdx-dev-guide
Clone the repo
git clone --depth 1 https://github.com/Grid0723/skills

Made for: Claude Code, Codex.

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 tdx-dev-guide

README.md
[![agentmods](https://agentmods.dev/badge/skills/grid0723/skills/tdx-dev-guide.svg)](https://agentmods.dev/skills/grid0723/skills/tdx-dev-guide)
Your own site
<a href="https://agentmods.dev/skills/grid0723/skills/tdx-dev-guide"><img src="https://agentmods.dev/badge/skills/grid0723/skills/tdx-dev-guide.svg" alt="Measured on agentmods" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,003 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00051 $0.01003
Opus 5 $0.00026 $0.00502
Sonnet 5 $0.00010 $0.00201
Haiku 4.5 $0.00005 $0.00100

Measured 4d ago against content hash 9b81762cc3d4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tdx-dev-guide 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 4d 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.

tdx/tdx-dev-guide/SKILL.md · 101 lines

What it actually says

tdx-dev-guide

新增一个 TDX 数据获取器的端到端开发流程。每一步有明确的交付物验证点

Leading Words

术语 定义
Cleaner → Fetcher 流水线 数据获取分两层:Cleaner(清洗+格式转换)→ Fetcher(调用 TQ API + 批量逻辑)
field_maps 单一事实源 字段分组只存 db/field_maps.py,CLI 和 Fetcher 都从此获取
注册制 新功能通过 @register_wizard 装饰器注册,无需修改 dispatch 逻辑

步骤

1. 分析 API 返回值

查阅 tdx-quant-docs skill 中的对应 API 文档,确认:

  • 参数格式(股票代码格式、日期格式)
  • 返回值类型和数据结构
  • 是否有批量上限(99 只)
  • 完成标准:能列出 API 的完整输入输出契约

2. 设计数据表

prisma/schema.prisma 中定义 model。遵守:

  • 金额字段用 DECIMAL(36,18)
  • 日期字段用 DateTimeInt(按 TQ API 约定)
  • 复合主键:(stock_code, date) 模式
  • 完成标准:schema 通过 prisma validate
  • 然后执行 prisma migrate dev 生成迁移

3. 编写 Cleaner

继承 WideTableCleaner(DataFrame 宽表路径)或独立 Cleaner:

  • 定义字段映射(原始字段名 → 数据库列名)
  • 实现数据清洗逻辑(类型转换、空值处理)
  • 单值函数注册在 cleaners/
  • 完成标准:能用示例数据运行并产出正确格式

4. 编写 Fetcher

继承 BaseFetcher

  • 实现 fetch() 方法——调用 TQ API
  • 实现 fetch_batch()——处理 99 只分片
  • 绑定 Cleaner 属性
  • 设置 task_type 用于 CLI 调度
  • 完成标准:dry_run=True 模式下能输出数据预览

5. 注册字段映射

src/db/field_maps.py 中注册新获取器的字段分组。CLI 层通过此获取可选的字段子集。

  • 完成标准:字段分组可被 CLI 的 interactive 模块读取

6. 注册到调度器

scheduler.py 中添加新任务类型:

  • 常驻模式(tdx run):注册为定时任务
  • 独立模式(tdx fetch):添加任务分支
  • 完成标准:CLI help 中出现新任务类型

7. 注册交互参数

src/interactive/ 中注册参数采集向导:

  • 添加 @register_wizard(task_type="xxx") 装饰器
  • 定义参数步骤(股票范围、日期范围、字段筛选)
  • 完成标准:tdx init 的交互菜单中出现新选项

8. 更新配置

若需要新的 config.yaml 节,在 Config dataclass 中添加字段。

  • 完成标准:配置加载无报错

9. 文档

  • 更新 docs/04-API/内部接口契约.md(新增 API 契约)
  • 更新 docs/03-Database/数据字典.md(新增表字段说明)
  • 更新 docs/CHANGELOG.md
  • 完成标准:文档与实现一致

10. 测试

tdx-test-spec 规范执行集成验证:

  • CLI 参数采集
  • dry_run 数据预览
  • 实际数据获取
  • 数据库写入验证
  • 完成标准:全部验收子项通过

约束

  • TQ SDK 是同步 API,Prisma 是异步——用 asyncio.to_thread() 桥接
  • 所有数据库写入走 batch_upsert
  • 日志用 loguru,遵循 loguru skill 规范
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. 4d ago First seen · 101 lines · 51 tokens per session scan A 9b81762cc3d4

Subscribe to this mod's changes

tdx-dev-guide is a skill published in the GitHub repository Grid0723/skills (2 stars, last pushed 12d ago), licensed MIT. It adds 51 tokens to every session and 1,003 once invoked, about $0.0003 per session on Opus 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-31.

Related

Other skills, from other repositories

jpa-patterns

JPA/Hibernate patterns and common pitfalls (N+1, lazy loading, transactions, queries). Use when user has JPA performance issues, LazyInitializationException, or asks about entity relationships and fetching strategies.

decebals/claude-code-java · 47 tokens

api-patterns

API route implementation patterns with RLS, validation, and error handling. Use when creating API routes, implementing CRUD endpoints, adding server-side validation, handling webhooks, or implementing error handling patterns. Do NOT use for frontend-only changes or database migrations without API involvement.

bybren-llc/safe-agentic-workflow · 57 tokens

rls-patterns

Row Level Security patterns for database operations. Use when writing any database query, creating API routes that access data, implementing webhooks that write to the database, or working with user data. Enforces withUserContext, withAdminContext, or withSystemContext helpers. NEVER use direct ORM/DB calls without…

bybren-llc/safe-agentic-workflow · 71 tokens

migration-patterns

Database migration creation with mandatory RLS policies and ARCHitect approval workflow. Use when creating migrations, adding tables with RLS, updating ORM schema, adding GRANT statements, or planning data migrations. Do NOT use for application code changes without schema impact.

bybren-llc/safe-agentic-workflow · 54 tokens

ghcrawl-cluster-operator

Use when inspecting a ghcrawl SQLite store, pulling GitHub issue/PR data, refreshing summaries, embeddings, and clusters, or extracting one cluster and its evidence through the ghcrawl CLI.

vincentkoc/dotskills · 45 tokens

pattern-discovery

Pattern library discovery for pattern-first development. Use BEFORE implementing any new feature, creating components, writing API routes, or adding database operations. Ensures existing patterns are checked first.

bybren-llc/safe-agentic-workflow · 39 tokens