本文へ移動
cccskills
無料GitHub で公開

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.

インストール方法を見る

含まれるファイル(76)

  • SKILL.md9.5 KB
  • .gitignore503 B
  • .mcp.json120 B
  • CHANGELOG.md12.2 KB
  • CITATION.cff338 B
  • LICENSE15.4 KB
  • LICENSE-APACHE11.1 KB
  • NOTICE1.6 KB
  • pytest.ini106 B
  • README.md25.7 KB
  • references/api_reference.md9.6 KB
  • references/batch_collection.md8.1 KB
  • references/codex_adapter.md7.6 KB
  • references/gov_policy_api_reference.md5.2 KB
  • references/gov_rules_api_reference.md3.2 KB
  • references/kimi_bridge_adapter.md3.3 KB
  • references/mcp_setup.md2.6 KB
  • references/page_structure.md10.3 KB
  • references/setup.md965 B
  • references/treaty_api_reference.md2.2 KB
  • requirements-dev.txt57 B
  • requirements.txt424 B
  • scripts/article_search.py9.9 KB
  • scripts/common/__init__.py1.8 KB
  • scripts/common/cache.py9.7 KB
  • scripts/common/chinese_numerals.py1.9 KB
  • scripts/common/cli_utils.py784 B
  • scripts/common/constants.py804 B
  • scripts/common/docx_utils.py3.1 KB
  • scripts/common/file_io.py2.9 KB
  • scripts/common/logger.py785 B
  • scripts/common/ratelimit.py10.1 KB
  • scripts/common/text_utils.py2.2 KB
  • scripts/court_law_crawler.py12.8 KB
  • scripts/download.py21.2 KB
  • scripts/gov_policy_library.py14.6 KB
  • scripts/gov_rules_crawler.py18.6 KB
  • scripts/mcp_server.py12.0 KB
  • scripts/mee_law_crawler.py12.5 KB
  • scripts/mod_law_crawler.py12.5 KB
  • scripts/moj_law_crawler.py13.5 KB
  • scripts/party_law_crawler.py12.2 KB
  • scripts/region_classifier.py21.5 KB
  • scripts/tax_law_crawler.py15.6 KB
  • scripts/treaty_crawler.py14.8 KB
  • tests/conftest.py145 B
  • tests/fixtures/court/__init__.py0 B
  • tests/fixtures/court/data.py1.3 KB
  • tests/fixtures/gov_policy/__init__.py0 B
  • tests/fixtures/gov_policy/data.py3.0 KB
  • tests/fixtures/mee/__init__.py0 B
  • tests/fixtures/mee/data.py1022 B
  • tests/fixtures/mod/__init__.py0 B
  • tests/fixtures/mod/data.py1.3 KB
  • tests/fixtures/moj/__init__.py0 B
  • tests/fixtures/moj/data.py1.3 KB
  • tests/fixtures/party/__init__.py0 B
  • tests/fixtures/party/data.py1.3 KB
  • tests/fixtures/tax/__init__.py0 B
  • tests/fixtures/tax/data.py2.6 KB
  • tests/test_article_search.py3.5 KB
  • tests/test_cache.py12.1 KB
  • tests/test_common.py9.6 KB
  • tests/test_court_law_crawler.py6.7 KB
  • tests/test_download.py10.8 KB
  • tests/test_gov_policy_library.py12.2 KB
  • tests/test_gov_rules_crawler.py7.3 KB
  • tests/test_live_sources.py2.8 KB
  • tests/test_mcp_tools.py11.8 KB
  • tests/test_mee_law_crawler.py5.1 KB
  • tests/test_mod_law_crawler.py5.8 KB
  • tests/test_moj_law_crawler.py7.3 KB
  • tests/test_new_sources_contract.py6.0 KB
  • tests/test_party_law_crawler.py6.7 KB
  • tests/test_region_classifier.py3.4 KB
  • tests/test_tax_law_crawler.py11.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

このスキルの問題を報告する