Skip to main content
skill CX Codex

earnings-preview · himself65 — Claude Code skill: what it does, how to install

Builds a pre-earnings brief for a ticker: report date and timing, EPS and revenue consensus, the beat/miss record, analyst targets.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add himself65/finance-skills --skill earnings-preview -a claude-code
Open on GitHub

What earnings-preview does

The skill pulls Yahoo Finance data through the yfinance library and assembles it into a briefing before an earnings call. You get the report date plus whether it lands before the open or after the close, consensus EPS and revenue with the low, high and analyst count, four quarters of estimated versus actual EPS, the Buy/Hold/Sell split, and the price-target range with the implied move from the mean. A closing "what to watch" section is the judgment part: the agent writes it from the company's revenue and margin trajectory. A spread wider than roughly 20% of consensus gets flagged as unusual uncertainty.

It first checks for yfinance with a python3 probe and runs pip install yfinance when the package is missing. Hosts that skip the pre-run probes, Codex among them, send the same commands through the shell tool. Without shell access the agent has to report that limit rather than invent numbers. One caveat that matters in practice: Yahoo Finance consensus can lag real-time providers by a few hours, so a fresh analyst revision may be absent from the brief. Output is research material, not advice.

What it helps with

  • draft a pre-earnings brief from a ticker
  • compare consensus EPS and revenue with year-ago figures
  • count beats and misses across four quarters
  • gauge the spread in analyst price targets
  • pick the line items to watch in the print

Example prompts for the agent

  • Give me a pre-earnings preview for AAPL: report date, timing and what the street expects.
  • What consensus EPS and revenue does NVDA have for this quarter?
  • Run the beat/miss record for TSLA over the last four quarters and show me the price targets.

How to install earnings-preview

1Skills CLI (Vercel)

npx skills add himself65/finance-skills --skill earnings-preview -a claude-code

2Manually: put the files in place

~/.claude/skills/earnings-preview/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/earnings-preview/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about earnings-preview

How do I install earnings-preview in Claude Code?

Run npx skills add himself65/finance-skills --skill earnings-preview -a claude-code. The skill file lands at ~/.claude/skills/earnings-preview/SKILL.md.

What does earnings-preview do?

It turns Yahoo Finance data into a briefing ahead of a report: date and timing, EPS and revenue consensus, beat/miss history, analyst ratings and price targets, plus a read on what the market will focus on.

What does it need to work?

Python with the yfinance package, which the skill installs itself via pip install yfinance if it is missing. Shell access is also required; without it the agent reports the limitation instead of producing numbers.

Source text

SKILL.md · MIT
---
name: earnings-preview
description: >
  Build a pre-earnings briefing for a stock from Yahoo Finance data (yfinance): the
  upcoming report date and timing, consensus EPS and revenue estimates with their range,
  the beat/miss track record, analyst ratings and price targets, and what to watch in
  the print. Use this skill whenever the user is preparing for an upcoming earnings
  report or asks what the street expects — consensus or whisper numbers, EPS
  expectations, whether a company will beat, an earnings setup, or an earnings-season
  preview — and whenever a ticker comes up in the context of upcoming earnings, even
  without the word "preview". For results that are already out, use earnings-recap.
---

# Earnings Preview Skill

If your host has not already executed the shell probes below (for example, in Codex), run the commands inside the `!` wrappers with its shell tool before choosing a setup path. Use the actual output; if shell access is unavailable, report that limitation.

Generates a pre-earnings briefing using Yahoo Finance data via [yfinance](https://github.com/ranaroussi/yfinance). Pulls together upcoming earnings date, consensus estimates, historical accuracy, analyst sentiment, and key financial context — everything you need before an earnings call.

**Important**: Data is for research and educational purposes only. Not financial advice. yfinance is not affiliated with Yahoo, Inc.

---

## Step 1: Ensure yfinance Is Available

**Current environment status:**

```
!`python3 -c "exec('try:\n import yfinance\n print(\'yfinance \' + yfinance.__version__ + \' installed\')\nexcept Exception:\n print(\'YFINANCE_NOT_INSTALLED\')')"`
```

If `YFINANCE_NOT_INSTALLED`, install it:

```python
import subprocess, sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "-q", "yfinance"])
```

If already installed, skip to the next step.

---

## Step 2: Identify the Ticker and Gather All Data

Extract the ticker symbol from the user's request. If they mention a company name without a ticker, look it up. Then fetch all relevant data in one script to minimize API calls.

```python
import yfinance as yf

ticker = yf.Ticker("AAPL")  # replace with actual ticker

# --- Core data ---
info = ticker.info
calendar = ticker.calendar
earnings_dates = ticker.get_earnings_dates(limit=8)  # report timestamps; the upcoming one has no Reported EPS yet
hist = ticker.history(period="1mo")                  # recent price performance

# --- Estimates ---
earnings_est = ticker.earnings_estimate
revenue_est = ticker.revenue_estimate

# --- Historical track record ---
earnings_hist = ticker.earnings_history

# --- Analyst sentiment ---
price_targets = ticker.analyst_price_targets
recommendations = ticker.recommendations

# --- Recent financials for context ---
quarterly_income = ticker.quarterly_income_stmt
quarterly_cashflow = ticker.quarterly_cashflow
```

### What to extract from each source

| Data Source | Key Fields | Purpose |
|---|---|---|
| `calendar` | Earnings Date, Ex-Dividend Date | When earnings are and key dates |
| `get_earnings_dates()` | Earnings Date (tz-aware timestamp), EPS Estimate, Reported EPS | Report timing: the upcoming row has no Reported EPS; a time at or after 16:00 ET means after the close, earlier times mean before the open |
| `earnings_estimate` | avg, low, high, numberOfAnalysts, yearAgoEps, growth (for 0q, +1q, 0y, +1y) | Consensus EPS expectations |
| `revenue_estimate` | avg, low, high, numberOfAnalysts, yearAgoRevenue, growth | Revenue expectations |
| `earnings_history` | epsEstimate, epsActual, epsDifference, surprisePercent | Beat/miss track record (indexed by fiscal quarter-end, oldest first) |
| `analyst_price_targets` | current, low, high, mean, median | Street price targets |
| `recommendations` | Buy/Hold/Sell counts | Sentiment distribution |
| `quarterly_income_stmt` | TotalRevenue, NetIncome, BasicEPS | Recent trajectory |

---

## Step 3: Build the Earnings Preview

The briefing should let the user see the setup at a glance. Cover these five areas; if the data for one is missing, say so in a line rather than dropping it.

1. **Date and context** — company, ticker, sector and industry; the report date and whether it lands before the open or after the close; current price with 1-week and 1-month performance; market cap.
2. **Consensus estimates** — a table of this quarter's EPS and revenue consensus with low, high, analyst count, year-ago value, and expected growth. A high/low spread wider than about 20% of consensus signals unusual uncertainty; say so when you see it.
3. **Beat/miss track record** — the last four quarters of estimated vs actual EPS with surprise %, summarized as a beat count and average surprise.
4. **Analyst sentiment** — the rating distribution (strong buy through strong sell) and the price-target range (low, mean, median, high), with the implied upside or downside from the mean target.
5. **What to watch** — the few things the market will focus on in this print, chosen for this company and sector: revenue growth accelerating or decelerating, margins expanding or compressing, line items that moved sharply quarter over quarter, and segment trends where the data has them. This is the judgment part of the briefing.

---

## Step 4: Respond to the User

Open with the headline — the report date and a one-line read of the setup — then the five areas above, using tables where they help. Close with a short read of the overall setup drawn from the estimates, track record, and sentiment, framed as what the street expects rather than a recommendation.

Include the caveats that apply: estimates can change until the report date, past beats don't guarantee future ones, Yahoo Finance consensus can lag real-time providers by a few hours, and this is not financial advice.

---

## Reference Files

- `references/api_reference.md` — Detailed yfinance API reference for earnings and estimate methods

Read the reference file when you need exact method signatures or edge case handling.

© himself65 · MIT · himself65/finance-skills

Similar skills

Everything for Finance and business →

earnings-preview by other authors comes first.

From the same set23

stock-correlation Finds the stocks that move alongside a given ticker and measures the link: correlation, beta, spread, or a matrix for a whole group. Useful when you need to know what drags a name along. CX Codex +1 3,400installs options-payoff Builds an interactive options payoff chart with expiry P&L and Black–Scholes theoretical value for reviewing single- or multi-leg positions. CX Codex +1 3,400installs generative-ui Provides design system rules and templates for interactive HTML and SVG widgets. Useful when you need charts, diagrams, or calculators instead of plain text. CX Codex +1 3,200installs earnings-recap Analyzes a published company earnings report using EPS, revenue, margins and the stock reaction. Use it when you need to assess a beat, miss or post-report move. CX Codex +1 3,200installs twitter-reader Reads Twitter/X through opencli: home timeline, tweet search, trending, bookmarks, profiles and notifications. Read-only, built for financial research. CX Codex +1 3,100installs etf-premium Works out whether an ETF trades above or below NAV using Yahoo Finance data, compares funds against each other, and breaks a sudden price jump into its causes. CX Codex +1 3,100installs stock-liquidity Evaluates stock liquidity via yfinance: bid-ask spreads, trading volume, and market impact. Helps gauge trading costs before entering or exiting positions. CX Codex +1 3,100installs estimate-analysis Pulls sell-side EPS and revenue estimates for a ticker from Yahoo Finance and shows how the consensus moved over the last 7, 30, 60 and 90 days. CX Codex +1 3,200installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor