Agent skill

A Share Risk Attribution

by aifinlab in aifinlab/FinClaw

A股绩效归因/风险归因分析。当用户说"绩效归因"、"收益归因"、"Brinson"、"风险归因"、"attribution"、"超额收益来自哪里"、"为什么跑赢/跑输"、"组合分析归因"、"行业归因"、"风格归因"时触发。对投资组合进行系统性绩效归因(Brinson行业归因/风格因子归因),拆解超额收益来源(配置效应/选股效应/交互效应),评估投资能力。支持研报风格(formal)和快速归因风格…

Apache-2.0Auto-check passed

Install A Share Risk Attribution

skills CLI
$ npx skills add aifinlab/FinClaw --skill a-share-risk-attribution -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install aifinlab/FinClaw a-share-risk-attribution --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/aifinlab/FinClaw.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/a-share-risk-attribution .claude/skills/a-share-risk-attribution && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
a-share-risk-attribution
GitHub stars
255
Token cost
~823 tokens
SKILL.md length
211 words
Files
3 (incl. scripts, references)
Skills in repo
74
Repo updated
First seen
Licence
Apache-2.0

At a glance

A股绩效归因/风险归因分析。当用户说"绩效归因"、"收益归因"、"Brinson"、"风险归因"、"attribution"、"超额收益来自哪里"、"为什么跑赢/跑输"、"组合分析归因"、"行业归因"、"风格归因"时触发。对投资组合进行系统性绩效归因(Brinson行业归因/风格因子归因),拆解超额收益来源(配置效应/选股效应/交互效应),评估投资能力。支持研报风格(formal)和快速归因风格…

  • Works in 8 steps: 数据完整性:归因区间内所有持仓股必须有完整K线数据,缺失时提示用户 → 基准一致性:行业分类标准需与基准成分股行业分类一致(默认申万一级行业) → 权重归一化:组合权重和基准权重需分别归一化至100% → …
  • Runs Python scripts from its folder; calls python

What it does

A Share Risk Attribution is an agent skill from aifinlab/FinClaw. A股绩效归因/风险归因分析。当用户说"绩效归因"、"收益归因"、"Brinson"、"风险归因"、"attribution"、"超额收益来自哪里"、"为什么跑赢/跑输"、"组合分析归因"、"行业归因"、"风格归因"时触发。对投资组合进行系统性绩效归因(Brinson行业归因/风格因子归因),拆解超额收益来源(配置效应/选股效应/交互效应),评估投资能力。支持研报风格(formal)和快速归因风格(brief)。

Its SKILL.md is about 820 tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including scripts and reference files (for example `references/attribution-guide.md` and `scripts/brinson_attribution.py`).

The licence is Apache-2.0.

Example prompts

  • “Brinson”
  • “attribution”
  • “超额收益来自哪里”
  • “/a-share-risk-attribution”

Requirements

  • Python 3

Workflow steps

8 steps, taken from the first numbered list in SKILL.md.

  1. 数据完整性:归因区间内所有持仓股必须有完整K线数据,缺失时提示用户
  2. 基准一致性:行业分类标准需与基准成分股行业分类一致(默认申万一级行业)
  3. 权重归一化:组合权重和基准权重需分别归一化至100%
  4. 区间要求:归因区间至少1个月,建议1个季度以上以获得有意义的结果
  5. 残差控制:Brinson 归因中配置+选股+交互应精确等于超额收益,不应有残差
  6. 因子归因局限性:明确说明回归法因子归因受样本量和多重共线性影响,结果为近似
  7. 与其他 skill 联动:对选股贡献突出的行业可用 a-share-sector 深入分析,对个股 alpha 可用 a-share-earnings-analysis 追溯
  8. 多期归因:如区间超过1个季度,采用 Carino 链接法进行多期归因,确保各期可加性

What it can do on your machine

Read from SKILL.md and the folder at commit 9e62862. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

A Share Risk Attribution loads about 823 tokens when it runs, and up to ~2.4k if it reads all its reference files. Until then it costs about 58 tokens; SKILL.md has 211 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~58
When it runs · the whole SKILL.md, loaded when a task matches
~823
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from aifinlab/FinClaw at commit 9e62862, republished under its Apache-2.0 licence (© aifinlab). 211 words, ~823 tokens.

