feat(skills): add 6 due-diligence data-source skills (#111)

## Summary

Adds six enterprise due-diligence data-source skills as local built-in
skills (SKILL.md + SKILL.zh-CN.md + catalog-metadata sidecar), per
ADR-038.

| Skill | Category | Risk | Source |
|---|---|---|---|
| baidu-poi-search | data | low | Baidu Map Place API (REST) |
| tianyancha-risk | business | low | Tianyancha risk API (REST) |
| ccgp-gov-procurement | business | medium | ccgp.gov.cn (WebBridge) |
| cnipa-patent-search | business | medium | CNIPA pss-system (WebBridge)
|
| creditchina-query | business | high | creditchina.gov.cn (WebBridge +
ddddocr) |
| multi-source-sentiment | research | medium | Douyin Index/Featured +
WebSearch |

## Changes
- 6 x skills/<id>/{SKILL.md, SKILL.zh-CN.md, catalog-metadata.v1.json}
- builtin-skills.json: 34 -> 40
- manifest.json: totalSkills 63 -> 69
- README.md counts + list

## Security
- Credentials replaced with env-var placeholders (BAIDU_MAP_AK,
TIANYANCHA_TOKEN); verified no secrets in diff

## Validation
- validate-i18n.py: 0 errors (remaining warnings pre-existing repo-wide)
- zh/en heading parity verified; source_hash computed per repo algorithm

Co-authored-by: yi-ge <yi-ge@desirecore.net>
This commit is contained in:
joy1129-com
2026-09-03 14:05:58 +08:00
committed by GitHub
parent 43a8cbd549
commit c83f917901
21 changed files with 2668 additions and 8 deletions

View File

@@ -0,0 +1,279 @@
---
name: creditchina-query
description: >-
信用中国企业信用信息查询——输入企业名称自动通过图形验证码ddddocr 本地 OCR 100ms返回信用信息行政处罚/失信被执行/行政许可。Use when 用户提到"查信用"、"信用中国"、"行政处罚"、"失信企业"、"企业信用"、"失信被执行人"、"行政许可"、"creditchina"。
version: 1.0.0
type: procedural
risk_level: high
status: enabled
tags:
- due-diligence
- credit
- creditchina
- compliance
metadata:
author: desirecore
updated_at: '2026-09-03'
i18n:
default_locale: en-US
source_locale: zh-CN
locales:
- zh-CN
- en-US
zh-CN:
name: 信用中国查询
short_desc: 浏览器自动化 + ddddocr 本地过验证码,返回企业信用信息
description: >-
信用中国企业信用信息查询——输入企业名称自动通过图形验证码ddddocr 本地 OCR 100ms返回信用信息行政处罚/失信被执行/行政许可。Use when 用户提到"查信用"、"信用中国"、"行政处罚"、"失信企业"、"企业信用"、"失信被执行人"、"行政许可"、"creditchina"。
body: ./SKILL.zh-CN.md
source_hash: sha256:ae28ca7a89d99438
translated_by: human
en-US:
name: Credit China Query
short_desc: Browser automation with local ddddocr captcha solving for enterprise credit records
description: >-
Credit China (creditchina.gov.cn) enterprise credit query — input a company name, automatically pass the graphic captcha (ddddocr local OCR, ~100 ms), and return credit records (administrative penalties / dishonest debtors / administrative licenses). Use when the user asks about enterprise credit, administrative penalties, dishonest-debtor lists, or creditchina.
body: ./SKILL.md
source_hash: sha256:ae28ca7a89d99438
translated_by: human
market:
icon: >-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M12 4v16M8 20h8M4 8h16M6.5 8 4 13.5a3 3 0 0 0 5 0L6.5 8Zm11 0L15 13.5a3 3 0 0 0 5 0L17.5 8Z" stroke="#007AFF" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>
category: business
maintainer:
name: DesireCore Official
verified: true
compatible_agents: []
channel: latest
required_client_version: 10.0.115
---
# Credit China Query
## L0: One-Sentence Summary
Input a company name, pass the graphic captcha automatically via Kimi WebBridge plus ddddocr local OCR, and return the enterprise's credit records.
## L1: Overview
- **Data source**: Credit China (`creditchina.gov.cn`, guided by NDRC)
- **Auth**: graphic captcha (solved locally by ddddocr, ~100 ms)
- **Invocation**: Kimi WebBridge + CDP screenshot + ddddocr Python OCR
- **Prerequisites**:
- Kimi WebBridge daemon running
- Python with `ddddocr` (`pip install ddddocr`)
- Python with `Pillow` (`pip install pillow`)
## L2: Procedure
### 1. Navigate to the search page
Write `C:\tmp\cc-nav.json`:
```json
{
"action": "navigate",
"args": {
"url": "https://www.creditchina.gov.cn/xinyongxinxi/?keyword={company-name-URL-encoded}&scenesVal=default&tableName=credit_xyzx_tyshxydm",
"newTab": true,
"group_title": "信用中国查询"
},
"session": "creditchina-query"
}
```
```bash
curl.exe -s -X POST "http://127.0.0.1:10086/command" \
-H "Content-Type: application/json" \
--data-binary "@C:\tmp\cc-nav.json" --max-time 30
```
Wait 6 seconds.
### 2. Confirm the captcha overlay
Write `C:\tmp\cc-check.json`:
```json
{
"action": "evaluate",
"args": {
"code": "(function(){var v=document.getElementById('vcode');var i=document.getElementById('vcodeimg');return JSON.stringify({vcode:v?v.getBoundingClientRect().width>0:false,vimg:i?i.getBoundingClientRect().width>0:false});})()"
},
"session": "creditchina-query"
}
```
If `vcode=true` and `vimg=true`, the captcha overlay is visible — continue.
### 3. Get the captcha image coordinates
Write `C:\tmp\cc-coord.json`:
```json
{
"action": "evaluate",
"args": {
"code": "(function(){var img=document.getElementById('vcodeimg');if(!img)return 'no-img';var r=img.getBoundingClientRect();return JSON.stringify({x:Math.round(r.x),y:Math.round(r.y),w:Math.round(r.width),h:Math.round(r.height),dpr:window.devicePixelRatio});})()"
},
"session": "creditchina-query"
}
```
Record `x` / `y` / `w` / `h`.
### 4. CDP screenshot of the captcha region
> **Note**: the WebBridge screenshot action fails intermittently on this site (HTTP 000/400) — **always use CDP `Page.captureScreenshot` with the clip parameter**.
Write `C:\tmp\cc-shot.json` (replace `{x}` / `{y}` / `{w}` / `{h}`):
```json
{
"action": "cdp",
"args": {
"method": "Page.captureScreenshot",
"params": {
"format": "png",
"clip": { "x": {x}, "y": {y}, "width": {w}, "height": {h}, "scale": 1 }
}
},
"session": "creditchina-query"
}
```
```bash
curl.exe -s -X POST "http://127.0.0.1:10086/command" \
-H "Content-Type: application/json" \
--data-binary "@C:\tmp\cc-shot.json" --max-time 40 -o "C:/tmp/cc-cdp-resp.json"
```
Decode the base64 payload and save the image:
```python
import json, base64
d = json.load(open(r'C:\tmp\cc-cdp-resp.json', encoding='utf-8'))
b64 = d.get('data', {}).get('data', '')
open(r'C:\tmp\cc-captcha.png', 'wb').write(base64.b64decode(b64))
```
### 5. ddddocr recognition (~100 ms)
```python
import ddddocr, sys, time
sys.stdout.reconfigure(encoding='utf-8')
ocr = ddddocr.DdddOcr(show_ad=False)
t0 = time.time()
with open(r'C:\tmp\cc-captcha.png', 'rb') as f:
code = ocr.classification(f.read())
print(f'验证码: {code} ({(time.time()-t0)*1000:.0f}ms)')
open(r'C:\tmp\cc-code.txt', 'w').write(code)
```
### 6. Fill and submit the captcha
Write `C:\tmp\cc-submit.json` (replace `{code}`):
```json
{
"action": "evaluate",
"args": {
"code": "(function(){var inp=document.getElementById('vcode');if(!inp)return 'no-input';var s=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,'value').set;s.call(inp,'{code}');inp.dispatchEvent(new Event('input',{bubbles:true}));inp.dispatchEvent(new Event('change',{bubbles:true}));for(var el of document.querySelectorAll('button, a, input[type=button]')){if((el.innerText||el.value||'').trim()==='验证'){el.click();break;}}return 'submitted';})()"
},
"session": "creditchina-query"
}
```
Wait 5 seconds.
### 7. Check the verification result
Write `C:\tmp\cc-result.json`:
```json
{
"action": "evaluate",
"args": {
"code": "(function(){var t=document.body.innerText||'';if(t.includes('验证码错误'))return '验证码错误';if(t.includes('失效'))return '验证码已失效';return JSON.stringify({hasResult:t.includes('共')||t.includes('条'),textSample:t.slice(0,500)});})()"
},
"session": "creditchina-query"
}
```
**Three outcomes**:
- `"验证码错误"` / `"验证码已失效"` → retry from step 3 (click 换一张 to refresh)
- `hasResult=true` with data → success, go to step 8
- `textSample` contains "很抱歉,没有找到您搜索的数据" → captcha passed but the keyword has no match — retry with the full name or a short name
### 8. Read the search results
```json
{
"action": "evaluate",
"args": {
"code": "(function(){return document.body.innerText.slice(0,1500);})()"
},
"session": "creditchina-query"
}
```
### 9. Normalized mapping
```json
{
"query_status": "success",
"source": "creditchina",
"company_name": "{company name}",
"captcha_solved": true,
"search_result": "有结果 | 无匹配",
"credit_info": [
{
"event_type": "行政处罚 | 行政许可 | 失信被执行 | 守信激励",
"event_title": "...",
"event_date": "...",
"source_url": "...",
"summary": "..."
}
],
"timestamp": "2026-08-31T21:00:00+08:00"
}
```
### 10. Close the session
```json
{
"action": "close_session",
"session": "creditchina-query"
}
```
## Retry Strategy
On captcha failure (wrong/expired), retry automatically up to 3 rounds:
1. Click 换一张 to refresh the captcha via `evaluate`
2. Wait 2 seconds for the new image
3. Repeat steps 3-6 (screenshot → recognize → submit)
After 3 failed rounds: ask the user to solve the captcha manually once in the browser, then resume — once verified, the browser remembers the state and subsequent queries skip the captcha.
## Known Limitations
- **Very short captcha TTL**: screenshot-to-submit must stay under ~15 s — **use ddddocr locally (~100 ms); cloud OCR (10-30 s round trips) always times out**
- **CDP screenshot required**: the WebBridge screenshot action fails intermittently here; use CDP `Page.captureScreenshot` with clip
- **Verification caching**: once passed, subsequent searches (navigating to new keyword URLs) return results without another captcha
- **CORS**: `fetch+FileReader` or `canvas.toDataURL` cannot capture the image (cross-origin taint) — CDP screenshots only
- **Keyword advice**: exact full names may return "no data" (the database only covers entities with credit records) — try the full name first, then the short name
## Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| 412 on direct HTTP | WAF blocks non-browser calls | always go through WebBridge |
| Captcha overlay missing | keyword param not triggered | check the keyword in the URL |
| Empty CDP screenshot | wrong coordinates / scrolled page | re-read `vcodeimg` bounding rect |
| ddddocr returns empty | broken image / recognition failure | refresh and retry; confirm screenshot bytes > 3000 |
| Wrong/expired captcha | misread / timeout | refresh (up to 3 rounds); fall back to manual |
| "没有找到您搜索的数据" | no credit records / keyword mismatch | retry with the short name |

View File

@@ -0,0 +1,229 @@
# 信用中国查询
## L0
输入企业名称,通过 Kimi WebBridge 浏览器自动化 + ddddocr 本地 OCR 自动过图形验证码,返回企业信用信息。
## L1 概述
- **数据源**:信用中国(`creditchina.gov.cn`,国家发改委指导)
- **认证**图形验证码ddddocr 本地 OCR 自动识别,~100ms
- **调用方式**Kimi WebBridge + CDP 截图 + ddddocr Python OCR
- **前置条件**
- Kimi WebBridge daemon 运行中
- Python 已安装 `ddddocr``pip install ddddocr`
- Python 已安装 `Pillow``pip install pillow`
## L2 操作步骤
### 1. 导航搜索页
写入 `C:\tmp\cc-nav.json`
```json
{
"action": "navigate",
"args": {
"url": "https://www.creditchina.gov.cn/xinyongxinxi/?keyword={企业名称URL编码}&scenesVal=default&tableName=credit_xyzx_tyshxydm",
"newTab": true,
"group_title": "信用中国查询"
},
"session": "creditchina-query"
}
```
```bash
curl.exe -s -X POST "http://127.0.0.1:10086/command" \
-H "Content-Type: application/json" \
--data-binary "@C:\tmp\cc-nav.json" --max-time 30
```
等待 6 秒。
### 2. 确认验证码弹层
写入 `C:\tmp\cc-check.json`
```json
{
"action": "evaluate",
"args": {
"code": "(function(){var v=document.getElementById('vcode');var i=document.getElementById('vcodeimg');return JSON.stringify({vcode:v?v.getBoundingClientRect().width>0:false,vimg:i?i.getBoundingClientRect().width>0:false});})()"
},
"session": "creditchina-query"
}
```
`vcode=true``vimg=true`,验证码弹层已出现,继续下一步。
### 3. 获取验证码图坐标
写入 `C:\tmp\cc-coord.json`
```json
{
"action": "evaluate",
"args": {
"code": "(function(){var img=document.getElementById('vcodeimg');if(!img)return 'no-img';var r=img.getBoundingClientRect();return JSON.stringify({x:Math.round(r.x),y:Math.round(r.y),w:Math.round(r.width),h:Math.round(r.height),dpr:window.devicePixelRatio});})()"
},
"session": "creditchina-query"
}
```
记录返回的 `x` / `y` / `w` / `h`
### 4. CDP 截图验证码区域
> **注意**WebBridge 的 screenshot 工具对此页面存在间歇性失败HTTP 000/400**必须用 CDP `Page.captureScreenshot` 的 clip 参数**。
写入 `C:\tmp\cc-shot.json`(替换 `{x}` / `{y}` / `{w}` / `{h}` 为上一步返回值):
```json
{
"action": "cdp",
"args": {
"method": "Page.captureScreenshot",
"params": {
"format": "png",
"clip": { "x": {x}, "y": {y}, "width": {w}, "height": {h}, "scale": 1 }
}
},
"session": "creditchina-query"
}
```
```bash
curl.exe -s -X POST "http://127.0.0.1:10086/command" \
-H "Content-Type: application/json" \
--data-binary "@C:\tmp\cc-shot.json" --max-time 40 -o "C:/tmp/cc-cdp-resp.json"
```
解码 base64 并保存为图片:
```python
import json, base64
d = json.load(open(r'C:\tmp\cc-cdp-resp.json', encoding='utf-8'))
b64 = d.get('data', {}).get('data', '')
open(r'C:\tmp\cc-captcha.png', 'wb').write(base64.b64decode(b64))
```
### 5. ddddocr 识别(~100ms
```python
import ddddocr, sys, time
sys.stdout.reconfigure(encoding='utf-8')
ocr = ddddocr.DdddOcr(show_ad=False)
t0 = time.time()
with open(r'C:\tmp\cc-captcha.png', 'rb') as f:
code = ocr.classification(f.read())
print(f'验证码: {code} ({(time.time()-t0)*1000:.0f}ms)')
open(r'C:\tmp\cc-code.txt', 'w').write(code)
```
### 6. 填入验证码 + 点击验证
写入 `C:\tmp\cc-submit.json`(替换 `{code}` 为识别结果):
```json
{
"action": "evaluate",
"args": {
"code": "(function(){var inp=document.getElementById('vcode');if(!inp)return 'no-input';var s=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,'value').set;s.call(inp,'{code}');inp.dispatchEvent(new Event('input',{bubbles:true}));inp.dispatchEvent(new Event('change',{bubbles:true}));for(var el of document.querySelectorAll('button, a, input[type=button]')){if((el.innerText||el.value||'').trim()==='验证'){el.click();break;}}return 'submitted';})()"
},
"session": "creditchina-query"
}
```
等待 5 秒。
### 7. 检查验证结果
写入 `C:\tmp\cc-result.json`
```json
{
"action": "evaluate",
"args": {
"code": "(function(){var t=document.body.innerText||'';if(t.includes('验证码错误'))return '验证码错误';if(t.includes('失效'))return '验证码已失效';return JSON.stringify({hasResult:t.includes('共')||t.includes('条'),textSample:t.slice(0,500)});})()"
},
"session": "creditchina-query"
}
```
**三种结果**
- `"验证码错误"` / `"验证码已失效"` → 返回步骤 3 重试(点"换一张"刷新验证码)
- `hasResult=true` 且返回搜索数据 → 成功,继续步骤 8
- `textSample` 含"很抱歉,没有找到您搜索的数据" → 验证码已通过,但搜索词无匹配(非技术错误)——建议换企业全名或简称重试
### 8. 读取搜索结果
```json
{
"action": "evaluate",
"args": {
"code": "(function(){return document.body.innerText.slice(0,1500);})()"
},
"session": "creditchina-query"
}
```
### 9. 标准化映射
```json
{
"query_status": "success",
"source": "creditchina",
"company_name": "{企业名称}",
"captcha_solved": true,
"search_result": "有结果 | 无匹配",
"credit_info": [
{
"event_type": "行政处罚 | 行政许可 | 失信被执行 | 守信激励",
"event_title": "...",
"event_date": "...",
"source_url": "...",
"summary": "..."
}
],
"timestamp": "2026-08-31T21:00:00+08:00"
}
```
### 10. 关闭会话
```json
{
"action": "close_session",
"session": "creditchina-query"
}
```
## 重试策略
验证码识别失败(错误/失效)时自动重试,最多 3 轮:
1. 点击"换一张"刷新验证码:`evaluate` 点击文本含"换一张"的元素
2. 等 2 秒(新图加载)
3. 重复步骤 3-6重新截图→识别→提交
3 轮失败后:报告用户,请人工在浏览器中手动过一次验证码,然后智能体接管继续(验证通过后浏览器记住验证态,后续查询免验证码)。
## 已知限制
- **验证码时效极短**:从截图到提交需 <15 秒——**必须用 ddddocr 本地识别(~100ms禁用云端 OCR10~30 秒往返必超时)**
- **CDP 截图替代 screenshot**WebBridge screenshot 工具对此页面间歇性失败HTTP 000/400必须用 CDP `Page.captureScreenshot` 的 clip 参数
- **验证态缓存**:一次验证通过后,浏览器记住验证态——后续搜索(导航到新 keyword URL不再需要验证码直接返回结果
- **CORS 限制**:不能通过 `fetch+FileReader``canvas.toDataURL` 取图(跨子域 tainted——只能用 CDP 截图
- **搜索词建议**:精确企业全名可能"没有找到您搜索的数据"(信用库只收录有信用记录的主体)——先试全名,无结果再试简称
## 故障排查
| 问题 | 原因 | 处理 |
|---|---|---|
| 412直连被 WAF 拦截) | 未用浏览器 | 必须通过 WebBridge 浏览器访问 |
| 验证码弹层未出现 | keyword 参数未触发 | 检查 URL 中的 keyword 参数 |
| CDP 截图返回空 | 坐标错误 / 页面滚动 | 重新获取 vcodeimg 的 getBoundingClientRect |
| ddddocr 识别为空 | 图片损坏 / 识别失败 | 刷新验证码重试;确认 CDP 截图 bytes > 3000 |
| 验证码错误/失效 | 识别错 / 超时 | 点"换一张"重试(最多 3 轮);仍失败转人工 |
| "没有找到您搜索的数据" | 企业无信用记录 / 词不匹配 | 换简称重试;确认企业有信用记录 |

View File

@@ -0,0 +1,74 @@
{
"$schema": "../../schemas/catalog-metadata.v1.schema.json",
"schemaVersion": 1,
"identity": {
"kind": "skill",
"id": "creditchina-query"
},
"presentation": {
"defaultLocale": "en-US",
"i18n": {
"zh-CN": {
"name": "信用中国查询",
"summary": "浏览器自动化 + ddddocr 本地过验证码,返回企业信用信息",
"description": "信用中国企业信用信息查询——输入企业名称自动通过图形验证码ddddocr 本地 OCR 100ms返回信用信息行政处罚/失信被执行/行政许可。Use when 用户提到\"查信用\"、\"信用中国\"、\"行政处罚\"、\"失信企业\"、\"企业信用\"、\"失信被执行人\"、\"行政许可\"、\"creditchina\"。"
},
"en-US": {
"name": "Credit China Query",
"summary": "Browser automation with local ddddocr captcha solving for enterprise credit records",
"description": "Credit China (creditchina.gov.cn) enterprise credit query — input a company name, automatically pass the graphic captcha (ddddocr local OCR, ~100 ms), and return credit records (administrative penalties / dishonest debtors / administrative licenses). Use when the user asks about enterprise credit, administrative penalties, dishonest-debtor lists, or creditchina."
}
},
"category": "business",
"tags": [
"due-diligence",
"credit",
"creditchina",
"compliance"
]
},
"release": {
"state": "known",
"version": "1.0.0",
"versionScheme": "semver"
},
"timestamps": {
"catalogUpdatedAt": {
"state": "known",
"value": "2026-09-03T05:45:00Z",
"precision": "second"
},
"releasePublishedAt": {
"state": "unknown"
},
"reviewedAt": {
"state": "unknown"
},
"upstreamObservedAt": {
"state": "unknown"
}
},
"provenance": {},
"governance": {
"stewardship": "official",
"availability": "installable",
"license": {
"state": "unknown"
},
"redistribution": "verify-package-terms",
"listingMaintainer": {
"name": "DesireCore Official",
"verified": true
}
},
"compatibility": {
"platforms": {
"state": "unknown"
},
"requiredClientVersion": "10.0.115"
},
"spec": {
"kind": "skill",
"riskLevel": "high"
}
}