yd-law-search

yd-law-search is a skill for Claude Code, Codex from ThomasMoreAI/legal-skills-open. It costs 132 tokens per session (1,420 once invoked), scanned A, original, Apache-2.0.

A search tool for Chinese laws, regulations, judicial interpretations, and other official legal documents. It can find provisions by meaning or keywords and retrieve selected document details.

In plain words
What is it for?
Use it to search Chinese legal provisions, filter regulations, and retrieve the full text of selected articles or documents.
Why use it?
It helps locate relevant legal text without treating search results as a final legal opinion.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: reads .claude/ paths.

Good fit Use it to search Chinese legal provisions, filter regulations, and retrieve the full text of selected articles or documents.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/thomasmoreai/legal-skills-open/yd-law-search
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.

Any agent
npx skills add ThomasMoreAI/legal-skills-open --skill yd-law-search
Clone the repo
git clone --depth 1 https://github.com/ThomasMoreAI/legal-skills-open

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 yd-law-search

README.md
[![agentmods](https://agentmods.dev/badge/skills/thomasmoreai/legal-skills-open/yd-law-search/github.svg)](https://agentmods.dev/skills/thomasmoreai/legal-skills-open/yd-law-search)
Your own site
<a href="https://agentmods.dev/skills/thomasmoreai/legal-skills-open/yd-law-search"><img src="https://agentmods.dev/badge/skills/thomasmoreai/legal-skills-open/yd-law-search/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 yd-law-search

Your own site · 80×15
<a href="https://agentmods.dev/skills/thomasmoreai/legal-skills-open/yd-law-search"><img src="https://agentmods.dev/badge/skills/thomasmoreai/legal-skills-open/yd-law-search.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 132 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,420 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00132 $0.01420
Opus 5 $0.00066 $0.00710
Sonnet 5 $0.00026 $0.00284
Haiku 4.5 $0.00013 $0.00142

Measured 9d ago against content hash 44ad8c41fa0f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

yd-law-search 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 9d 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.

cn/general/skills/yd-law-search/SKILL.md · 118 lines

How it starts

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

定位

检索型 skill,把规范依据稳定、结构化地检索出来。

  • 它负责:查法条、查法规、查司法解释、查具体条文全文
  • 它不负责:直接替代法律分析、出完整法律意见
  • 与现有 skill 的关系:
    • yd-law-search:检索规范依据(本 skill)
    • yd-case-search:检索案例与类案
    • cs-china-lawyer-analyst:基于检索结果做法律分析
    • legal-research:上层编排技能,按"查法规→查案例→出备忘录"调度上述三者

API Key 配置

脚本按以下顺序读取 API Key:

  1. 环境变量 YD_OPEN_API_KEY
  2. ~/.yd_open_api_key
  3. 环境变量 YD_API_KEY
  4. ~/.yd_api_key
  5. 脚本目录下 .api_key

申请入口:https://open.chineselaw.com/

工作流(重要)

  • 默认搜索只返回元数据 + 高亮/要旨片段,不返回全文。
  • 当需要某条法条或法规的全文时,使用 ft_detail / fg_detail 配合 id 拉取。
  • 不要在搜索后立即对全部命中条目调用详情接口;先由模型/用户筛选 1-3 条最相关的,再单独拉详情。
  • --full 开关用于调试或用户明确要求全文展示时使用。

子命令决策树(严格遵守,不要自由发挥)

默认路由(用于 99% 的"查法律/查规定"提问):

  1. 自然语言问题、想要规范依据原文search(语义法条)
  2. 多关键词、术语精确、要做条件过滤search_keyword(关键词法条)
  3. 已知法规名 + 条号ft_detail(法条详情)

仅在出现以下显式信号时才走「法规级别」接口:

  • 用户问"有哪些法规/规章/规定"、"列出相关法规"
  • 用户问"某机关发过什么文件"、"做法规盘点"
  • 用户已明确给出法规名要拉法规全文 → fg_detail

明确禁止:

  • 不要用 search_fg 来回答"某规则是什么"——那是 search / search_keyword 的活。
  • search_fg 只回法规清单(标题、发布部门、发布日期),不返回具体条文。

调用方式

# 1. 语义检索(自然语言)
echo '{"query":"民间借贷利率上限"}' | \
  python3 ~/.claude/skills/yd-law-search/scripts/yd_law_search.py search --stdin

# 2. 关键词检索(精确)
echo '{"keyword":"个人信息 处罚","search_mode":"AND","sxx":"现行有效"}' | \
  python3 ~/.claude/skills/yd-law-search/scripts/yd_law_search.py search_keyword --stdin

# 3. 法条详情(需法规名 + 中文条号)
echo '{"fgmc":"中华人民共和国刑法","ftnum":"第一百条"}' | \
  python3 ~/.claude/skills/yd-law-search/scripts/yd_law_search.py ft_detail --stdin

# 4. 法规级别检索(仅在用户要"列法规清单"时)
echo '{"keyword":"行政处罚","sxx":"现行有效","top_k":8}' | \
  python3 ~/.claude/skills/yd-law-search/scripts/yd_law_search.py search_fg --stdin

# 5. 法规详情(按 id 或 fgmc)
echo '{"fgmc":"中华人民共和国民法典"}' | \
  python3 ~/.claude/skills/yd-law-search/scripts/yd_law_search.py fg_detail --stdin

# 旧子命令 search_ft_info 仍兼容(自动映射 query→fgmc, ft_name→ftnum)
echo '{"query":"民法典","ft_name":"第六百八十条"}' | \
  python3 ~/.claude/skills/yd-law-search/scripts/yd_law_search.py search_ft_info --stdin

Read the full file on GitHub · 118 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. 9d ago First seen · 118 lines · 132 tokens per session scan A 44ad8c41fa0f

Subscribe to this mod's changes

yd-law-search is a skill published in the GitHub repository ThomasMoreAI/legal-skills-open (72 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 132 tokens to every session and 1,420 once invoked, about $0.0007 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-09-03.