Download SKILL.mdSave it as .claude/skills/a-share-risk-attribution/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
a-share-risk-attribution
description
A股绩效归因/风险归因分析。当用户说"绩效归因"、"收益归因"、"Brinson"、"风险归因"、"attribution"、"超额收益来自哪里"、"为什么跑赢/跑输"、"组合分析归因"、"行业归因"、"风格归因"时触发。对投资组合进行系统性绩效归因(Brinson行业归因/风格因子归因),拆解超额收益来源(配置效应/选股效应/交互效应),评估投资能力。支持研报风格(formal)和快速归因风格(brief)。
数据源
bash
SCRIPTS="$SKILLS_ROOT/cn-stock-data/scripts"

# 各持仓股K线(计算区间收益)
python "$SCRIPTS/cn_stock_data.py" kline --code [CODE] --freq daily --start [起始日期] --end [结束日期]

# 各持仓股实时行情
python "$SCRIPTS/cn_stock_data.py" quote --code [CODE1],[CODE2],[CODE3],...

# 各持仓股财务指标(风格因子:PE/PB/市值/ROE等)
python "$SCRIPTS/cn_stock_data.py" finance --code [CODE]

# 基准指数K线(沪深300/中证500/中证全指)
python "$SCRIPTS/cn_stock_data.py" kline --code SH000300 --freq daily --start [起始日期] --end [结束日期]
# 中证500: SH000905  中证全指: SH000985  创业板指: SZ399006
Workflow (5 steps):

Step 1: 输入确认 — 组合与基准

收集归因所需信息:

  • 组合持仓:代码、权重(或持仓市值)、所属行业
  • 基准:默认沪深300,用户可指定中证500/中证全指等
  • 归因区间:起止日期(默认最近一个季度)
  • 归因类型:Brinson行业归因(默认) / 风格因子归因 / 两者都做

汇总为输入表:

代码名称组合权重(%)行业(申万一级)

如果用户未提供行业分类,通过 finance 接口获取后自动映射。

Step 2: Brinson 行业归因

通过 cn-stock-data kline 获取组合各股和基准在归因区间的收益率,按行业汇总:

行业组合权重 Wp基准权重 Wb组合收益 Rp基准收益 Rb配置效应选股效应交互效应合计

Brinson-Fachler 模型(参考 references/attribution-guide.md):

  • 配置效应 = (Wp,i - Wb,i) x (Rb,i - Rb)
  • 选股效应 = Wb,i x (Rp,i - Rb,i)
  • 交互效应 = (Wp,i - Wb,i) x (Rp,i - Rb,i)
  • 超额收益 = 配置效应 + 选股效应 + 交互效应

汇总:

  • 总超额收益 = 组合收益 - 基准收益
  • 配置效应合计 / 选股效应合计 / 交互效应合计
  • 最大贡献行业 / 最大拖累行业

Step 3: 风格因子归因

通过 finance 获取各股财务指标,构建因子暴露矩阵,用回归法拆解收益:

常用因子:

因子代理变量说明
市场(Beta)组合 vs 基准系统性风险
规模(Size)ln(总市值)大/小盘偏离
价值(Value)1/PE 或 BP价值/成长风格
动量(Momentum)过去3-6月涨幅追涨/逆向
波动率(Volatility)近期日收益率标准差高/低波偏好
质量(Quality)ROE盈利质量

输出因子归因表:

因子组合暴露基准暴露主动暴露因子收益(%)因子贡献(%)

残差项 = 超额收益 - 各因子贡献之和(代表个股 alpha)

Step 4: 时间序列分解(仅 formal 模式)

将归因区间按月拆分,展示归因效应的时间演变:

月份组合收益基准收益超额收益配置贡献选股贡献交互贡献

识别:

  • 超额收益的持续性 vs 偶发性
  • 归因效应的稳定性(是否依赖单月大幅超额)
  • 投资能力评估(配置能力 vs 选股能力)

Step 5: 输出

风格说明
维度formal(机构绩效归因报告)brief(快速归因摘要)
篇幅4-8 页1-2 页
Brinson 归因完整行业归因表 + 瀑布图描述Top 3 贡献/拖累行业
因子归因完整因子暴露与贡献表主要因子贡献一句话
时间分解按月归因表 + 趋势分析省略
投资能力评估配置能力/选股能力/IR评价一句话定性评价
可视化瀑布图/堆叠图/热力图描述省略
免责声明需要不需要
关键规则
  1. 数据完整性:归因区间内所有持仓股必须有完整K线数据,缺失时提示用户
  2. 基准一致性:行业分类标准需与基准成分股行业分类一致(默认申万一级行业)
  3. 权重归一化:组合权重和基准权重需分别归一化至100%
  4. 区间要求:归因区间至少1个月,建议1个季度以上以获得有意义的结果
  5. 残差控制:Brinson 归因中配置+选股+交互应精确等于超额收益,不应有残差
  6. 因子归因局限性:明确说明回归法因子归因受样本量和多重共线性影响,结果为近似
  7. 与其他 skill 联动:对选股贡献突出的行业可用 a-share-sector 深入分析,对个股 alpha 可用 a-share-earnings-analysis 追溯
  8. 多期归因:如区间超过1个季度,采用 Carino 链接法进行多期归因,确保各期可加性

使用示例

示例 1: 基本使用
python
# 调用 skill
result = run_skill({
    "param1": "value1",
    "param2": "value2"
})
示例 2: 命令行使用
bash
python scripts/run_skill.py --input data.json

© aifinlab, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (scripts, references) in skills/a-share-risk-attribution of aifinlab/FinClaw.

  • SKILL.md
  • references/attribution-guide.md
  • scripts/brinson_attribution.py

Open the folder on GitHubat commit 9e62862

Compare with similar skills

A Share Risk Attribution next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

A Share Risk Attribution compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
A Share Risk Attribution this skillaifinlab/FinClaw255—~823Automated safety check: PassApache-2.0
ShareClickHouse/ClickHouse50k—~558Automated safety check: NotesApache-2.0
Performance AttributionHKUDS/Vibe-Trading35k—~3.1kAutomated safety check: PassMIT
Developing Share PagesTriliumNext/Trilium38k—~3.4kAutomated safety check: PassAGPL-3.0
SharingBuilderIO/agent-native7.1k—~3.4kAutomated safety check: PassNone
Riskalsk1992/CloddsBot3k—~2.4kAutomated safety check: PassMIT

Similar skills

  • Share

    ClickHouse/ClickHouse

    Share a Claude Code session to pastila.nl and return a viewer link.

    50k GitHub stars~558 tokensUpdated today
    DatabasesAuto-check: notes
  • Performance Attribution

    HKUDS/Vibe-Trading

    Explains why a portfolio beat or lagged its benchmark with Brinson sector attribution, factor alpha and beta decomposition, timing evaluation and benchmark comparison.

    35k GitHub stars~3.1k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Developing Share Pages

    TriliumNext/Trilium

    A skill your agent uses when working on Trilium's share functionality — shared pages under /share/, the static HTML (share-theme) export, the share theme package (packages/share-theme: EJS…

    38k GitHub stars~3.4k tokensUpdated today
    Knowledge ManagementAuto-check passed
  • Sharing

    BuilderIO/agent-native

    Framework-level sharing and privacy for user-authored resources (dashboards, documents, forms, decks, etc.).

    7.1k GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • Risk

    alsk1992/CloddsBot

    Unified risk engine with VaR, stress testing, volatility regimes, and automated controls

    3k GitHub stars~2.4k tokensUpdated 7 days ago
    Testing & QAAuto-check passed
  • Direction Attribute

    thedaviddias/Front-End-Checklist

    A skill your agent uses when reviewing templates, rendered HTML, or shared components related to Set text direction for RTL languages.

    74k GitHub stars~534 tokensUpdated 4 days ago
    Auto-check passed

More from aifinlab/FinClaw

