stock_skills_2
CLAUDE.md32 starsChanged 7 months agoMITView on GitHub
このシステムは「自然言語ファースト」の Agentic AI Pattern で設計されている。 ユーザーはコマンドやパラメータを覚える必要はない。日本語で意図を伝えるだけで、オーケストレーターが適切なエージェントを自律的に選択・起動する。 エージェントはツール(tools/)を使ってデータを取得し、自分で判断・整形して出力する。 投資アシスタントシステム。Yahoo Finance API(yfinance)、Grok API(xAI)、Neo4j(GraphRAG)を統合し、自然言語で銘柄探索・分析・ポートフォリオ管理・リスク評価を行う。Claude Code の Agentic AI Pattern で動作する。 エージェントが自律的にツールを呼び出すため、ユーザーがスクリプトを直接実行する必要はない。 すべてのエージェント出力は4レイヤ構成で生成される。詳細は .claude/skills/stock-skills/SKILL.md の「Output & Visibility v1」セクション参照。 Reviewer は3分類で起動: 🔒 自動(売買確定/conviction違反/週次routine) / 🔍 アドホック([y/skip]プロンプト) / ⏭ スキップ。 詳細は docs/architecture.md、docs/neo4j-schema.md を参照。
- Installs packages
In this repository2 other files it gives its agents.
- deepthinkSkill
- stock-skillsSkill
The file
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Design Philosophy
このシステムは「自然言語ファースト」の Agentic AI Pattern で設計されている。
ユーザーはコマンドやパラメータを覚える必要はない。日本語で意図を伝えるだけで、オーケストレーターが適切なエージェントを自律的に選択・起動する。
- 「いい日本株ある?」→ Screener が自律的に region/preset を決めてスクリーニング
- 「トヨタってどう?」→ Analyst がバリュエーション・テクニカル分析を実行
- 「PF大丈夫かな」→ Health Checker が事実・数値を出し、Strategist がレコメンド
- 「最新ニュース教えて」→ Researcher が Grok API でニュース・センチメントを取得
エージェントはツール(tools/)を使ってデータを取得し、自分で判断・整形して出力する。
Project Overview
投資アシスタントシステム。Yahoo Finance API(yfinance)、Grok API(xAI)、Neo4j(GraphRAG)を統合し、自然言語で銘柄探索・分析・ポートフォリオ管理・リスク評価を行う。Claude Code の Agentic AI Pattern で動作する。
Commands
# ユニットテスト(API key/ネットワーク不要、約1381テスト)
python3 -m pytest tests/ -q
# Dry-run(routing.yaml + agent定義の整合性検証、< 1秒)KIK-746
python3 tests/e2e/run_e2e.py --dry-run
# モック E2E(pytest fixture で tools 層 stub 化、< 1秒)KIK-747
python3 -m pytest tests/e2e/test_mocked.py -q
# 実 API E2E テスト(実際の API でエージェント動作検証、要 API key)
python3 tests/e2e/run_e2e.py
# 開発用 worktree セットアップ(KIK-745、個人PFを流さない)
bash scripts/setup_worktree.sh KIK-NNN [short-desc]
# 依存インストール
pip install -r requirements.txtエージェントが自律的にツールを呼び出すため、ユーザーがスクリプトを直接実行する必要はない。
Output & Visibility v1(KIK-729)
すべてのエージェント出力は4レイヤ構成で生成される。詳細は .claude/skills/stock-skills/SKILL.md の「Output & Visibility v1」セクション参照。
- Layer 1: ヘッダ(実行前・常時ON)
🎯 [<agent or chain>] <task> - Layer 2: 進捗(連鎖時のみ)
✅ <agent> 完了 (X.Xs) — <サマリ> - Layer 3: 本体(Pattern A/B/Cで切替)
- A: ミニマル(1-3行で済む事実照会)
- B: 標準(単一エージェント・4セクション固定)
- C: チェーン(連鎖 ≥2 / routine)
- Layer 4: フッタ(順序固定)
📊 実行 → 💾 保存 → 🔍 Reviewer? → ➡ 次
Reviewer は3分類で起動: 🔒 自動(売買確定/conviction違反/週次routine) / 🔍 アドホック([y/skip]プロンプト) / ⏭ スキップ。
Architecture
詳細は docs/architecture.md、docs/neo4j-schema.md を参照。
Orchestrator (.claude/skills/stock-skills/)
SKILL.md — ルーティング・自律制御
routing.yaml — エージェント選択 few-shot
orchestration.yaml — リトライ・エスカレーション
Agents (.claude/agents/)
screener/ — 銘柄探し・スクリーニング
analyst/ — 銘柄分析・バリュエーション評価
researcher/ — ニュース・センチメント・業界動向
health-checker/ — PFの事実・数値(判断しない)
strategist/ — 投資判断・レコメンド
risk-assessor/ — 市場リスク判定(risk-on/neutral/risk-off)
reviewer/ — 品質・矛盾・リスクチェック(マルチLLM)
Tools (tools/)
yahoo_finance.py — 株価・ファンダメンタルズ(src/data/yahoo_client/ のファサード)
graphrag.py — Neo4j ナレッジグラフ(src/data/graph_store/ + graph_query/ のファサード)
grok.py — Grok API 検索(src/data/grok_client/ のファサード)
llm.py — マルチLLM呼び出し(Gemini/GPT/Grok)
portfolio_io.py — PF CSV 読み書き(src/data/portfolio_io のファサード)
notes.py — 投資メモ読み書き(src/data/note_manager のファサード)
watchlist.py — ウォッチリスト読み書き(JSON直接I/O)
scoring.py — 3軸品質スコアリング(src/data/scoring.py のファサード)
Data (src/data/)
yahoo_client/ — yfinance ラッパー(24h JSONキャッシュ)
grok_client/ — Grok API (xAI) ラッパー
graph_store/ — Neo4j 書き込み(dual-write)
graph_query/ — Neo4j 読み取り
context/ — 自動コンテキスト注入
history/ — 実行履歴ストア
note_manager — 投資メモ管理
common.py — 共通ユーティリティ(is_etf, safe_float 等)
ticker_utils.py — ティッカー推論(通貨/地域マッピング)
portfolio_io.py — PF CSV 読み書き
scoring.py — 3軸品質スコアリング(還元性・成長性・持続性)
Orchestrator (src/orchestrator/) — KIK-746
dry_run.py — routing.yaml + agent定義の整合性検証(API呼ばない)
verify_routing(user_input), verify_routing_yaml_integrity()
Scripts (scripts/) — KIK-745
setup_worktree.sh — worktree作成 + sample fixture コピー一括化(個人PFを流さない)
Config: .claude/agents/screener/examples.yaml (regions, themes, presets, few-shot)
Config: config/scoring.yaml (スコアリング重み・閾値・セクター別設定)
Config: config/allocation.yaml (PFターゲットアロケーション・集中度制約・乖離判定)
Config: config/etf_universe.yaml (ETF定番リスト — セクター/債券/コモディティ/地域)
Config: config/llm_routing.yaml (LLM選択・モデルルーティング・コスト定義)
Rules: .claude/rules/ (development, workflow, testing)
Docs: docs/ (architecture, neo4j-schema, data-models)
Tests: tests/ (unit ~1381件), tests/e2e/ (E2E)
- run_e2e.py: 実 API シナリオ実行
- run_e2e.py --dry-run: routing検証のみ(< 1秒)KIK-746
- test_mocked.py: モック E2E(pytest fixture で tools stub)KIK-747
Fixtures: tests/fixtures/sample_portfolio.csv / sample_cash_balance.json
(KIK-745、汎用テスト銘柄、worktree結合試験で個人PF代替)Post-Implementation Rule
機能実装後は必ず以下を確認・更新すること。
- エージェント定義: 該当
agent.md+examples.yaml - ルーティング:
routing.yamlの triggers/examples - ドキュメント:
CLAUDE.md、README.md、docs/architecture.md - テスト:
python3 -m pytest tests/ -qで全件 PASS を確認
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.

