stock-analysis · A-share Individual Stock In-depth Research System
Agent Reading Sequence
- This SKILL.md — Phase Overview (you are reading this now)
- During Phase 1.5 →
output/.../data_inventory.md
+ (automatically generated)
- Before writing each section in Phase 2 → Corresponding Step in references/tag-spec.md + references/analysis-framework.md
- Scoring in Phase 2 → references/rubric-spec.md
- Anomalies in Phase 2 → references/anomaly-rules.md
- During Phase 3 → references/html-spec.md + references/batch-checklist.md
- When writing/reading data.json → references/data-schema.md
- End of Phase 3 → Run scripts/verify_html.sh (includes verify_content.py)
Trigger Examples
| User's Input | Triggered |
|---|
| ✓ |
| ✓ |
| ✓ |
| How are BYD's fundamentals? | ✓ |
| ✓ |
Phase Timeline (v3.1)
text
Phase 1 Data Collection
└─ Automatic chaining at the end of fetch_data.py:
build_inventory.py → data_inventory.md
scan_anomalies.py → anomalies.{json,md}
Phase 1.5 Data Checkpoint
└─ Agent must read data_inventory.md + anomalies.md
└─ ❌ Missing fields must be supplemented via web_fetch or explicitly marked [GAP]
└─ CRITICAL anomalies must be fully discussed in Step 0.5
Phase 2 In-depth Analysis (Three-section Check System + Tags)
§1 (Step 0, 0.5, 1, 2) → part1 → verify_facts.py --partial part1
§2 (Step 3, 4, 5) → part2 → verify_facts.py --partial part2
§3 (Step 6, 7, 8) → part3 → verify_facts.py --partial part3
Merge: cat part*.md > report.md
Phase 2.5 Fact-checker
└─ verify_facts.py FULL → Must have 0 FAIL
└─ Task(general-purpose subagent) → fact-check-report.md
└─ FAIL items must be edited and re-run (max 3 rounds)
Phase 2.6 Bear-case
└─ Task(general-purpose subagent) → bear-case.md
└─ Append to report.md as a new section
Phase 3 HTML Writing in 6 Batches
└─ verify_html.sh (includes verify_content.py) → 0 FAIL
└─ Delete intermediate products _h_part*.html
Phase 2.5 fact-checker sub-agent prompt (for agent copy-paste)
text
You are a reviewer. Check the numerical accuracy and inference rationality of report.md.
【Input】report.md / data.json / anomalies.md (path in current output directory)
【Tasks】
1. Sample 20 [F:] tags, verify the accuracy, unit and context of each value one by one
2. Check if the basis for all [I:] inferences is reasonable (broad reasons like "industry common sense · leading position" are not acceptable)
3. Check if the multiplication table for all [T:] target prices is self-consistent
4. Identify anomalies in anomalies.md that are not fully discussed in the report
5. Find internal contradictions in the report
【Output】fact-check-report.md
- PASS: N / FAIL: M / WARN: K
- Each FAIL item must include: location + problem description + repair instruction
Phase 2.6 bear-case sub-agent prompt
text
You are a bearish analyst. Based on report.md and anomalies.md, write a 300-500 word opposing view.
【Tasks】
1. Find 3 pieces of negative evidence that the main agent did not fully discuss
2. Provide specific paths for "if the bullish view is wrong, where is it wrong"
3. Refute key [I:] inferences in the report
4. Propose 3 observable indicators: "if signal X appears, the bearish view is confirmed"
【Output】bear-case.md (no tags required)
- Must cite at least 2 IDs from anomalies.md
Phase 1 · Data Collection (3-5 min)
Required Data: Daily K-lines of the past 3 years, financial data of the past 3 years (revenue/net profit/gross profit/ROE), main business composition, top 10 shareholders, recent news.
Implementation Methods (Optional):
| Method | Command |
|---|
| akshare reference script | python scripts/fetch_data.py <code> [--date YYYY-MM-DD]
|
| Financial MCP | Direct call by agent |
| web_fetch | Agent crawls public pages from Xueqiu/Eastmoney on its own |
| Manual upload | User provides CSV/JSON |
Output: output/<Stock Name>_<Code>/<YYYY-MM-DD>/data.json
, schema see
references/data-schema.md.
Phase 2 · AI In-depth Analysis (30-45 min · Three-section Check System)
| Section | Included Steps | Output |
|---|
| §1 | Step 0-2 (Task/Macro/Industrial Chain) | |
| §2 | Step 3-5 (Company Quality/Elasticity/Risk) | |
| §3 | Step 6-8 (Valuation/Benchmarking/Tracking Conclusion) | |
| Merge | — | |
Rhythm:
- By default, the three sections are executed continuously in the same session, no need to ask "Continue?"
- After completing each section, output
✅ §X Completed (XX lines / Step A-B)
- Resume across sessions: Determine the starting point by reading existing part files under
output/<Stock Name>_<Code>/latest/
Minimum Line Count (Mandatory): Step 0:10 / 1:50 / 2:100 / 3:50 / 4:80 / 5:40 / 6:100 / 7:60 / 8:50 (total 540 lines).
Methodology Details: references/analysis-framework.md
Phase 3 · HTML Generation (30-40 min · Written in 6 Batches)
Tool Division:
- Write for markup / Edit for local modifications / Bash cat for byte splicing
- Prohibited: Python f-string, Bash heredoc, for string splicing
6-batch Plan (Each batch ≤300 lines, run grep verification after writing):
| Batch | Content | Main Grep Verification |
|---|
| 0 | DOCTYPE + head + style (fully copy templates/template_base.css
) | , accent token exists |
| 1 | body + nav + compliance + hero + conclusion-top + profile | 13 anchors in nav, 4 hero-meta, compliance-banner exists |
| 2 | financial-grid + K-line + Step 0-3 | Four ids mission/macro/chain/quality exist |
| 3 | Step 4-6 (Elasticity/Risk/Valuation) | Three ids elasticity/risk/valuation exist |
| 4 | Step 7-8 + Summary Box + footer | // CONCLUSION exists, in footer = 0 |
| 5 | script (fully copy templates/template_base.js
, inject rawData/pieData) | / = 0 |
| Merge | cat _h_part*.html > report.html
then bash scripts/verify_html.sh report.html
| All PASS |
Detailed Batch Guide (Including ANCHOR usage, grep commands for each batch, failure handling):
references/batch-checklist.md
HTML Design Specifications (Color Palette/Fonts/Components):
references/html-spec.md
Golden Sample:
examples/比亚迪_002594.html
Output Structure
output/
└── <Stock Name>_<Code>/
├── <YYYY-MM-DD>/
│ ├── data.json # Phase 1
│ ├── report.md.part1-3 # Intermediate products of Phase 2
│ ├── report.md # Merged final version of Phase 2
│ ├── _h_part0-5.html # Intermediate products of Phase 3
│ └── report.html # Final deliverable
└── latest -> <YYYY-MM-DD> # Symbolic link
Key Prohibited Items
| # | Prohibited | Reason |
|---|
| 1 | Generate HTML markup with Python | Escape chaos, difficult to maintain |
| 2 | Write multi-line HTML with Bash heredoc | EOF matching failure is easy to occur |
| 3 | Skip/simplify any Step | The complete framework is indispensable |
| 4 | Use [open, high, low, close] for OHLC | Does not match ECharts default |
| 5 | Use double backslash for MathJax | Delimiter matching failure |
| 6 | Mix gold color for accent / multi-color score-fill gradient | Violates Linear Terminal+ design |
| 7 | Use / gold color in footer | Violates pure Mono footer specification |
| 8 | Output to old path in Phase 1 | Should use <Stock Name>_<Code>/<Date>/
|
| 9 | Write complete HTML at once | Must split into 6 batches, each batch ≤300 lines |
| 11 | Numbers in the report without [F]/[C]/[I]/[T]/[GAP] tags | verify_facts FAIL, cannot enter Phase 3 |
| 12 | Skip fact-checker or bear-case sub-agent | Multi-agent defense depth fails |
| 13 | Display A/B/C letter ratings in hero meta | v3.1 uses instead |
| 14 | Reappear 5-dimensional comprehensive score in Step 8 | Cancelled, only qualitative conclusions are retained |