Cn Law Hub logo

Cn Law Hub

Community
ZongziForu
cn-law-hub

用于查询、检索、核验、下载、导出、批量采集中国官方法律法规、规章、条约和具体法条。Use this skill aggressively when the user asks to 查法律、查法规、查条例、查规章、查条约、查法条、查第几条、找法律依据、引用法律依据、核验现行有效、判断是否废止/已修改/尚未生效、下载法规全文、导出法规目录、批量下载法规文件、按关键词检索具体法条、展开法条分析,或在中国法律咨询、案例分析、合规审查、合同审查、劳动争议、行政法分析、公司合规、数据合规、政策研究中需要调用、核验或引用中国现行有效法律法规原文作为依据。Trigger also when phrases such as 依法、依规、依照法律规定、法律法规 imply a need to verify specific statutory authority or article-level text. Covers 国家法律法规数据库 (flk.npc.gov.cn), 国家规章库 (gov.cn), 外交条约库 (treaty.mfa.gov.cn), 国务院政策文件库 (sousuo.www.gov.cn), 司法部行政法规库 (xzfg.moj.gov.cn), 党内法规库 (12371.cn), 国防部法规文库 (mod.gov.cn), 税务法规库 (fgk.chinatax.gov.cn), 生态环境部法规规章 (mee.gov.cn), and 最高人民法院发布栏目 (court.gov.cn). Supports 标题/正文检索, 精确/模糊检索, 时效性过滤, 分类过滤, 分页, 排序, 单篇下载, 批量下载, 法条级抽取, 地区/制定机关分类, and browser fallback. Trigger when the answer may depend on current effective Chinese statutes, regulations, rules, treaties, article text, official document status, or official source attribution. Do not use for purely general legal theory, generic writing, or legal reasoning that does not require retrieving or verifying official Chinese legal documents.

Overview

PublisherZongziForu
Repositorycn-law-hub
Skill namecn-law-hub
Stars
90
Forks
16
Bundled files
56
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 56 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by ZongziForu on GitHub. Read the source before you install it.

Installation

Install the Cn Law Hub AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/ZongziForu/cn-law-hub/tree/main
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ZongziForu/cn-law-hub.git \
  .claude/skills/cn-law-hub
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Cn Law Hub in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Cn Law Hub on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Cn Law Hub is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Data Sources

#DatabaseScriptSourceType
1国家法律法规数据库 (NPC)scripts/download.pyflk.npc.gov.cnJSON API
2国家规章库 (Gov Rules)scripts/gov_rules_crawler.pygov.cn/zhengce/xxgk/gjgzkAthena API + HTML
3外交条约库 (Treaty)scripts/treaty_crawler.pytreaty.mfa.gov.cnHTML
4国务院政策文件库scripts/gov_policy_library.pysousuo.www.gov.cnREST API (GET)
5司法部行政法规库scripts/moj_law_crawler.pyxzfg.moj.gov.cnHTML
6党内法规库scripts/party_law_crawler.pywww.12371.cnHTML
7国防部法规文库scripts/mod_law_crawler.pywww.mod.gov.cnHTTP
8税务法规库scripts/tax_law_crawler.pyfgk.chinatax.gov.cnREST API (POST)
9生态环境部法规规章scripts/mee_law_crawler.pymee.gov.cnHTML
10最高人民法院发布栏目scripts/court_law_crawler.pycourt.gov.cnHTML

All scripts share --search, --info, --size, --output, --rate-limit, --no-cache, --cache-stats, --cache-clear. Run python <script> --help for full parameter lists.


Core Rules

Search Strategy (applies to ALL data sources)

Decide before calling the script — never default to fuzzy for everything:

  • Known title (e.g. "物业管理条例", "北京市生活垃圾管理条例"): use --exact to reduce noise.
  • Broad topic (e.g. "出租车", "环境保护"): use fuzzy search (default).
  • Full-text match: add --range content when you need documents where the keyword appears in the body, not just the title.
  • Ambiguous: ask the user, or run both exact+fuzzy and compare.

Status Filtering

NPC status codes (sxx / --status):

CodeMeaning
1已废止
2已修改
3现行有效
4尚未生效

Other sources use their own status values (e.g. --status effective for MoJ). Check --help per script.

Article-Level Queries (NPC)

For individual articles instead of full documents:

CommandWhenOutput
--preview <id>Understand structure firstTitle, article count, TOC
--article <id> "第X条"Know the article numberSingle article text
--article <id> --grep "kw"Find articles by keyword in one lawAll matching articles

Supports Chinese numerals (第三十八条), Arabic (第38条), or bare numbers (38).

For cross-law article search, use scripts/article_search.py <keyword> --max-laws N.

Rate Limiting

Auto mode picks by estimated requests: OFF (≤10), FIXED 5 req/s (11–100), ADAPTIVE 1–8 req/s with 429 backoff (>100). Override: --rate-limit {off|fixed|adaptive}.

Caching

Local file cache enabled (~/.cache/ per namespace). Search results: 1h TTL. Detail metadata: 24h. DOCX: 7 days. Use --no-cache to bypass, --cache-stats to inspect.


