Skip to content

CSlawyer1985/legal-skillhub / skills/1688-common-cha88-company-risk

1688-common-cha88-company-risk

Verified

88查企业风险查询与分析工具 —— 专注于中国大陆企业的法务风险查询与分析,覆盖经营异常、行政处罚、监管措施、被执行人、失信被执行人、司法案件等风险类型。支持公司名称、统一社会信用代码、companyId 三种输入方式,自动完成风险查询并输出结构化风险分析总结。 触发场景:仅当用户意图为查询企业风险/法务风险时触发。包括但不限于:企业风险查询、公司风险、经营异常、行政处罚、监管措施、被执行人、失信被执行人、司法风险、风险扫描、风险评估、企业合规审查、风险报告、XX公司有什么风险、XX公司安全吗、XX公司有没有处罚、XX公司被执行过吗。 不触发场景:纯粹的企业信息查询(如查公司、搜企业、工商信息、注册资本、法人代表、股东结构、专利商标等)不应触发本技能,请使用其他 cha88 系列工具。

references/skill_description.md

View on GitHub
# Skill 埋点说明

本文描述 **cha88-base** 中 Skill 调用埋点的上报时机、请求内容与失败策略,便于对接网关统计与二次开发对齐行为。

## 1. 作用概述

埋点用于在 **Skill 网关**侧统计 Skill 被调用的次数与基础元信息(名称、版本、渠道、场景)。实现集中在 `scripts/_tracker.py` 的 `report_skill_usage()`,由统一 CLI 入口 `cli.py` 在命令生命周期末尾触发。

## 2. 上报时机

| 场景 | 是否上报 | 说明 |
|------|----------|------|
| 已识别子命令(如 `cha88_search`、`cha88_detail`、`configure`),且子命令 `main()` **正常执行完毕** | **是** | 无论业务 JSON 中 `success` 为 `true` 或 `false`,均在子命令返回后上报一次。 |
| 未传入子命令、子命令名不在注册表、或展示用法后 `sys.exit(1)` | **否** | `cli.py` 在调用子模块前即退出,不会执行埋点逻辑。 |
| 子命令内 `argparse` 报错并 `sys.exit`(如必填参数缺失) | **否** | 进程在 `module.main()` 内退出,**不会**回到 `cli.py` 的埋点代码。 |
| 子命令 `main()` 抛出**未捕获**异常 | **否** | 异常向上传播,埋点代码未执行。 |

**小结**:埋点表示「一次 CLI 子命令入口已跑完主流程」,偏 **会话级 / 调用次数** 统计。

## 3. 上报接口与传输

| 项 | 值 |
|----|-----|
| 方法 | `POST` |
| 路径 | `/api/reportSkillsUsage/1.0.0` |
| 完整 URL | 与业务 API 相同网关:`https://skills-gateway.1688.com` + 路径 |
| 请求体 | JSON,`Content-Type: application/json; charset=utf-8` |
| 鉴权 | 与能力调用一致:通过 `get_auth_headers()` 注入签名 |

## 4. 请求体字段

| 字段 | 类型 | 取值说明 |
|------|------|----------|
| `apiName` | `null` | 固定为 JSON `null` |
| `skillsName` | string | Skill 名称,来自环境变量 `SKILL_NAME`,缺省为 `cha88-base` |
| `version` | string | Skill 版本,来自 `SKILL_VERSION`,缺省为 `1.0.0` |
| `scene` | string | 固定为 `"CLI"` |
| `channel` | string | 发布渠道,来自 `SKILL_CHANNEL`,缺省为 `clawhub` |

## 5. 失败与日志策略

- `report_skill_usage()` 整体包裹在 `try/except` 中:**任意异常均不向外抛出**
- 失败时通过 logger `cha88_tracker` 输出 **DEBUG** 级别日志
- `cli.py` 在调用 `report_skill_usage()` 外层还有一次 `try/except`

## 6. 与模板扩展的关系

新增 `capabilities/<name>/cmd.py` 并注册命令后,只要仍由根目录 `cli.py` 统一调度且在子命令 `main()` 正常返回后回到 `cli.py`,**会自动沿用同一套埋点**。

## 7. 相关文件索引

| 文件 | 职责 |
|------|------|
| `scripts/_tracker.py` | 读取 `.env`、组装请求体、调用 `api_post` 上报 |
| `cli.py` | 命令分发结束后调用 `report_skill_usage()` |
| `scripts/_http.py` | `api_post`:网关地址、签名、重试与错误映射 |
| `SKILL.md` | 面向使用方的环境变量与埋点摘要 |
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall