Agent skill

A Share Factor Library

by aifinlab in aifinlab/FinClaw

A股量化因子库/因子速查/因子计算公式查询。当用户说"因子库"、"有哪些因子"、"factor library"、"怎么算XX因子"、"价值因子"、"动量因子"、"质量因子"、"波动率因子"、"因子定义"、"因子公式"、"查因子"、"因子速查"、"列出所有因子"、"EP怎么算"、"BP公式"、"因子字段"时触发。MUST USE when user asks for factor…

Apache-2.0Auto-check passed

Install A Share Factor Library

skills CLI
$ npx skills add aifinlab/FinClaw --skill a-share-factor-library -a claude-code

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

GitHub CLI
$ gh skill install aifinlab/FinClaw a-share-factor-library --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-factor-library .claude/skills/a-share-factor-library && 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-factor-library
GitHub stars
254
Token cost
~770 tokens
SKILL.md length
139 words
Files
2 (incl. references)
Skills in repo
74
Repo updated
First seen
Licence
Apache-2.0

At a glance

A股量化因子库/因子速查/因子计算公式查询。当用户说"因子库"、"有哪些因子"、"factor library"、"怎么算XX因子"、"价值因子"、"动量因子"、"质量因子"、"波动率因子"、"因子定义"、"因子公式"、"查因子"、"因子速查"、"列出所有因子"、"EP怎么算"、"BP公式"、"因子字段"时触发。MUST USE when user asks for factor…

  • Works in 5 steps: 识别因子类别 → 查找因子定义与公式 → 映射到 cn-stock-data 字段 → …
  • User asks for factor definitions
  • SKILL.md covers 核心能力, 数据来源, CLI 用法 and 因子参考目录, plus 2 more sections
  • Calls python

What it does

A Share Factor Library is an agent skill from aifinlab/FinClaw. A股量化因子库/因子速查/因子计算公式查询。当用户说"因子库"、"有哪些因子"、"factor library"、"怎么算XX因子"、"价值因子"、"动量因子"、"质量因子"、"波动率因子"、"因子定义"、"因子公式"、"查因子"、"因子速查"、"列出所有因子"、"EP怎么算"、"BP公式"、"因子字段"时触发。MUST USE when user asks for factor definitions, formulas, or wants to look up how a specific quantitative factor is calculated. 提供A股常用量化因子的完整定义、计算公式、数据字段映射,覆盖价值/成长/质量/动量/波动率/规模/流动性七大类50+因子。支持研报风格(formal)和快速查询风格(brief)。

Its SKILL.md is about 770 tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/factor-library-catalog.md`).

The licence is Apache-2.0.

When your agent uses it

  • User asks for factor definitions
  • Wants to look up how a specific quantitative factor is calculated

Example prompts

  • “factor library”
  • “怎么算XX因子”
  • “列出所有因子”
  • “/a-share-factor-library”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. 识别因子类别
  2. 查找因子定义与公式
  3. 映射到 cn-stock-data 字段
  4. 计算因子值
  5. 输出因子卡片

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

    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 Factor Library loads about 770 tokens when it runs, and up to ~4.4k if it reads all its reference files. Until then it costs about 100 tokens; SKILL.md has 139 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~100
When it runs · the whole SKILL.md, loaded when a task matches
~770
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.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); files beside SKILL.md are not scanned.

SKILL.md

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

Download SKILL.mdSave it as .claude/skills/a-share-factor-library/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
a-share-factor-library
description
A股量化因子库/因子速查/因子计算公式查询。当用户说"因子库"、"有哪些因子"、"factor library"、"怎么算XX因子"、"价值因子"、"动量因子"、"质量因子"、"波动率因子"、"因子定义"、"因子公式"、"查因子"、"因子速查"、"列出所有因子"、"EP怎么算"、"BP公式"、"因子字段"时触发。MUST USE when user asks for factor definitions, formulas, or wants to look up how a specific quantitative factor is calculated. 提供A股常用量化因子的完整定义、计算公式、数据字段映射,覆盖价值/成长/质量/动量/波动率/规模/流动性七大类50+因子。支持研报风格(formal)和快速查询风格(brief)。

A股常用因子库速查 (a-share-factor-library)

核心能力

  • 因子目录: 7大类 50+ 因子的完整定义、公式、数据字段映射
  • 因子计算: 给定股票代码,实际计算因子值(调用 cn-stock-data)
  • 因子速查: 按类别/名称/英文缩写快速定位因子
  • 因子对比: 同类因子横向比较,解释差异与适用场景

数据来源

  • 财务因子: cn-stock-data finance(adata 43字段: basic_eps, roe_wtd, roa_wtd, gross_margin, net_margin, total_rev, net_profit_attr_sh, total_rev_yoy_gr, net_profit_yoy_gr 等)
  • 行情因子: cn-stock-data kline(date, open, close, high, low, volume, amount, turnover_rate, pct_change)
  • 实时数据: cn-stock-data quote(price, pe_ttm, market_cap, float_market_cap, volume_ratio)

CLI 用法

bash
SCRIPTS_DIR="$SKILLS_ROOT/a-share-factor-library/scripts"
CN_STOCK="$SKILLS_ROOT/cn-stock-data/scripts"

# 计算单个因子
python "$SCRIPTS_DIR/factor_calculator.py" --factor ep --codes SH600519,SZ000858

# 动量因子
python "$SCRIPTS_DIR/factor_calculator.py" --factor momentum_6m --codes SH600519

# 批量计算一类因子
python "$SCRIPTS_DIR/factor_calculator.py" --category value --codes SH600519,SZ000858

# 列出所有因子
python "$SCRIPTS_DIR/factor_calculator.py" --list

# 查看某个因子定义
python "$SCRIPTS_DIR/factor_calculator.py" --info ep

因子参考目录

详见 references/factor-library-catalog.md,包含全部 7 大类因子的:

  • 中英文名称
  • 计算公式
  • cn-stock-data 字段映射
  • 因子方向(正/负)
  • 适用行业说明

Workflow (5 steps)

Step 1: 识别因子类别

根据用户请求判断:

  • 具体因子查询 → 定位到 catalog 中的因子卡片
  • 因子类别浏览 → 列出该类别全部因子
  • 因子计算 → 进入 Step 3-4
  • 因子对比 → 列出多个因子的公式与差异
Step 2: 查找因子定义与公式

从 references/factor-library-catalog.md 查找:

  • 因子名称(中/英)
  • 计算公式(数学表达式)
  • 所需数据字段
  • 因子方向与适用说明
Step 3: 映射到 cn-stock-data 字段

将因子公式中的变量映射到实际数据接口:

  • 财务类 → cn-stock-data finance --code XXX
  • 行情类 → cn-stock-data kline --code XXX --freq daily --start YYYY-MM-DD
  • 估值类 → cn-stock-data quote --code XXX
Step 4: 计算因子值

调用 scripts/factor_calculator.py 或手动计算:

bash
python "$SCRIPTS_DIR/factor_calculator.py" --factor <factor_name> --codes <code1,code2,...>
Step 5: 输出因子卡片

formal(研报风格):

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
因子名称: EP(盈利收益率)
英文全称: Earnings-to-Price Ratio
类别: 价值因子 | 方向: 正向(越大越便宜)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
公式: EP = EPS_TTM / Price = 1 / PE_TTM
数据源: cn-stock-data quote → pe_ttm
适用行业: 全行业(金融/周期股慎用)

计算结果:
| 股票 | EPS_TTM | Price | EP | 排名 |
|------|---------|-------|----|------|
| 贵州茅台 | 66.3 | 1895.5 | 0.035 | 1 |
| 五粮液 | 7.2 | 168.0 | 0.043 | 2 |

因子解读:
EP 值越大说明股票越"便宜",是经典价值因子。
建议与 BP、CFP 等因子组合使用,避免单一因子陷阱。
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

brief(快速查询风格):

EP = 1/PE_TTM | 方向:正 | 数据:quote.pe_ttm
SH600519: EP=0.035 | SZ000858: EP=0.043

注意事项

  • 财务因子使用最近一期报告期数据,注意时效性
  • 动量/波动率因子需要足够长度的历史 K 线(至少 1 年)
  • 行业中性化处理不在本 skill 范围内,如需请参考 a-share-stock-screen
  • 因子方向说明:正向=值越大越好(如 ROE),负向=值越小越好(如 PE)

© 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 1 other file (references) in skills/a-share-factor-library of aifinlab/FinClaw.

  • SKILL.md
  • references/factor-library-catalog.md

Open the folder on GitHubat commit 9e62862

Compare with similar skills

A Share Factor Library 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 Factor Library compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
A Share Factor Library this skillaifinlab/FinClaw254—~770Automated safety check: PassApache-2.0
ShareClickHouse/ClickHouse50k—~558Automated safety check: NotesApache-2.0
SharingBuilderIO/agent-native7.1k—~3.4kAutomated safety check: PassNone
Deslop Shared Libsgarrytan/gstack136k—~3.3kAutomated safety check: NotesMIT
Factor Research with IC and IRHKUDS/Vibe-Trading35k—~2.1kAutomated safety check: PassMIT
Skill Sharedavila7/claude-code-templates32k10 repos~729Automated 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
  • 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
  • Deslop Shared Libs

    garrytan/gstack

    Find worthwhile shared-code extractions in recent work. An agent skill from garrytan/gstack.

    136k GitHub stars~3.3k tokensUpdated today
    Writing & ContentAuto-check: notes
  • Evaluates factors across many instruments with IC and IR statistics and quantile backtests, then guides screening and weighting; uses the factor_analysis tool with factor and return CSVs.

    35k GitHub stars~2.1k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Skill Share

    davila7/claude-code-templates

    A skill that creates new Claude skills and automatically shares them on Slack using Rube for seamless team collaboration and skill discovery.

    32k GitHub starsUsed in 10 repos~729 tokens
    Agent WorkflowsAuto-check passed
  • Moves logic out of Astro frontmatter into tested helper modules under shared/lib, with rules for naming, typing, deterministic demo data and sibling test files.

    42k GitHub stars~1.2k tokensUpdated yesterday
    DevelopmentAuto-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…

    254 GitHub stars~952 tokensUpdated 4 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 (处罚/诉讼/被执行/失信等).

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

    254 GitHub stars~605 tokensUpdated 4 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 (摘要/关键更新/风险观察/用途核验/行动项).

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

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

    254 GitHub stars~549 tokensUpdated 4 mo ago
    Auto-check passed

Questions about A Share Factor Library

What does A Share Factor Library do?

A股量化因子库/因子速查/因子计算公式查询。当用户说"因子库"、"有哪些因子"、"factor library"、"怎么算XX因子"、"价值因子"、"动量因子"、"质量因子"、"波动率因子"、"因子定义"、"因子公式"、"查因子"、"因子速查"、"列出所有因子"、"EP怎么算"、"BP公式"、"因子字段"时触发。MUST USE when user asks for factor…. A Share Factor Library is an agent skill from aifinlab/FinClaw. A股量化因子库/因子速查/因子计算公式查询。当用户说"因子库"、"有哪些因子"、"factor library"、"怎么算XX因子"、"价值因子"、"动量因子"、"质量因子"、"波动率因子"、"因子定义"、"因子公式"、"查因子"、"因子速查"、"列出所有因子"、"EP怎么算"、"BP公式"、"因子字段"时触发。MUST USE when user asks for factor definitions, formulas, or wants to look up how a specific quantitative factor is calculated.

When should I use A Share Factor Library?

A Share Factor Library fits situations like: user asks for factor definitions; wants to look up how a specific quantitative factor is calculated.

How do I install A Share Factor Library in Claude Code?

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

How do I install A Share Factor Library in Codex?

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

Can I use A Share Factor Library 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-factor-library -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-factor-library, .gemini/skills/a-share-factor-library, .github/skills/a-share-factor-library and .opencode/skills/a-share-factor-library in your project.

What does A Share Factor Library need to run?

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

Does A Share Factor Library 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 Factor Library 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. Review the folder before installing.

What licence does A Share Factor Library use?

A Share Factor Library 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 Factor Library use?

About 770 tokens (SKILL.md is roughly 3.1k 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 3.7k tokens, read only when the agent opens those files.

What are the alternatives to A Share Factor Library?

Skills that share tags, products or a category with A Share Factor Library: Share (ClickHouse/ClickHouse, 50k stars), Sharing (BuilderIO/agent-native, 7.1k stars), Deslop Shared Libs (garrytan/gstack, 136k stars) and Factor Research with IC and IR (HKUDS/Vibe-Trading, 35k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains A Share Factor Library?

aifinlab (a GitHub user) maintains it in aifinlab/FinClaw, which has 254 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.