agentleFS
AtmoskunAtmoskun/claude-skills/skills/trade/SKILL.md

trade

Skill0 starsChanged 9 months agoMITView on GitHub

Trade Logger - Log trades with execution details, thesis links, and risk management

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 7

    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
  1. Distinctive:

    If thesis exists: Link to it in the trade log

    line 62
  2. Distinctive:

    If NO thesis for BUY/SHORT: Add a warning note (but still log the trade)

    line 63
  3. Distinctive:

    If a file with that name already exists (multiple trades same day), append a sequence number:

    line 69
  4. Distinctive:

    If thesis file exists, append an entry to the Position History table.

    line 75
  5. Very specific:

    After exit trades (SELL/COVER), also prompt: "考虑更新 thesis: /thesis {TICKER} update \"Exited — {REASON}\""

    line 144
  6. Distinctive:

    If the portfolio API is unavailable or ticker not found:

    line 148
  7. Distinctive:

    Leave position fields as "N/A"

    line 150
  8. Distinctive:

    When logging exits, the trade log should note:

    line 155
  9. Very specific:

    If the user wants to record DJ immediately, tell them to use /dj TICKER ACTION in Telegram.

    line 190

“Common” is measured: kept by at least 6 in 10 of the 6 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Trade Logger

Quick trade logging during market hours with minimal friction. Logs trades as markdown files with automatic position context.

Project Location

~/PORTFOLIO

Syntax

/trade {ACTION} {TICKER} {QTY} @ {PRICE} "{REASON}"

Actions: BUY, SELL, SHORT, COVER, ADD, TRIM

Examples:

  • /trade BUY AAPL 100 @ 185.50 "AI services growth thesis"
  • /trade SELL NVDA 50 @ 140 "Taking profits after run"
  • /trade ADD TSM 200 @ 330 "Buying the dip"
  • /trade TRIM NVDA 100 @ 145 "Reducing position size"

Quick Mode Workflow

This is a quick mode skill - minimal questions, maximum speed.

1. Parse Trade Details

Extract from command:

  • ACTION: BUY/SELL/SHORT/COVER/ADD/TRIM
  • TICKER: Stock symbol
  • QTY: Number of shares
  • PRICE: Execution price
  • REASON: Why this trade (the quoted text)

2. Fetch Current Position

curl -s http://localhost:8000/api/portfolio

From the response, find the ticker and extract:

  • Current shares held
  • Average cost basis
  • Market value
  • Total portfolio NAV

Calculate:

  • Trade total value: qty * price
  • % of NAV: (trade_total / nav) * 100
  • New position size after trade

3. Check for Existing Thesis

Look for: ~/PORTFOLIO\research\companies\{TICKER}\thesis.md

  • If thesis exists: Link to it in the trade log
  • If NO thesis for BUY/SHORT: Add a warning note (but still log the trade)

4. Create Trade Log

File: ~/PORTFOLIO\decisions\trades\{YYYY-MM-DD}_{ACTION}_{TICKER}.md

If a file with that name already exists (multiple trades same day), append a sequence number:

  • 2026-01-27_BUY_TSM.md (first trade)
  • 2026-01-27_BUY_TSM_2.md (second trade same day)

5. Update Thesis Position History (if exists)

If thesis file exists, append an entry to the Position History table.

6. Confirm to User

Display a brief confirmation:

✓ Logged: BUY 100 TSM @ $332.71 ($33,271)
  Position after: 8,900 shares (15.55% of NAV)
  Thesis: Linked ✓

Trade Log Template

# Trade: {ACTION} {TICKER}

| Field | Value |
|-------|-------|
| Date | {YYYY-MM-DD HH:MM} |
| Action | {ACTION} |
| Ticker | {TICKER} |
| Qty | {QTY} |
| Price | ${PRICE} |
| Total | ${TOTAL} |
| % of NAV | {PCT}% |

## Position After Trade
- Shares: {NEW_SHARES}
- Avg Cost: ${AVG_COST}
- % of NAV: {POSITION_PCT}%

## Rationale
{REASON from command}

## Thesis Link
[{TICKER} Thesis](../../research/companies/{TICKER}/thesis.md)

## Risk (fill manually)
- Stop: $___
- Target: $___

---
*Logged via /trade command*

7. Post-Trade 自动检查

交易记录完成后,Claude 自动执行以下检查(不需要用户要求):

1. Thesis 自动检查

  • 读取 ~/PORTFOLIO/portfolio_monitor/research/companies/{TICKER}/thesis.md
  • 如果 thesis 存在:
    • 读取 Position History 表
    • 如果当前交易与 thesis 记录一致 → 自动添加新行到 Position History,输出 1 行摘要
    • 如果数据不一致(如 thesis 记录的方向/仓位与交易矛盾)→ 提示用户确认,不静默覆盖
    • 输出: "[Thesis: conviction High, last updated 15 days ago]"
  • 如果 thesis 不存在:
    • "{TICKER} 没有投资论文,建议 /thesis {TICKER} 创建"

2. Passed Record 自动检查

  • 检查 ~/PORTFOLIO/portfolio_monitor/research/companies/{TICKER}/passed.md
  • 如果 passed.md 存在:
    • "你曾在 {date} pass 了 {TICKER},当时理由: {reason}。确定要交易?"
  • 如果不存在: 静默通过

3. Flashback 建议(不自动执行)

  • 输出: "如需查看完整研究轨迹: /flashback {TICKER}"
  • 不自动执行(扫描 12 个数据源,token 消耗大)

After exit trades (SELL/COVER), also prompt: "考虑更新 thesis: /thesis {TICKER} update \"Exited — {REASON}\""

If No Position Data Available

If the portfolio API is unavailable or ticker not found:

  • Still create the trade log
  • Leave position fields as "N/A"
  • Note: "Position data unavailable - update manually"

For Exit Trades (SELL/COVER/TRIM)

When logging exits, the trade log should note:

  • Shares sold
  • Remaining position (if any)
  • Calculate realized P&L if average cost is known

Key Calculations

Trade Total:

total = qty * price

Position % of NAV:

pct_nav = (total_shares * current_price) / nav * 100

New Average Cost (for ADD/BUY):

new_avg = (old_qty * old_avg + new_qty * new_price) / (old_qty + new_qty)

Output Files

  • decisions/trades/{YYYY-MM-DD}_{ACTION}_{TICKER}.md - Trade log
  • Updates research/companies/{TICKER}/thesis.md - Position history (if exists)

Decision Journal

Trade logging and decision journaling are separate concerns:

  • /trade = execution record (speed, minimal friction, market hours)
  • Decision Journal = thought process + emotions (captured via Nightly Journal Check at 10 PM through Telegram)

Do NOT ask DJ questions during /trade. The Telegram bot will automatically push each unrecorded trade at 10 PM and walk through the DJ flow (emotion → confidence → why now → what if wrong → alternatives).

If the user wants to record DJ immediately, tell them to use /dj TICKER ACTION in Telegram.

Important Notes

  • No questions asked - just parse and log
  • Speed is priority - market hours, need quick logging
  • Risk fields (stop/target) left blank for manual fill later
  • Thesis creation is separate - use /thesis {TICKER} command
  • Decision Journal is separate - handled by Telegram Nightly Check (10 PM)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.