yuandian-law-search
Original:🇨🇳 Chinese
Translated
1 scriptsChecked / no sensitive code detected
Yuandian Law Article and Case Retrieval. This skill shall be used when you need to query provisions of Chinese laws and regulations, retrieve relevant cases, and provide data support for legal analysis.
3installs
Sourcecat-xierluo/legal-skills
Added on
NPX Install
npx skill4agent add cat-xierluo/legal-skills yuandian-law-searchTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Yuandian Law Article and Case Retrieval
Retrieve provisions of Chinese laws and regulations and cases through Yuandian API, supporting a total of 5 modes: law article semantic/keyword/detailed retrieval and case keyword/vector semantic retrieval.
Prerequisites (automatically detected before each call)
Before using this skill each time, you must perform the following detection process first to confirm that the API Key is ready:
Detection Steps
- Detect file: Check if
.envexistsscripts/.env - Detect API Key: Read the value of in the file, confirm it is not empty and not the placeholder
YD_API_KEYyour-api-key-here - If the detection fails, prompt the user with the following guidance information and terminate:
⚠️ 元典 API Key 未配置。请按以下步骤获取并配置:
1. 注册/登录:访问 https://passport.legalmind.cn/ ,使用手机号注册
2. 创建 API Key:登录后访问 https://passport.legalmind.cn/apiKey/manage ,点击「创建 Key」
3. 配置密钥:将 Key 填入以下文件
scripts/.env
─────────────
YD_API_KEY=sk-你的密钥
─────────────
API 覆盖范围:法条检索(语义/关键词/详情)+ 案例检索(关键词/向量语义),共 5 个端点,共用同一个 Key。
配置完成后重新发起检索即可。- If the detection passes, continue to execute the retrieval command requested by the user
Detection Command
bash
# 检测 .env 文件和 API Key
if [ -f "scripts/.env" ]; then
KEY=$(grep '^YD_API_KEY=' scripts/.env | cut -d'=' -f2)
if [ -n "$KEY" ] && [ "$KEY" != "your-api-key-here" ]; then
echo "API Key 已就绪"
else
echo "API Key 未配置"
fi
else
echo ".env 文件不存在"
fiFive Retrieval Modes
1. Law Article Semantic Retrieval (search)
Ask questions in natural language to find the most relevant law articles.
bash
python3 scripts/yd_search.py search "正当防卫的限度" --sxx 现行有效2. Law Article Keyword Retrieval (keyword)
Retrieve law articles with precise keywords, supporting date range and effectiveness level filtering.
bash
python3 scripts/yd_search.py keyword "人工智能 监管" \
--effect1 法律 --sxx 现行有效 \
--fbrq-start 2022-01-01 --fbrq-end 2026-03-013. Law Article Detail Retrieval (detail)
Accurately obtain the full text of a specific law article by regulation name + article number.
bash
python3 scripts/yd_search.py detail "民法典" --ft-name "第十五条"4. Case Keyword Retrieval (case)
Retrieve cases with keywords, supporting multi-dimensional filtering such as cause of action, court, province, etc.
bash
python3 scripts/yd_search.py case "买卖合同纠纷" --province 广西 --authority-only5. Case Semantic Retrieval (case-semantic)
Find similar cases by description in natural language.
bash
python3 scripts/yd_search.py case-semantic "正当防卫的限度" --jarq-start 2020-01-01General Parameter Description
General Filter for Law Article Retrieval
| Parameter | Description | Optional Values |
|---|---|---|
| Effectiveness level (can be specified multiple times) | Constitution, Law, Judicial Interpretation, Administrative Regulation, Departmental Rule, Local Regulation, etc. |
| Timeliness (can be specified multiple times) | Currently Valid, Invalid, Amended, Partially Invalid, Not Yet Effective |
General Filter for Case Retrieval
| Parameter | Description |
|---|---|
| Only retrieve authoritative/typical cases |
| Province filter |
| Case closing date range |
For complete parameter description, see references/api-spec.md.
Output Format
The script outputs in Markdown format, including meta information such as full text of law articles, regulation name, issuing authority, timeliness, and original link. It can be directly used for legal document citation or AI analysis.
Debugging
Use the subcommand to view the original JSON response:
rawbash
python3 scripts/yd_search.py raw /search "正当防卫" --extra '{"sxx":["现行有效"]}'