compute-precious-miner-gross-margin

compute-precious-miner-gross-margin is a skill for Claude Code, Codex from fatfingererr/macro-skills. It costs 71 tokens per session (3,201 once invoked), scanned A, original, MIT.

A mining analysis workflow that estimates how much of a gold or silver price remains after production costs such as AISC, or all-in sustaining cost.

In plain words
What is it for?
Use it to calculate company or basket margin estimates, weight them by production or market value, and place the results in historical context.
Why use it?
It provides a comparable price-versus-cost view when accounting gross margin is not the intended measure, including across a group of mining companies.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to calculate company or basket margin estimates, weight them by production or market value, and place the results in historical context.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/fatfingererr/macro-skills/compute-precious-miner-gross-margin
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add fatfingererr/macro-skills --skill compute-precious-miner-gross-margin
Clone the repo
git clone --depth 1 https://github.com/fatfingererr/macro-skills

Made for: Claude Code, Codex.

Its marketplace also offers this one on its own, as the plugin compute-precious-miner-gross-margin/plugin install compute-precious-miner-gross-margin after adding the marketplace above.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for compute-precious-miner-gross-margin

README.md
[![agentmods](https://agentmods.dev/badge/skills/fatfingererr/macro-skills/compute-precious-miner-gross-margin/github.svg)](https://agentmods.dev/skills/fatfingererr/macro-skills/compute-precious-miner-gross-margin)
Your own site
<a href="https://agentmods.dev/skills/fatfingererr/macro-skills/compute-precious-miner-gross-margin"><img src="https://agentmods.dev/badge/skills/fatfingererr/macro-skills/compute-precious-miner-gross-margin/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for compute-precious-miner-gross-margin

Your own site · 80×15
<a href="https://agentmods.dev/skills/fatfingererr/macro-skills/compute-precious-miner-gross-margin"><img src="https://agentmods.dev/badge/skills/fatfingererr/macro-skills/compute-precious-miner-gross-margin.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 71 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,201 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00071 $0.03201
Opus 5 $0.00036 $0.01600
Sonnet 5 $0.00014 $0.00640
Haiku 4.5 $0.00007 $0.00320

Measured 11d ago against content hash 0c2aa196756c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

compute-precious-miner-gross-margin scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/margin_calculator.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/compute-precious-miner-gross-margin/SKILL.md · 302 lines

How it starts

The opening of the file, as written. The whole thing — 302 lines — stays where its author put it; the contents beside it link to each section on GitHub.

<essential_principles>

礦業毛利率代理(Margin Proxy)使用簡化公式:

gross_margin_proxy = (metal_price - unit_cost) / metal_price

其中:

  • metal_price:金屬現貨價或期貨近月價
  • unit_cost:AISC (All-In Sustaining Cost)、現金成本(C1)或全成本

此指標不等同會計報表的毛利率,但能快速捕捉價格-成本關係的邊際變化。

口徑 包含項目 適用場景
Cash Cost (C1) 現場採掘 + 加工 + 場內行政 現金流壓力測試
AISC C1 + 維持資本開支 + 勘探 + 行政 行業標準(WGC 定義)
All-In Cost (AIC) AISC + 成長資本開支 完整經濟成本

建議優先使用 AISC,因其可比性最佳且資料可得性高。

方法 公式 直覺
equal_weight Σ margin_i / N 簡單平均,每家公司等權
production_weighted Σ (margin_i × prod_i) / Σ prod_i 產量加權,反映「產業毛利」
marketcap_weighted Σ (margin_i × mcap_i) / Σ mcap_i 市值加權,反映「股權曝險」

建議使用 production_weighted 以更準確反映產業整體毛利結構。

  • 金屬價格:日頻或月均價
  • 礦業成本:季度(多數公司僅在季報揭露 AISC)
  • 對齊方式
    • 將成本 forward-fill 至季度內各期
    • 或使用同季均價(更乾淨)

本 Skill 建議使用 季度頻率 作為基準,避免過度平滑。

本 skill 使用公開數據

  • 金價:LBMA Gold Price / COMEX 近月期貨
  • 銀價:LBMA Silver Price / COMEX 近月期貨
  • AISC:公司 IR 投資人簡報 / 季報 MD&A / 新聞稿
  • 產量:同上,單位 oz / GEO / AgEq oz

腳本位於 scripts/ 目錄,可直接執行。

</essential_principles>

  1. 數據整合:抓取金屬價格序列與礦業成本/產量數據
  2. 計算毛利率代理:單一公司層級 + 籃子聚合
  3. 歷史分位數:判斷當前水位在歷史區間的位置
  4. 驅動拆解:區分價格驅動 vs 成本驅動
  5. 訊號生成:極端高/低檔區間標記

輸出:毛利率時序、歷史分位、驅動拆解、交易/研究連結。

<quick_start>

最快的方式:執行預設情境分析

cd skills/compute-precious-miner-gross-margin
pip install pandas numpy requests yfinance beautifulsoup4 lxml  # 首次使用
python scripts/margin_calculator.py --quick --metal gold

輸出範例:

{
  "skill": "compute_precious_miner_margin_proxy",
  "metal": "gold",
  "frequency": "quarterly",
  "cost_metric": "AISC",
  "basket": {
    "miners": ["NEM", "GOLD", "AEM"],
    "aggregation": "production_weighted"
  },
  "latest": {
    "date": "2025-Q4",
    "metal_price_usd_oz": 2650.0,
    "unit_cost_proxy_usd_oz": 1320.0,
    "gross_margin_proxy": 0.502,
    "history_percentile": 0.78,
    "regime_label": "high_margin"
  }
}

完整情境分析

python scripts/margin_calculator.py \
  --metal silver \
  --miners CDE,HL,AG \
  --start-date 2015-01-01 \
  --frequency quarterly \
  --cost-metric AISC \
  --aggregation production_weighted \
  --output result.json

</quick_start>

  1. 快速計算 - 使用預設參數計算主要礦業籃子的毛利率代理
  2. 完整分析 - 自訂參數進行情境分析(可選擇金屬、礦業、成本口徑)
  3. 數據研究 - 了解如何獲取 AISC / 成本數據(爬蟲設計)
  4. 訊號生成 - 將毛利率轉為交易/研究訊號
  5. 方法論學習 - 了解計算邏輯與數據來源

請選擇或直接提供分析參數。

路由後,閱讀對應文件並執行。

<directory_structure>

compute-precious-miner-gross-margin/
├── SKILL.md                           # 本文件(路由器)
├── skill.yaml                         # 前端展示元數據
├── manifest.json                      # 技能元數據
├── workflows/
│   ├── analyze.md                     # 完整情境分析工作流
│   ├── data-research.md               # 數據源研究與爬蟲設計
│   └── signal-generation.md           # 訊號生成工作流
├── references/
│   ├── data-sources.md                # 數據來源與獲取方式
│   ├── methodology.md                 # 方法論與計算邏輯
│   └── input-schema.md                # 完整輸入參數定義
├── templates/
│   ├── output-json.md                 # JSON 輸出模板
│   └── output-markdown.md             # Markdown 報告模板
├── scripts/
│   └── margin_calculator.py           # 主計算腳本
└── examples/
    └── sample-output.json             # 範例輸出

</directory_structure>

Read the full file on GitHub · 302 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 302 lines · 71 tokens per session scan A 0c2aa196756c

Subscribe to this mod's changes

compute-precious-miner-gross-margin is a skill published in the GitHub repository fatfingererr/macro-skills (3 stars, last pushed 7mo ago), licensed MIT. It adds 71 tokens to every session and 3,201 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

sector-rotation

An analysis framework for comparing industries in the Chinese A-share stock market, using business conditions, price momentum, valuation, and money flows. It produces rankings and higher- or lower-allocation suggestions.

HKUDS/Vibe-Trading · 39 tokens

strategy-pivot-designer

Detect backtest iteration stagnation and generate structurally different strategy pivot proposals when parameter tuning reaches a local optimum.

tradermonty/claude-trading-skills · 28 tokens

twitter-reader

Read Twitter/X for financial research using opencli (read-only). Use this skill whenever the user wants to read their Twitter feed, search for financial tweets, view bookmarks, look up user profiles, or gather market sentiment from Twitter/X. Triggers include: "check my feed", "search Twitter for", "show my…

himself65/finance-skills · 161 tokens

chenhao-limit-up

A framework for judging Chinese A-share stocks that have reached the daily price-rise limit, using market mood, sector leadership, and trading momentum.

questflowai/investorskills · 44 tokens

furusato

A Japanese hometown-tax donation manager for furusato nozei, a system where donations to municipalities can qualify for an income-tax or local-tax deduction. It reads donation receipts, stores donation records, and calculates deduction limits.

kazukinagata/shinkoku · 102 tokens

reading-receipt

An image-reading workflow for extracting structured information from receipts, invoices, and hometown-tax donation certificates. It can first extract text from PDFs and otherwise read their images.

kazukinagata/shinkoku · 64 tokens