**Role**: Step 8 — Generate the final analysis output in the requested mode (A, B, C, D). Mode A delegates to briefing-generator; Mode B uses `scripts/render-comparison.py`; Mode C delegates to dashboard-generator; Mode D uses `scripts/docx-generator.py`. **Triggered by**: CLAUDE.md after Analyst Agent (Step 7) completes **Reads**: `output/runs/{run_id}/{ticker}/analysis-result.json`, appropriate mode template **Writes**: File (Mode B, D); Mode A delegates to briefing-generator/SKILL.md; Mode...
Scanned 6/5/2026
Install via CLI
openskills install kipeum86/stock-analysis-agent# Output Generator — SKILL.md
**Role**: Step 8 — Generate the final analysis output in the requested mode (A, B, C, D). Mode A delegates to briefing-generator; Mode B uses `scripts/render-comparison.py`; Mode C delegates to dashboard-generator; Mode D uses `scripts/docx-generator.py`.
**Triggered by**: CLAUDE.md after Analyst Agent (Step 7) completes
**Reads**: `output/runs/{run_id}/{ticker}/analysis-result.json`, appropriate mode template
**Writes**: File (Mode B, D); Mode A delegates to briefing-generator/SKILL.md; Mode C delegates to dashboard-generator/SKILL.md
**References**: `mode-b-template.md`, `mode-d-template.md`, `scripts/render-comparison.py`, `scripts/docx-generator.py`
---
## Mode Routing
```
output_mode = "A" → Mode A: HTML briefing (delegate to briefing-generator/SKILL.md)
output_mode = "B" → Mode B: HTML file (this file, uses mode-b-template.md + scripts/render-comparison.py)
output_mode = "C" → Mode C: HTML dashboard (delegate to dashboard-generator/SKILL.md)
output_mode = "D" → Mode D: DOCX investment memo (this file, uses docx-generator.py)
```
---
## Mode B — Comparative Matrix (HTML File)
Load `mode-b-template.md`. Populate from each ticker's run-local `validated-data.json`.
Preferred scripted path:
```bash
python .claude/skills/output-generator/scripts/render-comparison.py \
--input output/runs/{run_id}/{ticker}/analysis-result.json \
--output output/reports/{tickers}_B_{lang}_{YYYY-MM-DD}.html
```
`render-comparison.py` resolves peer `analysis-result.json` / `validated-data.json` files from
the run-local artifact root first, then falls back to peer-specific run-local legacy promotions,
and finally to immutable snapshot refs from `output/data/{ticker}/latest.json` if needed.
**Pre-output checks**:
1. Same metric set applied to all peers?
2. Winner column logic correct (low for valuation, high for growth)?
3. R/R Score computed for all peers?
4. Best Pick labeled as opinion?
5. Key Differentiators have ≥2 specific numbers each?
Write to: `output/reports/{tickers}_B_{lang}_{YYYY-MM-DD}.html`
Report file path to user.
---
## Mode D — Investment Memo (DOCX File)
Mode D produces a Word document (.docx) with professional formatting — section headings,
financial tables, scenario matrix, risk table, EBITDA bridge, and source tags throughout.
**Step 1 — Ensure all section content is in run-local `analysis-result.json`**
The Analyst Agent must write all narrative and table data into `analysis-result.json`
`sections` object before this step runs. See `mode-d-template.md` for the required
JSON structure for each section.
**Step 2 — Run docx-generator.py**
```bash
python .claude/skills/output-generator/scripts/docx-generator.py \
--input output/runs/{run_id}/{ticker}/analysis-result.json \
--output output/reports/{ticker}_D_{lang}_{YYYY-MM-DD}.docx
```
If Python is unavailable, fall back to writing a structured plain-text memo inline
(clearly labeled as plain-text fallback) and note the limitation to the user.
**Pre-output checks**:
- All 10 sections present with ≥50 words each in `analysis-result.json`
- Q1 Variant View passes competitor replacement test
- Q2 Catalyst Map: ≥3 catalysts with timelines and quantified impacts
- Q5 Exit Conditions: ≥3 specific, testable stop-loss conditions
- Precision Risks: ≥3 with full mechanism chains
- `what_would_make_me_wrong` contains `pre_mortem` field
- All numerical claims have source tags
- No Grade D data in analysis body
- `scenarios` probabilities sum to 100%
Write to: `output/reports/{ticker}_D_{lang}_{YYYY-MM-DD}.docx`
Report file path to user. The user can open the file directly in Microsoft Word,
Google Docs, or LibreOffice.
---
## Disclaimer Text (Required in Mode B HTML outputs)
Append to all Mode B HTML output files:
```
---
**Disclaimer**: This report is generated by an AI research assistant for informational
purposes only. It does not constitute investment advice, a solicitation to buy or sell
securities, or a guarantee of investment returns. All data is sourced from public
information and may not reflect the most current market conditions. Past performance
is not indicative of future results. Always conduct your own due diligence and consult
a qualified financial advisor before making investment decisions.
*Generated: {YYYY-MM-DD HH:MM} UTC | AI Research Assistant | Data: {source list}*
```
Korean version:
```
---
**면책 조항**: 이 보고서는 정보 제공 목적으로만 AI 리서치 어시스턴트가 생성한 것입니다.
투자 조언, 증권 매수/매도 권유, 또는 투자 수익 보장이 아닙니다. 모든 데이터는 공개 정보에서
수집되었으며 최신 시장 상황을 반영하지 않을 수 있습니다. 과거 실적이 미래 결과를 보장하지
않습니다. 투자 결정 전 반드시 자체 실사를 수행하고 전문 재무 어드바이저와 상담하시기 바랍니다.
```
Note: Mode D DOCX files include the disclaimer automatically via docx-generator.py.
---
## Source Tagging Reference
Use these tags consistently throughout all output:
- `[Filing]` — SEC filing (via Financial Datasets MCP) / DART 전자공시 (via DART OpenAPI) — 규제기관 원본
- `[Company]` — issuer-published IR release / earnings call / newsroom item (authoritative issuer source, but not a regulatory filing)
- `[Portal]` — Yahoo Finance, MarketWatch, Finviz 등 US/글로벌 금융 포탈
- `[KR-Portal]` — 네이버금융, FnGuide, KIND 등 한국 금융 포탈
- `[Calc]` — 검증된 입력값으로부터 자체 계산 (P/E, EV/EBITDA 등)
- `[Est]` — 애널리스트 컨센서스, 목표가, 추정 실적
Grade D data is displayed as "—" in output (no tag needed).
---
## Completion Check
- [ ] Correct mode identified and template loaded
- [ ] All data from `analysis-result.json` mapped to template fields
- [ ] Source tags present for all numerical claims
- [ ] Grade D data displayed as "—" (not as numbers)
- [ ] Disclaimer present (Mode B and D files)
- [ ] File written to correct path (Mode B and D)
- [ ] File path reported to user
- [ ] Mode B: file written, path reported to user
- [ ] Mode D: docx-generator.py executed successfully, .docx path reported to user
No comments yet. Be the first to comment!