investments
Skill0 starsChanged 4 months agoMITView on GitHub
Manage investment securities lifecycle including purchase, mark-to-market, and sale. Use when user wants to (1) process investment transactions from source files, (2) run the interactive workflow with guided questions, (3) execute scripts directly, or (4) understand AFS vs Trading accounting treatment and account mappings.
In this repository52 other files it gives its agents.
- skills/composition-patterns/AGENTS.mdAGENTS.md
- sample-project/CLAUDE.mdCLAUDE.md
- agent-orchestratorSkill
- api-designSkill
- banner-designSkill
- brainstormingSkill
- brandSkill
- capital-accountsSkill
- composition-patternsSkill
- continuous-learning-v2Skill
- contract-reviewSkill
- credential-scannerSkill
- deployment-patternsSkill
- design-systemSkill
- dispatching-parallel-agentsSkill
- docker-patternsSkill
- e2e-testingSkill
- executing-plansSkill
- finishing-a-development-branchSkill
- fixed-assetsSkill
- frontend-designSkill
- git-guardrails-claude-codeSkill
- graphifySkill
- huashu-designSkill
- iterative-retrievalSkill
- legal-agreementSkill
- plain-english-translationSkill
- terms-of-service-generatorSkill
- pdfSkill
- prd-to-issuesSkill
- prd-to-planSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- security-reviewSkill
- shapeSkill
- slidesSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- triage-issueSkill
- ui-stylingSkill
- ui-ux-pro-maxSkill
- using-git-worktreesSkill
- using-superpowersSkill
- verification-before-completionSkill
- video-prompt-builderSkill
- webapp-testingSkill
- web-design-guidelinesSkill
- write-a-prdSkill
- writing-plansSkill
- writing-skillsSkill
- xlsxSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
When user invokes /investments or asks to process securities:
- Distinctive: line 57
Before generating any journal entries or reports, you MUST obtain these from the user:
- Distinctive: line 59
Report Period End Date: - Always ask the user; never assume a date
- Distinctive: line 60
Transaction Dates: - Must be provided for each purchase, sale, or FMV adjustment
- Distinctive: line 78
Only affects equity, not P&L
- Distinctive: line 79
When sold, reclassified to realized gain/loss
- Very specific: line 110
After generating ANY XLSX files, Claude MUST run recalc.py to recalculate formulas and verify zero errors:
- Very specific: line 122
If status: success → "Generated [file] with X formulas, 0 errors"
- Very specific: line 123
If status: errors_found → Show error details and fix before delivering
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Investments Module
Manage investment securities lifecycle: purchase, mark-to-market, and sale.
Interactive Workflow
When user invokes /investments or asks to process securities:
First, check for source files:
"Let me check what source data is available in data/source/investments/"
Run:
ls -la data/source/investments/- If source files exist, ask:
"I found these files: [list]. Which file contains the data you want to process?"
- If no source files, ask:
"No source files found in data/source/investments/. Would you like to:
- Place a CSV/PDF file there and try again
- Enter transaction details manually"
- Then ask operation:
What would you like to do?
- Purchase - Record securities acquisition
- Mark-to-Market - Fair value adjustment
- Sell - Record securities sale
- Rollforward - Generate unrealized G/L rollforward
- Status - View current holdings
Source Data Location
Users should place their securities data files in:
data/source/investments/Supported formats: CSV, PDF (broker statements, trade confirmations)
View current securities register:
cat data/output/investments/securities_register.json | python3 -m json.toolRequired User Inputs
Before generating any journal entries or reports, you MUST obtain these from the user:
- Report Period End Date - Always ask the user; never assume a date
- Transaction Dates - Must be provided for each purchase, sale, or FMV adjustment
- Security Classification - AFS or Trading (affects accounting treatment)
Accounting Policies
- AFS Securities: Unrealized G/L recorded in OCI (equity), not P&L
- Trading Securities: Unrealized G/L recorded directly in P&L
- Realized G/L: Recognized immediately at sale date
- Cost Basis: User must provide cost basis on sales (FIFO, LIFO, or specific ID)
Security Classifications
Available for Sale (AFS)
- Unrealized gains/losses go to OCI (Other Comprehensive Income)
- Only affects equity, not P&L
- When sold, reclassified to realized gain/loss
Trading Securities
- Unrealized gains/losses go directly to P&L
- Mark-to-market affects income statement
Reference Documents
| Topic | Reference |
| GL account codes | references/account_mapping.md |
| Rollforward report format | references/rollforward_format.md |
Scripts
scripts/
├── purchase.py # Record securities acquisition
├── sale.py # Record sale with realized gain/loss
├── mark_to_market.py # Fair value adjustments
└── rollforward.py # Unrealized G/L rollforward reportXLSX Post-Processing (MANDATORY)
After generating ANY XLSX files, Claude MUST run recalc.py to recalculate formulas and verify zero errors:
.venv/bin/python lib/recalc.py <output_file.xlsx>Example:
.venv/bin/python lib/recalc.py data/output/investments/securities_rollforward_2025-09-30.xlsxReport results to user:
- If
status: success→ "Generated [file] with X formulas, 0 errors" - If
status: errors_found→ Show error details and fix before delivering
DO NOT deliver XLSX files without running recalc.py first.
1. Purchase
Record securities acquisition.
.venv/bin/python .claude/skills/investments/scripts/purchase.py \
--name "TechCorp Inc." \
--date "2025-04-08" \
--shares 500 \
--price 75.00 \
--security-type AFS \
--output-dir "data/output/investments"Parameters:
--name: Security name--date: Purchase date (YYYY-MM-DD)--shares: Number of shares--price: Price per share--security-type: AFS (Available for Sale) or Trading--output-dir: Output directory (default: data/output/investments)
Journal Entry:
Dr 1750 Investments - AFS $37,500
Cr 1000 Cash $37,5002. Mark to Market (FMV Adjustment)
Record period-end fair value adjustment.
.venv/bin/python .claude/skills/investments/scripts/mark_to_market.py \
--name "TechCorp Inc." \
--date "2025-09-30" \
--fair-value 45000 \
--output-dir "data/output/investments"Parameters:
--name: Security name (must exist in holdings)--date: Valuation date (YYYY-MM-DD)--fair-value: Current fair market value--output-dir: Output directory (default: data/output/investments)
Journal Entry (AFS Gain):
Dr 1750 Investments - AFS $3,000
Cr 3600 Accumulated OCI $3,000Journal Entry (Trading Gain):
Dr 1760 Investments - Trading $3,000
Cr 7400 Unrealized Gain $3,0003. Sale
Record securities sale with realized gain/loss.
.venv/bin/python .claude/skills/investments/scripts/sale.py \
--name "TechCorp Inc." \
--date "2025-09-15" \
--shares 500 \
--cost-basis 37500 \
--proceeds 46000 \
--security-type AFS \
--output-dir "data/output/investments"Parameters:
--name: Security name--date: Sale date (YYYY-MM-DD)--shares: Number of shares sold--cost-basis: Total cost basis of shares sold--proceeds: Total sale proceeds--security-type: AFS or Trading--output-dir: Output directory (default: data/output/investments)
Journal Entry (Gain):
Dr 1000 Cash $46,000
Cr 1750 Investments - AFS $37,500
Cr 7300 Realized Gain $8,500XLSX Output Structure:
The sale XLSX includes a full gain/loss calculation with formulas:
SECURITIES SALE - GAIN/LOSS CALCULATION
Security: TechCorp Inc.
Sale Date: 2025-09-15
Classification: AFS
COST BASIS CALCULATION
Total Shares (before sale): 500 (input)
Total Cost Basis: $37,500.00 (input)
Cost Per Share: =TotalCost/TotalShares (formula)
Shares Sold: 500 (input)
Cost Basis of Shares Sold: =SharesSold*CostPerShare (formula)
GAIN/LOSS CALCULATION
Sale Proceeds: $46,000.00 (input)
Less: Cost Basis: =CostBasisCalc (formula)
REALIZED GAIN: =Proceeds-CostBasis (formula)
JOURNAL ENTRIES
[Standard journal entry format with DR/CR totals]4. Unrealized G/L Rollforward
Generate a rollforward report showing movement in cost basis, unrealized gains/losses, and fair value. Also generates a consolidated journal with all period transactions.
.venv/bin/python .claude/skills/investments/scripts/rollforward.py \
--report-date "2025-09-30" \
--period-type quarterly \
--output-dir "data/output/investments"Parameters:
--report-date: Period end date (YYYY-MM-DD) - required--period-begin: Period begin date (YYYY-MM-DD) - alternative to --period-type--period-type:quarterly,half-year, orannual- auto-calculates begin date--output-dir: Output directory (default: data/output/investments)
Output Files:
securities_rollforward_<date>.csv/.xlsx- Rollforward reportjournal_<date>.csv/.xlsx- Consolidated journal entries (all purchases, sales, FMV adjustments)
See references/rollforward_format.md for the industry-standard report format.
Output Files
| File | Description |
securities_purchase_<security>_<date>.csv/.xlsx | Purchase entry |
securities_sale_<security>_<date>.csv/.xlsx | Sale entry |
fmv_adjustment_<security>_<date>.csv/.xlsx | FMV adjustment |
securities_rollforward_<date>.csv/.xlsx | Unrealized G/L rollforward |
journal_<date>.csv/.xlsx | Consolidated journal entries |
securities_register.json | Securities tracking |
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.

