tushare-plugin-builder

tushare-plugin-builder is a skill for Claude Code, Codex from Yourdaylight/stock_datasource. It costs 56 tokens per session (3,737 once invoked), scanned A, original, MIT.

Instructions for turning a Tushare API document into a complete stock-data plugin. Tushare is a service that provides financial market data through an API.

In plain words
What is it for?
Use it to build or review a Tushare plugin with data extraction, ClickHouse storage tables, configuration, query services, and testable curl requests.
Why use it?
It defines the files and processing steps needed to collect, validate, transform, store, and expose data consistently in the existing codebase.

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/yourdaylight/stock_datasource/tushare-plugin-builder
Any agent
npx skills add Yourdaylight/stock_datasource --skill tushare-plugin-builder
Clone the repo
git clone --depth 1 https://github.com/Yourdaylight/stock_datasource

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 tushare-plugin-builder

README.md
[![agentmods](https://agentmods.dev/badge/skills/yourdaylight/stock_datasource/tushare-plugin-builder.svg)](https://agentmods.dev/skills/yourdaylight/stock_datasource/tushare-plugin-builder)
Your own site
<a href="https://agentmods.dev/skills/yourdaylight/stock_datasource/tushare-plugin-builder"><img src="https://agentmods.dev/badge/skills/yourdaylight/stock_datasource/tushare-plugin-builder.svg" alt="Measured on agentmods" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,737 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00056 $0.03737
Opus 5 $0.00028 $0.01869
Sonnet 5 $0.00011 $0.00747
Haiku 4.5 $0.00006 $0.00374

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

Security

Grade A, and why

tushare-plugin-builder scanned grade A 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 5d ago.

The scan reads SKILL.md. This mod also ships 6 executable files (scripts/generate_create_table_sql.py, scripts/run_plugin_test.py, scripts/validate_plugin.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

description: This skill should be used when the user provides a Tushare API document URL and asks to generate a full plugin in this codebase, including extractor, schema, config, query service, and agent/MCP/http usage w
skills/tushare-plugin-builder/SKILL.md · 367 lines

How it starts

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

目的

将 Tushare 文档 URL 转换为本仓库的生产级插件,包含数据抽取、ClickHouse 表结构、查询服务,以及可测试的 curl 示例。

何时使用

  • 用户提供 Tushare 文档 URL 或页面内容,要求生成插件。
  • 用户需要基于某个 Tushare 接口生成插件 + 入库 + service + Agent/MCP 调用。
  • 验证已有插件:用户要求检查某个插件是否符合规范。

工作流程

1) 收集必要输入

  • 确保用户提供了 Tushare 文档 URL。若无法访问,请求截图或复制的文档内容。
  • 若未指定插件名,询问用户。使用 snake_case 命名,与现有 tushare_* 插件保持一致。

2) 从文档提取 API 规格

  • 解析接口名称、输入参数、输出字段、使用说明(频率限制、分页、数据量限制)。
  • 记录字段命名差异(如 pct_change vs pct_chg)及所需转换。

3) 规划插件结构(参考 references/plugin_conventions.md

  • 目录:src/stock_datasource/plugins/<plugin_name>/
  • 文件:__init__.pyplugin.pyextractor.pyservice.pyschema.jsonconfig.json<plugin_name>.md
  • 以现有 tushare_* 插件为模板。

4) 实现 extractor

  • 使用 tushare SDK,API 调用需用 proxy_context() 包裹。
  • 实现频率限制、超时、重试(tenacity)。
  • 根据 API 特性支持 trade_datestart_date/end_date

5) 实现 plugin

  • 实现 extract_datavalidate_datatransform_dataload_data
  • 插入前添加 version_ingested_at 列。
  • 转换数值类型,trade_date 转为 Date
插件分类与角色

必须实现以下方法指定插件的分类和角色:

from stock_datasource.core.base_plugin import PluginCategory, PluginRole

def get_category(self) -> PluginCategory:
    """插件分类 - 按市场划分"""
    return PluginCategory.CN_STOCK  # 或 HK_STOCK, INDEX, ETF_FUND, SYSTEM

def get_role(self) -> PluginRole:
    """插件角色"""
    return PluginRole.PRIMARY  # 或 BASIC, DERIVED, AUXILIARY

分类说明

  • CN_STOCK: A股相关数据
  • HK_STOCK: 港股相关数据
  • INDEX: 指数相关数据
  • ETF_FUND: ETF/基金相关数据
  • SYSTEM: 系统数据(如交易日历)

角色说明

  • PRIMARY: 主数据(如 daily 行情)
  • BASIC: 基础数据(如 stock_basic)
  • DERIVED: 衍生数据(如复权因子)
  • AUXILIARY: 辅助数据(如指数权重)
依赖配置

plugin.py 中实现依赖方法(不是在 config.json 中配置):

def get_dependencies(self) -> List[str]:
    """必须依赖 - 这些插件的数据必须存在才能运行当前插件。
    
    例如:tushare_daily 依赖 tushare_stock_basic 提供股票代码列表。
    """
    return ["tushare_stock_basic"]

def get_optional_dependencies(self) -> List[str]:
    """可选依赖 - 同步主插件时默认会同步这些依赖,用户可选择禁用。
    
    例如:tushare_daily 可选同步 tushare_adj_factor 复权因子。
    """
    return ["tushare_adj_factor"]

Read the full file on GitHub · 367 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. 5d ago First seen · 367 lines · 56 tokens per session scan A 75938edaebfb

Subscribe to this mod's changes

tushare-plugin-builder is a skill published in the GitHub repository Yourdaylight/stock_datasource (177 stars, last pushed 3mo ago), licensed MIT. It adds 56 tokens to every session and 3,737 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.