Stock Research Publish
Take the analysis outputs produced by stock-research-pipeline and turn them into a deliverable
the user can read or share. Two output modes — PDF (print-style) or HTML (web-style with optional
Netlify deploy). The user picks.
Prerequisites
- An NLM analysis already exists for the SYMBOL — i.e. the 6 query answers from
stock-research-pipelineare available in this session OR can be re-derived fromdata/companies/{SYMBOL}/. If neither is true, run/stock-research-pipeline {SYMBOL}first. - For PDF: Python venv at
.venv/withreportlabinstalled. - For HTML deploy:
netlifyCLI on PATH OR a Netlify access token in$NETLIFY_AUTH_TOKEN. If the CLI is missing, the skill installs it (with user confirmation) — see Step 4 pre-flight. Requiresnpmon PATH (Node ≥ 18).
Step 1: Ask the user what they want
Use AskUserQuestion with one question, three options:
- PDF only — print-style A4 report (existing reportlab generator).
- HTML only — single-file, magazine-quality web page with optional Netlify deploy.
- Both — produce PDF first, then HTML, then ask about deploy.
Also ask whether to deploy the HTML to Netlify if HTML is selected (yes / no). Do not branch
on whether netlify is installed at this stage — the Step 4 pre-flight handles install + auth +
site name + deploy scope interactively.
Do not proceed until you have explicit answers. No defaults.
Step 2: Locate the analysis inputs
Resolve the SYMBOL from the user's request and gather the 6 NLM answers. Sources, in order:
- The current conversation (if
/stock-research-pipelinejust ran in this session). data/companies/{SYMBOL}/analysis/— look for any of:business_model.md,industry.md,management.md,financials.md,growth_triggers.md,risks_scenarios.md, or a singlenlm_answers.jsonif the pipeline saved one.- As a last resort, re-run only the missing NLM queries from the pipeline (do NOT re-download
PDFs or recreate the notebook). Use the existing notebook ID from
data/companies/{SYMBOL}/analysis/notebook.txtif present.
If you can't gather all 6 answers, stop and ask the user to run /stock-research-pipeline first.
Also load data/companies/{SYMBOL}/screener_data.md for headline metrics (PE, ROE, ROCE, market
cap, latest revenue/PAT) — these populate the KPI cards.
Step 3a: PDF path
Use the existing reportlab generator at scripts/generators/equity_report_pdf.py (or, if absent,
the working reference at data/companies/GRAVITA/analysis/generate_report.py). Render to:
data/companies/{SYMBOL}/analysis/{SYMBOL}_Equity_Analysis_{YYYY-MM-DD}.pdf
Then open the file and tell the user the path. Done if PDF-only was chosen.
Step 3b: HTML path — design rules
Generate a single self-contained .html file (no external assets except Google Fonts and one
optional Mermaid CDN). Apply the visual-explainer playbook — these are not suggestions.
Aesthetic — pick ONE per generation. Vary across runs.
- Editorial (default for equity reports): Instrument Serif or Crimson Pro headlines, IBM Plex Sans body, JetBrains Mono for monospace. Generous whitespace, deep navy + muted gold, serif drop-caps on the executive summary.
- Blueprint: subtle grid background, deep slate/blue, monospace labels, precise borders. Good for technical/cyclical companies.
- Paper/ink: warm cream
#faf7f5background, terracotta + sage accents. Good for consumer / FMCG names where warmth fits.
Forbidden — do not produce these.
- Inter / Roboto / system-ui as
--font-body. Pick a real pairing. - Indigo/violet accents (
#8b5cf6,#7c3aed,#a78bfa), cyan-magenta-pink neon, gradient text on headings. - Emoji icons in section headers. Use styled monospace labels with colored dot indicators or numbered badges.
- "Neon dashboard" or gradient-mesh backgrounds. Use subtle radial glows or faint grid only.
- Animated glowing box-shadows or pulsing effects on static content.
- Three-dot window chrome on code/quote blocks.
Required structure (mirror the PDF section list, but use web idioms):
- Hero — Company name (serif, 48–64px), SYMBOL in monospace, sector tag, report date. One-line investment thesis as a lead paragraph (larger, dimmer body color).
- KPI strip — 4–6 cards: CMP, MCap, P/E, ROE, ROCE, latest QoQ growth. Hero number large; label small and dim. Vary one card as the "primary" with accent-tinted background.
- Executive summary — 2–3 short paragraphs synthesizing the thesis. Optional pull quote for the single most important management line.
- Business model & value chain (Query 1) — CSS Grid cards, not prose dump. Extract the
revenue streams, unit economics, key cost drivers. If there's a flow (input → processing →
output → customer), use a small Mermaid
graph LR(≤6 nodes) with the fulldiagram-shellzoom container — never bare<pre class="mermaid">. - Industry & competitive positioning (Query 2) — 2-column layout: structure cards on left,
peer comparison
<table>on right (sticky header, alternating rows, right-aligned numbers withtabular-nums). - Financial deep dive (Query 4) — A real
<table>for the quarterly P&L. Add a Chart.js line chart for revenue + margin trajectory if 4+ quarters available. Margin trend gets its own KPI callout. - Management quality & execution (Query 3) — Guidance-vs-delivery as a striped table. Italic gray management quotes inset with a subtle left-accent bar (no quote-mark emoji).
- Growth triggers (Query 5) — Card grid, each card = one trigger with: name, evidence, sizing, kill-switch. Color the left border by conviction (high / medium / watch).
- Variant perception scorecard (Query 5) — This is a flagship section, not a quick table.
It must include:
(a) A 1–2 sentence methodology note explaining what "consensus" means here (sell-side target,
peer trading multiple, common buy-side view) and what the edge is being measured against.
(b) A wide
<table>with at least these columns: factor | consensus view (with a sourceable anchor — sell-side target, peer multiple, prior management commentary) | variant view (the differentiated take) | quantitative evidence (specific numbers, dates, data points that support variant) | edge size (in EPS / multiple / target terms — i.e. how much this factor moves the price if right) | time horizon (when this should resolve) | falsification (what would prove the variant wrong). (c) A minimum of 5 factors, not 3. Cover at least: valuation multiple, the most-feared risk (commodity / cyclical / regulatory), execution / capex, demand durability, and one sector-specific factor. (d) Below the table, a short "consensus build vs variant build" comparison — two side-by-side mini-tables showing the EPS/revenue/multiple stack each view implies for the next 2 years. - Bull / Base / Bear scenarios (Query 6) — Two complementary views, both required:
(a) Three side-by-side scenario cards with FY+1/+2/+3 headline numbers, probability
weight, return %, and one-line trigger. Bear uses rose/cranberry, base neutral, bull
sage/emerald — border color only, never red/green emoji or arrows.
(b) A detailed scenario
<table>below the cards, with scenarios as columns and rows covering at minimum: Revenue FY+1/+2/+3, Revenue CAGR, EBITDA FY+3, EBITDA margin %, PAT FY+3, EPS FY+3, EPS CAGR, exit P/E multiple, target price, implied return %, and probability. Numbers are right-aligned withtabular-nums. Header row tinted to match the scenario card colors so the table is visually anchored to the cards above. (c) A scenario assumptions sub-table listing the 4–6 key driver assumptions per scenario (e.g. for a recycler: spread per kg, capacity utilization %, organized share %, non-core revenue mix, tax rate). This makes the s