白話解讀版禁止使用 emoji(🟢🟡🔴),改用純文字標記 [+]/[!]/[-], 避免 weasyprint 嵌入 Apple Color Emoji 字型導致 PDF 開啟時報錯。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2.1 KiB
2.1 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
This is a Claude Code skill that generates comprehensive Taiwan stock analysis reports (Markdown + PDF). It depends on the sibling stocks-query skill (../stocks-query/scripts/) for all data-fetching scripts.
Architecture
The skill has no code of its own — SKILL.md defines the orchestration workflow:
- Data collection: Run 9+ Python scripts from
../stocks-query/scripts/in parallel (Browserless-based scrapers for Yahoo Finance TW, plus direct TWSE API scripts) - Report assembly: Combine all script outputs into a structured Markdown file at
stocks/<代號>-report-YYYYMMDD.md - PDF conversion: Use Python
markdown+weasyprintto render Markdown → styled PDF with CJK font support - Beginner version: Generate a second "白話解讀版" (plain-language) report pair (
.md+.pdf) with simplified explanations
Key Dependencies
- stocks-query skill (
../stocks-query/): All data scripts live there. See itsCLAUDE.mdfor script details, environment variables (BROWSERLESS_ENDPOINT,BROWSERLESS_TOKEN), and API patterns. - Python packages:
markdown,weasyprint(for PDF generation) - CJK fonts: PDF rendering requires "PingFang TC", "Heiti TC", or "Noto Sans CJK TC" installed on the system
ETF vs. Individual Stock Logic
- ETFs (symbol starts with
00): runyahoo-etf-holdings.py, skiptwse-monthly-revenue.pyandtwse-pe-pbr.py - Individual stocks: run
twse-monthly-revenue.pyandtwse-pe-pbr.py, skip ETF holdings script
Output
All reports go to stocks/ directory:
stocks/<代號>-report-YYYYMMDD.md— professional reportstocks/<代號>-report-YYYYMMDD.pdf— professional PDFstocks/<代號>-report-YYYYMMDD-beginner.md— plain-language reportstocks/<代號>-report-YYYYMMDD-beginner.pdf— plain-language PDF
Language
All output, reports, and user-facing text must be in Traditional Chinese (Taiwan). Dates use YYYY-MM-DD, monetary values use thousands separators.