All 74 skills in this repo
  • Bank Corporate Credit Dd

    aifinlab/FinClaw

    A skill your agent uses when the user asks for help with corporate credit due diligence, enterprise credit investigation, pre-loan review, borrower analysis, document collection, management…

    255 GitHub stars~952 tokensUpdated 5 mo ago
    Auto-check passed
  • A skill your agent uses when you need a bank corporate-risk monitoring assistant for enterprise litigation/penalty/enforcement scanning (处罚/诉讼/被执行/失信等).

    255 GitHub stars~751 tokensUpdated 5 mo ago
    Auto-check passed
  • A skill your agent uses when you need a bank corporate client operating-volatility monitoring assistant (经营监测/指标波动/预警解释).

    255 GitHub stars~605 tokensUpdated 5 mo ago
    Auto-check passed
  • A skill your agent uses when you need a bank post-loan visit follow-up assistant to turn visit notes/materials into a structured memo (摘要/关键更新/风险观察/用途核验/行动项).

    255 GitHub stars~544 tokensUpdated 5 mo ago
    Auto-check passed
  • A skill your agent uses when you need a bank corporate credit issue-list assistant (问题清单/补件清单/催办台账).

    255 GitHub stars~487 tokensUpdated 5 mo ago
    Auto-check passed
  • A skill your agent uses when you need a bank corporate credit approval-opinion drafting assistant (审批意见/条款建议/有条件同意).

    255 GitHub stars~549 tokensUpdated 5 mo ago
    Auto-check passed

Questions about A Share Risk Attribution

What does A Share Risk Attribution do?

A股绩效归因/风险归因分析。当用户说"绩效归因"、"收益归因"、"Brinson"、"风险归因"、"attribution"、"超额收益来自哪里"、"为什么跑赢/跑输"、"组合分析归因"、"行业归因"、"风格归因"时触发。对投资组合进行系统性绩效归因(Brinson行业归因/风格因子归因),拆解超额收益来源(配置效应/选股效应/交互效应),评估投资能力。支持研报风格(formal)和快速归因风格…. A Share Risk Attribution is an agent skill from aifinlab/FinClaw.

How do I install A Share Risk Attribution in Claude Code?

Run `npx skills add aifinlab/FinClaw --skill a-share-risk-attribution -a claude-code`. Or copy the skill folder (skills/a-share-risk-attribution in aifinlab/FinClaw) into .claude/skills/a-share-risk-attribution in your project. Claude Code loads it when a task matches its description.

How do I install A Share Risk Attribution in Codex?

Run `npx skills add aifinlab/FinClaw --skill a-share-risk-attribution -a codex`. Or copy the skill folder (skills/a-share-risk-attribution in aifinlab/FinClaw) into .agents/skills/a-share-risk-attribution in your project. Codex loads it when a task matches its description.

Can I use A Share Risk Attribution in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add aifinlab/FinClaw --skill a-share-risk-attribution -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/a-share-risk-attribution, .gemini/skills/a-share-risk-attribution, .github/skills/a-share-risk-attribution and .opencode/skills/a-share-risk-attribution in your project.

What does A Share Risk Attribution need to run?

Going by SKILL.md and its folder, A Share Risk Attribution needs Python for the scripts in its folder and the command-line tools its instructions call (python). Our summary lists: Python 3.

Does A Share Risk Attribution access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is A Share Risk Attribution safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does A Share Risk Attribution use?

A Share Risk Attribution is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does A Share Risk Attribution use?

About 823 tokens (SKILL.md is roughly 3.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.6k tokens, read only when the agent opens those files.

What are the alternatives to A Share Risk Attribution?

Skills that share tags, products or a category with A Share Risk Attribution: Share (ClickHouse/ClickHouse, 50k stars), Performance Attribution (HKUDS/Vibe-Trading, 35k stars), Developing Share Pages (TriliumNext/Trilium, 38k stars) and Sharing (BuilderIO/agent-native, 7.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains A Share Risk Attribution?

aifinlab (a GitHub user) maintains it in aifinlab/FinClaw, which has 255 GitHub stars. The repository holds 74 skills in this directory. The repository was last updated on May 13, 2026.

Source: aifinlab/FinClaw on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.