Validity Rules — MANDATORY

  1. Only state 现行有效, 已废止, 已修改, or 尚未生效 when the official page or API response explicitly provides that status.
  2. If the source has no explicit validity field, say: "官方页面未明确标注效力状态".
  3. Do not infer validity from file accessibility or recency of publication date.
  4. Always return: official URL, file type, issuing authority, publication date, and retrieval date — even when status is absent.
  5. For same-name / multi-version documents, flag the ambiguity and verify amendment, repeal, and effective-date information.
  6. Distinguish document types: 法律, 行政法规, 地方性法规, 规章, 司法解释, 司法文件, 党内法规, 政策文件, 通知, 案例, 条约. Do not conflate.
  7. Never write "现行法律" as a generic label for all official publications.

Document Type Attribution

When reporting results, always identify the document type and source database explicitly. Use the format:

来源: [数据库名称] ([URL])
文件类型: [法律/行政法规/规章/司法解释/党内法规/政策文件/通知/...]
发布机关: [authority]
发布日期: [date]
效力状态: [现行有效/已废止/...] 或 "官方页面未明确标注效力状态"


Script Routing Summary

ScriptPurposeKey flagsOutput dir
scripts/download.pyNPC search, download, article, preview--search, --exact, --range, --status, --download, --article, --preview, --urls-onlystdout, files
scripts/article_search.pyCross-law article-level searchkeyword, --law, --range, --max-laws, --context, --json, --offset, --resumestdout
scripts/gov_rules_crawler.pyGov.cn rules--search, --categories, --download, --infogov_rules_output/
scripts/treaty_crawler.pyMFA treaties--search, --collections, --download, --infotreaty_output/
scripts/gov_policy_library.pyState Council policies--search, --range, --category, --yeargov_policy_output/
scripts/moj_law_crawler.pyMoJ admin regulations--search, --range, --statusmoj_law_output/
scripts/party_law_crawler.pyParty regulations (12371.cn)--search, --categoryparty_law_output/
scripts/mod_law_crawler.pyMOD law library--search, --categorymod_law_output/
scripts/tax_law_crawler.pyTax regulations (chinatax)--search, --categorytax_law_output/
scripts/mee_law_crawler.pyMEE env regulations--search, --categorymee_law_output/
scripts/court_law_crawler.pySPC announcements--search, --categorycourt_law_output/
scripts/region_classifier.pyProvince/city classification--classify, --matrixJSON/CSV

Each script has --help. Run it for detailed parameter lists.


Reference Files

Read these on demand, not proactively:

FileRead when...
references/setup.mdFirst run, dependency issues, or switching agent environments
references/api_reference.mdNeed full NPC API payloads, field mappings, auth, or pagination details
references/gov_rules_api_reference.mdGov Rules auth issues (401/403) or response field parsing
references/gov_policy_api_reference.mdNeed State Council API parameter details beyond --help
references/treaty_api_reference.mdTreaty HTML structure or field extraction patterns
references/page_structure.mdBrowser automation — page layout, selectors, UI-only search flow
references/kimi_bridge_adapter.mdRunning on Kimi Agent or Claude Code + kimi-webbridge
references/codex_adapter.mdRunning on Codex
references/batch_collection.mdLarge-scale collection (200+ items), batch download workflows

Browser fallback: only when the API/script fails or UI-only search is required. Read references/page_structure.md first.


Key Notes by Data Source

  • NPC: ossFile paths from detail API are not directly downloadable — always use --download. bbbs = unique law ID.
  • Gov Rules: Requires dynamic RSA auth from the frontend JS bundle; may expire during long runs. Restart on 401/403.
  • Treaty: Pure HTML, no API. Collections: 全部, 双边, 多边.
  • Party Law (12371.cn): No search API; keyword filtering is client-side on titles only.
  • MOD: Static HTML, no search API. Client-side title filtering.
  • Tax: POST API, requires session cookie (auto-managed). Channel ID auto-discovered.
  • MEE: Static HTML, categories pre-loaded in page. No search API. Standards (环保标准) excluded.
  • Court: List pages paginated (/fabu/gengduo/{id}.html → {id}_{n}.html). No search API.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Cn Law Hub AI skill do?

用于查询、检索、核验、下载、导出、批量采集中国官方法律法规、规章、条约和具体法条。Use this skill aggressively when the user asks to 查法律、查法规、查条例、查规章、查条约、查法条、查第几条、找法律依据、引用法律依据、核验现行有效、判断是否废止/已修改/尚未生效、下载法规全文、导出法规目录、批量下载法规文件、按关键词检索具体法条、展开法条分析,或在中国法律咨询、案例分析、合规审查、合同审查、劳动争议、行政法分析、公司合规、数据合规、政策研究中需要调用、核验或引用中国现行有效法律法规原文作为依据。Trigger also when phrases such as 依法、依规、依照法律规定、法律法规 imply a need to verify specific statutory authority or article-level text. Covers 国家法律法规数据库 (flk.npc.gov.cn), 国家规章库 (gov.cn), 外交条约库 (treaty.mfa.gov.cn), 国务院政策文件库 (sousuo.www.gov.cn), 司法部行政法规库 (xzfg.moj.gov.cn), 党内法规库 (12371.cn), 国防部法规文库 (mod.gov.cn), 税务法规库 (fgk.chinatax....

Why use Cn Law Hub on TypingMind?

Because you install it once and use it with any model. Cn Law Hub is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Cn Law Hub in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/ZongziForu/cn-law-hub/tree/main. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Cn Law Hub?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Cn Law Hub?

As many as you like. As long as a model supports skills, you can use Cn Law Hub with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Cn Law Hub AI skill free?

Yes. It is published on GitHub by ZongziForu under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