Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计通过

algo-risk-benford算法风险本福德

Agent Skill

algo-risk-benford 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

396

周安装

16

GitHub Stars

125

下载量

124
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:algo-risk-benford(算法风险本福德)
来源仓库:https://github.com/asgard-ai-platform/skills
仓库路径:skills/algo-risk-benford
安装命令:
npx skills add https://github.com/asgard-ai-platform/skills --skill algo-risk-benford
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/asgard-ai-platform/skills --skill algo-risk-benford

简介

algo-risk-benford 检测数字首位分布是否符合本福特定律以识别异常。

  • 适用于审计财务数据、发票与税务申报的真实性核查。
  • 运行速度快,适合大规模数据集初步筛查可疑条目。
  • 安装命令:npx skills add https://github.com/asgard-ai-platform/skills --skill algo-risk-benford
  • 不适用于人工编号(如身份证号),仅对自然生成数据有效

SKILL.md

Benford's Law Analysis

Overview

Benford's Law predicts that in naturally occurring datasets, the leading digit d appears with probability P(d) = log₁₀(1 + 1/d). Digit 1 appears ~30.1% of the time, digit 9 only ~4.6%. Deviations from this distribution may indicate data fabrication or manipulation. Analysis runs in O(n).

When to Use

Trigger conditions:

  • Auditing financial data (expenses, invoices, tax returns) for manipulation
  • Screening large datasets for data integrity issues
  • Detecting fabricated or artificially rounded numbers

When NOT to use:

  • For assigned/sequential numbers (zip codes, phone numbers, IDs)
  • For datasets with constrained ranges (e.g., human ages, percentages)
  • For small datasets (< 500 records — insufficient statistical power)

Algorithm

IRON LAW: Benford's Law Applies to NATURALLY OCCURRING Data Spanning Orders of Magnitude
Data that doesn't span multiple orders of magnitude (e.g., temperatures
in Celsius, human heights) will NOT follow Benford's Law. Deviation from
Benford's in such data is EXPECTED, not suspicious. Always verify the
data type is appropriate before concluding fraud.

Phase 1: Input Validation

Extract leading digits from dataset. Filter: remove zeros, negatives (take absolute value), values < 10. Verify dataset spans multiple orders of magnitude. Gate: 500+ records, data spans at least 2 orders of magnitude.

Phase 2: Core Algorithm

  1. Extract first digit of each number
  2. Count frequency of each digit (1-9)
  3. Compare observed frequencies against Benford's expected: P(d) = log₁₀(1 + 1/d)
  4. Statistical tests: chi-squared test, MAD (Mean Absolute Deviation), KS test

Phase 3: Verification

MAD thresholds: < 0.006 (close conformity), 0.006-0.012 (acceptable), 0.012-0.015 (marginal), > 0.015 (non-conforming). Flag specific digits with large deviations. Gate: MAD computed, non-conforming digits identified.

Phase 4: Output

Return conformity assessment with digit-level analysis.

Output Format

{
  "conformity": "marginal",
  "mad": 0.013,
  "chi_squared": {"statistic": 18.5, "p_value": 0.018, "df": 8},
  "digit_analysis": [{"digit": 1, "observed_pct": 25.1, "expected_pct": 30.1, "deviation": -5.0}],
  "metadata": {"records": 5000, "dataset": "Q4 expense reports"}
}

Examples

Sample I/O

Input: 1000 invoice amounts from a company's AP ledger Expected: First digits should approximate 30.1%, 17.6%, 12.5%, 9.7%, 7.9%, 6.7%, 5.8%, 5.1%, 4.6%. MAD < 0.012 for legitimate data.

Edge Cases

InputExpectedWhy
All amounts $90-$99Digit 9 dominatesConstrained range — Benford's doesn't apply
Round number spike (digit 1, 5)Flag for reviewMay indicate round-number estimation or threshold manipulation
Government budget dataTypically conforms wellLarge naturally-occurring financial datasets fit Benford's

Gotchas

  • Not proof of fraud: Non-conformity is a RED FLAG, not evidence. Many legitimate processes produce non-Benford distributions. Always investigate further.
  • Second-digit test: First digit test catches gross fabrication. Second-digit analysis catches more subtle manipulation (e.g., rounding to approval thresholds).
  • Combining datasets: Mixing datasets from different processes may artificially create or destroy Benford conformity. Analyze homogeneous datasets.
  • Approval thresholds: If expenses over $5,000 require VP approval, expect a spike of amounts just below $5,000 (digit 4 in the $4,9xx range). This is a behavioral pattern, flagged by second-digit analysis.
  • Sample size matters: Chi-squared test is sensitive to sample size. With 100K+ records, even trivial deviations become statistically significant. Use MAD as primary metric.

References

  • For second and third digit extensions, see references/higher-digit-tests.md
  • For case studies in fraud detection, see references/fraud-case-studies.md

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

31.31%
按下载量换算39

Claude

30.19%
按下载量换算37

Cursor

19.48%
按下载量换算24

Gemini CLI

9.29%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills