Greenblatt Magic logo

Greenblatt Magic

Community
mrhustlex
greenblatt-magic

Joel Greenblatt Magic Formula — rank stocks by Return on Capital (quality) + Earnings Yield (cheapness), buy the top, hold ~1yr, rebalance. Mechanical, evidence-based value+quality. yfinance-based ranker.

Overview

Publishermrhustlex
RepositoryTrading-Masters-Strategies
Skill namegreenblatt-magic
Stars
28
Forks
6
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by mrhustlex on GitHub. Read the source before you install it.

Installation

Install the Greenblatt Magic AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/mrhustlex/Trading-Masters-Strategies/tree/main/skills/greenblatt-magic
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mrhustlex/Trading-Masters-Strategies.git /tmp/Trading-Masters-Strategies
mkdir -p .claude/skills
cp -r /tmp/Trading-Masters-Strategies/skills/greenblatt-magic .claude/skills/greenblatt-magic
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Greenblatt Magic in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Greenblatt Magic on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Greenblatt Magic is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Joel Greenblatt — Magic Formula (v1.0)

Goal: a mechanical system that buys good businesses at cheap prices, with no emotion. Greenblatt (Returns of 30%/yr backtested in "The Little Book That Beats the Market"). The perfect "set-and-forget quantitative" companion to the discretionary masters.

0. Plain English

Rank all stocks on two things: how good a business (high ROC) and how cheap (high earnings yield). Add the two ranks; buy the names with the lowest combined rank. Hold ~1 year, rebalance. That's the whole formula.

1. The two formulas (exact)

  • Return on Capital (ROC) = EBIT ÷ (Net Fixed Assets + Net Working Capital)
  • Earnings Yield = EBIT ÷ Enterprise Value
  • Rank each stock 1..N on ROC (1 = best) and on Earnings Yield (1 = best). Add ranks.
  • Buy the ~20–30 with the lowest combined rank. Hold 1 year, sell, repeat.

2. Rules

  • Only invest in companies with market cap above a threshold (avoid micro-caps / utilities / financials per Greenblatt).
  • Equal-weight the 20–30 names.
  • Rebalance annually. Ignore news, charts, macro.
  • Expect to underperform in some years (behavioral sticking-power is the edge).

3. Do / Don't

DO: mechanize it; hold a year; rebalance; ignore the noise. DON'T: tweak the formula emotionally; sell early on a bad month; skip the annual rebalance; add "your favourite" stocks.

4. Script (references/magic.py)

Computes ROC + earnings yield from yfinance (EBIT via ebit, EV via marketCap+debt−cash), ranks a universe, prints the top names by combined rank.

bash
cd <skill>/references
python3 magic.py --universe ../../scripts/universe.txt --top 20
python3 magic.py AAPL KO JPM XOM

5. Reality notes

  • yfinance ebit lives in financials/incomeStmt; may be None for some → skipped.
  • Excludes financials/utilities (Greenblatt) — script filters those sectors if available.
  • Past 30%/yr is backtested; live results vary. The discipline (annual hold + rebalance) is the real edge.

6. Pitfalls

  • ❌ Abandoning it after one bad year (most do — that's why it works).
  • ❌ Mixing with momentum timing.
  • ❌ Using it on tiny/illiquid names.

Compiled 2026-08-17 from Greenblatt "The Little Book That Beats the Market". Not financial advice.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Greenblatt Magic AI skill do?

Joel Greenblatt Magic Formula — rank stocks by Return on Capital (quality) + Earnings Yield (cheapness), buy the top, hold ~1yr, rebalance. Mechanical, evidence-based value+quality. yfinance-based ranker.

Why use Greenblatt Magic on TypingMind?

Because you install it once and use it with any model. Greenblatt Magic is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Greenblatt Magic in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/mrhustlex/Trading-Masters-Strategies/tree/main/skills/greenblatt-magic. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Greenblatt Magic?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Greenblatt Magic?

As many as you like. As long as a model supports skills, you can use Greenblatt Magic with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Greenblatt Magic AI skill free?

Yes. It is published on GitHub by mrhustlex under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