use_cninfo CLAUDE.md

use_cninfo CLAUDE.md is an instructions file for Claude Code from rollysys/use_cninfo. It costs 1,791 tokens per session, scanned A, original, MIT.

Repository instructions for cninfo-cli, a command-line tool and Python package that downloads Chinese A-share company announcements from cninfo.com.cn and extracts their PDF text into local Markdown files. It also describes the project structure, setup commands, tests, linting, and network smoke tests.

In plain words
What is it for?
Use it when developing, testing, linting, or running cninfo-cli, or when working on its announcement fetching, PDF parsing, caching, classification, and command-line components.
Why use it?
It gives a coding agent the repository’s conventions and safe development commands, including the fact that normal tests run offline and downloads are on demand.

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.

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 instructions/rollysys/use_cninfo/claude-md
Clone the repo
git clone --depth 1 https://github.com/rollysys/use_cninfo

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 use_cninfo CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/rollysys/use_cninfo/claude-md.svg)](https://agentmods.dev/instructions/rollysys/use_cninfo/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/rollysys/use_cninfo/claude-md"><img src="https://agentmods.dev/badge/instructions/rollysys/use_cninfo/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,791 This file is loaded in full into every session.
When invoked 1,791 The same file — it is already loaded in full.
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.1 $0.01791 $0.01791
Opus 5 $0.00896 $0.00896
Sonnet 5 $0.00358 $0.00358
Haiku 4.5 $0.00179 $0.00179

Measured 6d ago against content hash af9823648f6a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

use_cninfo CLAUDE.md 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 6d 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.

CLAUDE.md · 110 lines

How it starts

The opening of the file, as written. The whole thing — 110 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.

这个 repo 是什么

cninfo-cli — 一个按需召唤型的 A 股公告抓取工具:CLI + Python 包,顺带给 Claude Code 提供一个 skill 入口。从巨潮资讯网(cninfo.com.cn)拉公告 PDF + PyMuPDF 提取的 md 全文,落本地缓存,二次访问秒级。

不是后台调度系统,不是数据池,不做增量同步 — 全是一次性命令,跑完即停。

常用命令

# 开发环境
uv venv --python 3.10
uv pip install -e ".[dev]"

# 跑测试(离线,32 个)
uv run pytest                       # 全跑
uv run pytest tests/test_api.py     # 单文件
uv run pytest -k "cache_hit"        # 按名字过滤

# Lint
uv run ruff check src tests
uv run ruff check --fix src tests   # 自动修

# 真机 smoke test(联网)
CNINFO_ALLOW_NETWORK=1 cninfo fetch-report 600519 --year 2024 --kind annual

# 重生成 fixture PDF(几乎不用)
python tests/fixtures/_make_pdf.py

架构关键点

单向依赖(从底到顶):

api.py        ← 纯函数,cninfo HTTP 客户端 + 时区/标题清洗
parser.py     ← PyMuPDF 包装
cache.py      ← ~/.cache/cninfo/ 三件套读写 + orgid_map
orgid.py      ← secCode→orgId(走 cninfo topSearch),用 cache.py 持久化
classify.py   ← argus_legal 薄包装(动态 import,缺失时抛 ClassifierUnavailable)
fetcher.py    ← 把上面拼起来:fetch_announcement / iter_* / find_periodic_report
cli.py        ← argparse,6 个子命令

测试隔离:conftest.py autouse fixture 默认禁用真实网络(requests.{get,post} 抛错),要联网测时设 CNINFO_ALLOW_NETWORK=1 或在测试里 mock。

缓存命中策略:pdf + md + meta 三件齐全才算命中;任一缺失走未命中路径。--force 跳过命中检查。

接口约束(继承自 cninfo,不要尝试"修复")

详见 docs/gotchas.md 14 条。最关键的 4 条:

  1. pageSize 服务端硬限 30 — 必须翻页(api.py:query_all 已处理)
  2. stock 必须 <6位>,<orgId> — 仅传 6 位返 0 条;本仓库通过 topSearch 拉 orgId(orgid.py),首次发现的 orgId 也会顺带缓存进 orgid_map.json
  3. announcementTime 是 UTC epoch ms — 必须按北京时区转(api.py:epoch_ms_to_ann_date),否则跨日公告 ann_date 差一天
  4. 同一公告可能有 2 条记录 — announcementId 不同 PDF 内容相同;is_periodic_report_body 已排除摘要/审计/内控,但全市场场景下用户需自行去重

改动指引

修接口参数 / 加 category / 加新场景:

  • api.py(常量 / 函数)→ 同步更新 docs/api_reference.md 那张表
  • 加 fixture(tests/fixtures/) → 加单测

新增 CLI 子命令:

  • cli.pybuild_parser() 加子 parser,cmd_xxx 写动作,默认 JSON 优先 + 表格可选
  • 一定要在 tests/test_cli.py 加一个走 main([...]) 的覆盖(可只看返回码 / stderr)

Read the full file on GitHub · 110 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. 6d ago First seen · 110 lines · 1,791 tokens per session scan A af9823648f6a

Subscribe to this mod's changes

use_cninfo CLAUDE.md is an instructions file published in the GitHub repository rollysys/use_cninfo (22 stars, last pushed 4mo ago), licensed MIT. It adds 1,791 tokens to every session, about $0.0090 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-30.

Related

Other instructions, from other repositories