position-sizer
Skill4 starsChanged 2 months agoMITView on GitHub
Use this skill to calculate a risk-based position size (how many shares to buy) from an account size, risk tolerance, entry price, and stop distance. Trigger on "how many shares should I buy", "position size", "risk per trade", "ATR-based stop", "Kelly criterion", "risk 1% of account". If the user hasn't given a stop-loss level or risk percentage, ask for those before calculating — sizing without a defined risk per trade isn't really position sizing.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- rgourley/quant-garagetheir own version, first seen Nov 1, 2026
- IngAs8/ClaudeSkilltheir own version, first seen Sep 28, 2026
- Wind-Alice/AliceMarkettheir own version, first seen Apr 28, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- Wind-Alice/AliceMarket★ 147same name
- rgourley/quant-garage★ 7same name
- IngAs8/ClaudeSkill★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository58 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/project-docs-prep/templates/AGENTS.mdAGENTS.md
- skills/project-docs-prep/templates/CLAUDE.mdCLAUDE.md
- deep-planningSkill
- deep-planningSkill
- deprecatedSkill
- architecture-reviewSkill
- code-reviewSkill
- diagnoseSkill
- tddSkill
- ui-design-engineeringSkill
- ux-ui-design-assessmentSkill
- in-progressSkill
- mcp-tool-managementSkill
- skill-managementSkill
- obsidian-canvasSkill
- obsidian-markdownSkill
- obsidian-notion-bridgeSkill
- obsidian-vault-workflowSkill
- boomz-preferencesSkill
- personal-agent-workflowSkill
- personalSkill
- automation-designSkill
- grill-with-docsSkill
- handoffSkill
- inbox-meeting-triageSkill
- markdown-reportSkill
- prompt-improvementSkill
- project-docs-prepSkill
- claim-citation-checkSkill
- daily-news-reportSkill
- github-skill-researchSkill
- project-discoverySkill
- repo-tourSkill
- research-methodologySkill
- seo-website-evaluatorSkill
- thaiSkill
- thai-addressSkill
- thai-customer-serviceSkill
- thai-date-formatSkill
- thai-festival-cardSkill
- thai-government-formSkill
- thai-id-validateSkill
- thai-invoiceSkill
- thai-pdpaSkill
- thai-resumeSkill
- thai-social-captionSkill
- thai-text-processingSkill
- thai-translateSkill
- backtest-expertSkill
- dividend-value-screenerSkill
- drawdown-circuit-breakerSkill
- exposure-coachSkill
- market-breadth-analyzerSkill
- portfolio-managerSkill
- tradingSkill
- trader-memory-coreSkill
- uptrend-analyzerSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
No stop-loss level or risk percentage has been specified — ask for these first.
- Very specific: line 38
ATR-based stop: instead of a fixed percentage stop, scale the stop distance to the security's own recent volatility: stop_price = …
- Very specific: line 59
Run python3 size.py for the self-test.
- Distinctive: line 63
Does not model fractional shares, lot-size minimums, or broker-specific constraints — output is whole shares only.
- Distinctive: line 64
Does not account for commissions/slippage in the risk calculation.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Position Sizer
Overview
"How many shares should I buy?" only has a defensible answer once you know how much you're willing to lose if the stop is hit. This skill does the arithmetic — fixed-fractional risk sizing, ATR-based stop distance, and Kelly criterion — on numbers the user supplies. It does not fetch prices or recommend a trade.
Not financial advice. This calculates how many shares fit a chosen risk budget; it does not evaluate whether the trade itself is a good idea.
When to use
- คำนวณจำนวนหุ้นที่ควรซื้อ ตามความเสี่ยงที่รับได้ต่อไม้
- Sizing a position given account equity, entry price, and a stop-loss level
- Converting ATR (Average True Range) into a volatility-scaled stop and matching position size
- Estimating a Kelly-criterion fraction from historical win-rate/win-loss stats (as an upper bound, not a recommendation — see Known limitations)
When NOT to use
- No stop-loss level or risk percentage has been specified — ask for these first; sizing "how many shares fit my account" without a risk budget is really just "how much can I afford," a different question
- The user wants a signal on whether to take the trade at all — this skill only sizes a trade already decided on
Core knowledge
Fixed-fractional sizing: risk a fixed percentage of account equity per trade.
dollar_risk_per_share = |entry_price - stop_price|
total_risk_amount = account_equity × risk_pct
shares = floor(total_risk_amount / dollar_risk_per_share)Shares are always rounded down so actual dollar risk never exceeds the budget. Common risk_pct defaults discussed in trading literature range roughly 0.5%-2% per trade — this skill doesn't assert a "correct" number; ask the user or use their stated tolerance.
ATR-based stop: instead of a fixed percentage stop, scale the stop distance to the security's own recent volatility: stop_price = entry_price - (ATR × multiplier), commonly multiplier 1.5-3×. Then size with the same fixed-fractional formula using this derived stop distance.
Kelly criterion: f = win_rate - (1 - win_rate) / b, where b = avg_win / avg_loss. This gives the theoretically optimal fraction of capital to risk given accurate win-rate/win-loss inputs — in practice those inputs are estimated from limited history and are often wrong, so full Kelly is aggressive and prone to large drawdowns from estimation error. Traders commonly use a fraction of it ("half Kelly" or less). This skill returns the raw fraction and does not apply that discount — treat it as an upper bound to discuss, not a size to use directly.
Common mistakes
- Sizing a position without a defined stop — there's no "risk per share" to base the calculation on.
- Rounding shares up instead of down — rounding up means actual dollar risk can exceed the stated budget.
- Using full Kelly fraction directly as a position size without acknowledging estimation-error risk.
- Treating ATR multiplier or risk percentage as fixed universal constants — both are user/strategy-specific choices this skill takes as parameters, not defaults to assert.
- Confusing
dollar_risk_per_share(entry-to-stop distance) withposition_value(entry price × shares) — a small risk-per-share doesn't mean a small total position value; report both.
Code
size.py — pure Decimal arithmetic, no dependencies:
fixed_fractional_size(account_equity, risk_pct, entry_price, stop_price)→SizeResult(shares, dollar_risk_per_share, total_risk_amount, actual_risk_amount, position_value)atr_based_stop(entry_price, atr, multiplier=2.0)→ stop priceatr_based_size(account_equity, risk_pct, entry_price, atr, multiplier=2.0)→SizeResult, derives the stop from ATR firstkelly_fraction(win_rate, avg_win, avg_loss)→ raw Kelly fraction (see caveat above)
Run python3 size.py for the self-test.
Known limitations
- Does not model fractional shares, lot-size minimums, or broker-specific constraints — output is whole shares only.
- Does not account for commissions/slippage in the risk calculation.
- Kelly fraction is highly sensitive to input estimation error — never present the raw output as a recommended size without flagging that.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

