AI agent financial skill: real fundamentals, deterministic Rule of 40/DCF/red flags, fail-closed when data is missing — so agents stop inventing stock numbers.
Project description
finance-skills
Stop AI agents from inventing stock numbers.
finance-skills is a skill your coding agent (Claude Code, Codex, Cursor, MCP-style tools) runs before it talks about a public company. It pulls real fundamentals, runs deterministic Rule of 40 / DCF / red-flag math, and fails closed when inputs are missing — so the model reasons over facts, not vibes.
pip install finance-skills
# or: install as /finance-skills skill → see Install
finance-skills brief CRWV --fixture
Real output
Offline sample (--fixture). Live runs use yfinance + the same engine.
$ finance-skills brief CRWV --fixture
═══ CoreWeave, Inc. (CRWV) — brief ═══
Source: fixture · as of 2026-Q1 [SAMPLE DATA — not live]
Price: $100 Market cap: $48.00B
Regime: ai neocloud
Rule of 40: preferred -668 vs bar 38 → BELOW BAR
EBITDA-based 167 · FCF-based -205 · capital-intensity gap 372
Capex-adjusted -668
Valuation
EV / Sales: 31.3x
EV / EBITDA: 55.9x
DCF / share: n/a — DCF skipped because free cash flow is not positive (…)
Top red flags
⛔ Cash burn · ⛔ Elevated leverage · ⚠ Heavy dilution
Disabled analyses (exact inputs)
· dcf: free cash flow is not positive
missing: positive free cash flow
Filing verification checklist (before trusting this output)
· free cash flow, debt, cash, share count, capex, backlog/RPO …
Same numbers in valuation, redflags, compare, screen — one engine, many views.
Why it exists
LLMs are great at language about finance and terrible at honest arithmetic under incomplete data.
They will:
- invent EV/EBITDA when debt is missing
- apply SaaS Rule of 40 to a GPU neocloud
- sound confident while compounding a bad assumption
Agents that trade time for money need a financial reasoning layer that:
- Fetches real public data
- Computes metrics offline and deterministically
- Refuses to print a figure when inputs are incomplete (fail-closed)
- Returns structured gaps so the agent can say what to check in the 10-K
That layer is this repo. Read-only. Not investment advice. Verify filings.
vs ChatGPT (or any chat model alone)
| Chat model alone | + finance-skills | |
|---|---|---|
| Numbers | Often invented or stale memory | From fetch + pure functions |
| Missing data | Fills in zeros / “looks fine” | Skips analysis + names the missing field |
| Rule of 40 | One flat 40 | Regime-aware (neocloud vs SaaS), dual margin |
| Reproducibility | Temperature & mood | Same inputs → same report |
| Agent contract | Prose blob | Tables + --json + gaps[] |
Use the model for judgment and prose. Use this for the numbers.
vs “just give the agent MCP / yfinance”
| Raw MCP / yfinance in the prompt | finance-skills | |
|---|---|---|
| What the agent gets | Tables, series, nulls | Analyst-shaped report |
| Math | Model re-derives (and drifts) | One build_report path |
| Consistency | Every tool call diverges | brief ≡ valuation ≡ redflags |
| Safety | Easy to eval rules or over-fetch | Screen is a tiny parser; no eval; AST safety tests |
| Fail-closed | Optional | Default |
MCP is a pipe. This is a policy + engine the agent is forced to go through.
Features
- Agent skill —
/finance-skills …or CLIfinance-skills - Plain English routing —
is it a value trap?→ redflags; bare ticker → brief - Segment-aware Rule of 40 — capital-intensity gap; neocloud ≠ SaaS bar
- Valuation — EV/S, EV/EBITDA, DCF when allowed + bear/base/bull scenarios
- Red flags / health — burn, leverage, dilution, runway
- Compare + peer presets —
--preset=saas|ai-infra|semiconductor|megacap - Screen / watchlist — tiny rule language + ranking summary
--style/--explain— value · growth · quality · risk emphasis- Fail-closed diagnostics — disabled analyses + filing checklist
- Offline fixtures — CRWV / NBIS without network
- CI-enforced safety — one network module, no brokers, no eval (
SECURITY.md)
Architecture
agent (Claude Code / Codex / Cursor / …)
│
▼
router → brief | valuation | redflags | compare | …
│
▼
analyze.build_report ← one structured report
│
┌────┴────┐
▼ ▼
data.py metrics.py
(IO only) (pure, deterministic)
Views never recompute. If two verbs disagree, that’s a bug.
Installation
CLI / library
pip install finance-skills
finance-skills help
As a skill (Claude Code, Antigravity, Codex-style dirs)
curl -fsSL https://raw.githubusercontent.com/notEhEnG/finance-skills/main/install.sh | bash -s -- claude
# bash -s -- antigravity | codex | all
Live data: network + yfinance. Sandbox / offline: --fixture.
Quick start
finance-skills brief NVDA
finance-skills NBIS --fixture
finance-skills "is PLTR a value trap?"
finance-skills valuation AAPL --json
finance-skills compare --preset=ai-infra --fixture
finance-skills brief CRWV --fixture --style=risk --explain
Agent path: /finance-skills is NVDA overvalued? → skill runs engine → answer-first prose using only engine figures.
Full contract: SKILL.md
Examples
Route a question (deterministic)
$ finance-skills route "is NBIS a value trap?"
redflags [keyword]
Valuation table
finance-skills valuation CRWV --fixture
Peer preset + ranking
finance-skills compare --preset=ai-infra --fixture
Teach a concept (no network)
finance-skills learn rule40
FAQ
Is this investment advice?
No. Research/education only. Verify primary filings.
Does it place trades?
No. Read-only by architecture; CI fails if a broker SDK appears.
Why not let the model call yfinance itself?
Because the model will still invent the second step (margins, DCF, “fine” leverage). The skill owns fetch + math + refusal.
What if data is missing?
We skip the analysis and list exact missing inputs + what filing unlocks them. We do not impute net debt as 0.
Does it work offline?
Yes — --fixture for CRWV/NBIS. Pure metrics are fully unit-tested offline.
Python versions?
3.10+
Contributing
pip install -e ".[dev]"
pytest tests/ -q --cov=scripts
ruff check scripts tests
mypy
PRs welcome. Prefer tests that lock fail-closed behavior. See CONTRIBUTING.md.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file finance_skills-0.5.2.tar.gz.
File metadata
- Download URL: finance_skills-0.5.2.tar.gz
- Upload date:
- Size: 70.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4789d01b7593fcec7a345bd69d94a36da91a880f6a8ba9beb9ccbad5d1c2d79a
|
|
| MD5 |
ac7179a17c456ea8303102a413cd243e
|
|
| BLAKE2b-256 |
e98c5376f47578a3195b969bd5d81ff6faf56af01c63fdeb5311848d6f1b3a0e
|
Provenance
The following attestation bundles were made for finance_skills-0.5.2.tar.gz:
Publisher:
release.yml on notEhEnG/finance-skills
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
finance_skills-0.5.2.tar.gz -
Subject digest:
4789d01b7593fcec7a345bd69d94a36da91a880f6a8ba9beb9ccbad5d1c2d79a - Sigstore transparency entry: 2139271448
- Sigstore integration time:
-
Permalink:
notEhEnG/finance-skills@47691212c0113672d6fbac0c3eb1116d735c2484 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/notEhEnG
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@47691212c0113672d6fbac0c3eb1116d735c2484 -
Trigger Event:
push
-
Statement type:
File details
Details for the file finance_skills-0.5.2-py3-none-any.whl.
File metadata
- Download URL: finance_skills-0.5.2-py3-none-any.whl
- Upload date:
- Size: 68.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9336baa281e8db3bfc0047be10d3d6a4f46c1f9a91d666d21a3b470338267a02
|
|
| MD5 |
ed63df1ee48cbd5cf13796efa4fd2463
|
|
| BLAKE2b-256 |
ed21c0ae93d3a4f3c01def7f48fd399ab862558b217187e6ae9eb177eac7271f
|
Provenance
The following attestation bundles were made for finance_skills-0.5.2-py3-none-any.whl:
Publisher:
release.yml on notEhEnG/finance-skills
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
finance_skills-0.5.2-py3-none-any.whl -
Subject digest:
9336baa281e8db3bfc0047be10d3d6a4f46c1f9a91d666d21a3b470338267a02 - Sigstore transparency entry: 2139271479
- Sigstore integration time:
-
Permalink:
notEhEnG/finance-skills@47691212c0113672d6fbac0c3eb1116d735c2484 -
Branch / Tag:
refs/tags/v0.5.2 - Owner: https://github.com/notEhEnG
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@47691212c0113672d6fbac0c3eb1116d735c2484 -
Trigger Event:
push
-
Statement type: