{"id":9597,"plugin_id":"plugin_asdk_app_6a215179debc8191a28dd0f3723c0646","kind":"skill","collection_source":null,"comparison_source":null,"observed_at":"2026-09-30T22:55:15.067Z","digest":"8763b4959c2f4f5b08c5f326c25523bb91563ad700905bb2059dd6ced3af44c5","against":null,"payload":{"name":"peer-analysis","description":"Produce a Peer Analysis HTML report for a target company and its credit peers using Moody's GenAI MCP tools. Use this skill whenever the user asks to compare a company against its peers, run a peer analysis, do a credit peer comparison, generate a peer group report, or analyze relative credit positioning. Trigger even if they just name a company and mention \"peers\", \"peer comparison\", \"credit comparison\", \"peer group\", or \"relative value\".","included_files":[{"relative_path":"__MACOSX/._SKILL.md","size_in_bytes":163},{"relative_path":"__MACOSX/._assets","size_in_bytes":163},{"relative_path":"__MACOSX/._evals","size_in_bytes":163},{"relative_path":"__MACOSX/._references","size_in_bytes":163},{"relative_path":"__MACOSX/assets/._template.html","size_in_bytes":163},{"relative_path":"__MACOSX/evals/._evals.json","size_in_bytes":163},{"relative_path":"__MACOSX/references/._report-spec.md","size_in_bytes":163},{"relative_path":"__MACOSX/references/._shared-citations.md","size_in_bytes":163},{"relative_path":"__MACOSX/references/._shared-template.md","size_in_bytes":163},{"relative_path":"assets/template.html","size_in_bytes":23871},{"relative_path":"evals/evals.json","size_in_bytes":4149},{"relative_path":"references/report-spec.md","size_in_bytes":32726},{"relative_path":"references/shared-citations.md","size_in_bytes":5814},{"relative_path":"references/shared-template.md","size_in_bytes":8111}],"skill_md_contents":"---\nname: peer-analysis\ndescription: >\n  Produce a Peer Analysis HTML report for a target company and its credit peers using Moody's\n  GenAI MCP tools. Use this skill whenever the user asks to compare a company against its peers,\n  run a peer analysis, do a credit peer comparison, generate a peer group report, or analyze\n  relative credit positioning. Trigger even if they just name a company and mention \"peers\",\n  \"peer comparison\", \"credit comparison\", \"peer group\", or \"relative value\".\n---\n\n# Peer Analysis Skill\n\nGenerates a professional HTML report (styled like a Moody's peer analysis PDF) for a target\ncompany and up to 3 credit peers. Data is pulled from multiple `Moodys MCP server` MCP tools and\nconsolidated into a single HTML artifact covering peers comparison, ratings chart, and ESG.\n\nThe workflow is **single-artifact delivery**: gather all data, then write the entire filled\nHTML document to a single `.html` file in `/mnt/user-data/outputs/` and actively render it to\nthe user with **both** `present_files` and `visualize:show_widget`. The rendered HTML artifact\nis the deliverable — writing the file without rendering it is a failed run.\n\n> ## ⚠️ CRITICAL — NON-NEGOTIABLE OUTPUT CONTRACT\n>\n> **The LLM MUST deliver the final report as a single standalone HTML artifact file that it\n> then actively renders on screen.** Creating the file is only half the job — a file that is\n> written but never surfaced is a failed run, and is the single most common failure mode for\n> this skill. Specifically:\n>\n> - The LLM **MUST** write the **complete, standalone HTML document** (`<!doctype html>` →\n>   `</html>`), with every section from the streaming protocol populated inline, to a single\n>   `.html` file in `/mnt/user-data/outputs/` using the `create_file` tool.\n> - The LLM **MUST** then render that file with **both** display tools — `present_files`\n>   **and** `visualize:show_widget` — before ending its turn. Firing both renderers is what\n>   guarantees the report always appears even if one tool is unavailable.\n> - The LLM **MUST NOT** end its turn after `create_file` without having called the display tools.\n> - The LLM **MUST NOT** emit the report inline as a fenced ` ```html ` code block, as prose,\n>   Markdown, JSON, attachments, or links. The rendered HTML artifact itself is the answer.\n> - The LLM **MUST NOT** split the report across multiple files, multiple messages, partial\n>   snippets, or summaries.\n> - If data gathering fails partially, still produce the single HTML artifact file with the\n>   best-available content and `\"--\"` placeholders for missing cells — never skip the artifact\n>   or the render step.\n>\n> Treat any other output shape as a hard failure of the skill.\n\n## Required MCP server\n\n`Moodys MCP server` — tools used: `findEntity`, `getEntityPeers`, `getEntityRatings`,\n`getCreditOpinion`, `getEntityFinancials_v2` (sections: Profile, Summary, RatingOutlook, FactorsLeadingToUpgrade,\nFactorsLeadingToDowngrade, CreditStrengths, CreditChallenges, ESGConsiderations,\nKeyIndicatorsTable, ScorecardTable, ESGConsiderations), `getEntitySectorOutlook`\n\nIf any of the tools required for a section do not exist, inform the user: One or more tools required for this section are not available under your current subscription. Unlock more of the expert insights, data, and analytics you trust. Get Link:https://www.moodys.com/web/en/us/capabilities/gen-ai/ai-ready-data.html with us to learn more. \n\n## Bundled files\n\n- `assets/template.html` — self-contained static report shell (CSS + named section placeholders,\n  including pre-shaped tables for a fixed target+3-peer layout). No embedded data, no inline\n  script. Treat this file as the **read-only structural reference**: read it, fill it in\n  mentally, and emit the complete filled document in the final response.\n\n## Shared chrome & citations\n\nBefore emitting, read [`references/shared-template.md`](references/shared-template.md) (page\nchrome: cover, TOC, section block, sources-section wrapper, footer, outlook-badge, design\ntokens) and [`references/shared-citations.md`](references/shared-citations.md) (citation\nnumbering, hyperlinking, source data shape, markup snippets). Both are **authoritative** — do\nnot invent, duplicate, or restyle anything they already define. The canonical CSS is already\ninlined in `assets/template.html` between the `/* BEGIN/END shared-template-css */` and\n`/* BEGIN/END shared-citations-css */` markers; never re-copy it at emit time.\n\nThe rest of this section is the skill-specific binding.\n\nThis skill uses the **`cover-multi`** variant. Skill-specific override retained above the\nmarker region: `**.page { max-width: 1050px }**` (PA reports are wider than the 900px canonical\ndefault to fit the multi-column scorecard / key-indicators tables). Skill-specific CSS that\nstays local: `.sub-heading`, all PA-specific table classes (`.pa-table`, `.credit-drivers-table`,\n`.ki-table`, `.sc-table`), and the chart helpers (`.chart-container`, `.chart-title`,\n`.chart-legend`, `.chart-legend-item`, `.chart-legend-swatch`). All outlook-badge usage in this\nskill must use the canonical pastel variants (`stable` / `positive` / `negative` / `review` /\n`na`) defined by the shared skill — no solid-fill or inline-color overrides. PA flags the target\nentity on the cover with `class=\"company-chip target\"`; the chip wrappers themselves come from\nthe shared cover-multi snippet.\n\nThe prefix used for the end-of-document container in this skill is `pa`, so the container id\nis `#pa-sources`. Optional per-section recap blocks live in `#pa-cite-peers`,\n`#pa-cite-ratings`, and `#pa-cite-esg`. Internal MCP tool names (e.g. `getCreditOpinion`)\nare NEVER rendered inside `.source-meta`.\n\n---\n\n## Step 1 — Resolve the target company\n\nCall `findEntity` with the company name provided by the user. Store the canonical entity name\nand entity ID.\n\nIf the user provides only one company name, that is the **target company**. The peers will be\ndiscovered automatically in Step 2.\n\n---\n\n## Step 2 — Discover and resolve peers\n\nCall `getEntityPeers` for the target company. Select the top 3 peers returned.\n\nYou now have a set of up to **4 companies** (1 target + up to 3 peers). For each peer, call\n`findEntity` to resolve its canonical entity name and ID.\n\n---\n\n## Step 3 — Read the template\n\nRead `assets/template.html` (relative to this skill directory) once. Keep its exact structure —\nCSS, `<head>`, section order, table skeletons (including all pre-shaped 4-company columns/rows),\nrow labels, and element IDs — as the scaffold for the final artifact. Do **not** copy it to the\nworkspace and do **not** open it.\n\n---\n\n## Step 4 — Gather all data in parallel\n\nFor every company in the set (target + up to 3 peers), fire **all of the following in a single\nparallel batch** (one message, many tool calls):\n\n### Credit Opinion data (per company)\n\nCall `getCreditOpinion`,`getEntityFinancials_v2` requesting these sections, about the key Indicators table this should be populated with most recent fiscal year available (e.g. 2025 FY) on `getEntityFinancials_v2`. Not LTM allowed:\n\n| Section parameter | Purpose |\n|---|---|\n| `Profile` | Company description for the Peers Table |\n| `FactorsLeadingToUpgrade` | Upgrade factors for Credit Drivers |\n| `FactorsLeadingToDowngrade` | Downgrade factors for Credit Drivers |\n| `CreditStrengths` | Credit strengths for Credit Drivers |\n| `CreditChallenges` | Credit challenges for Credit Drivers |\n| `KeyIndicatorsTable` | Financial metrics for Key Indicators table |\n| `ScorecardTable` | Scorecard data |\n| `ESGConsiderations` | ESG narrative containing the CIS classification and E/S/G scores for the ESG Table & Heatmap |\n\n### Ratings (per company)\n\nCall `getEntityRatings` — retrieve the current long-term rating, rating class, rating date,\noutlook, and historical ratings (need at least the last 5 rating actions for the Ratings Chart).\n\n### ESG (per company)\n\nSource ESG from the `ESGConsiderations` section of `getCreditOpinion` (requested in the Credit\nOpinion call above). This section is narrative text, but Moody's states the overall CIS\nclassification and the E, S, and G issuer-profile scores within it (e.g. \"CIS-3\", \"E-4\", \"S-3\",\n\"G-2\"). Extract those codes verbatim for the ESG Table & Heatmap. If a given score is not stated\nin the narrative, follow the `na` / `--` conventions in the report spec rather than inventing one.\n\n### Sector outlook (once per sector)\n\nCall `getEntitySectorOutlook` for the target company's sector. Reuse for peers in the same\nsector.\n\nHold all results in context for Step 5 synthesis.\n\n---\n\n## Step 5 — Synthesize + emit the complete artifact\n\nAfter data is gathered, write the **entire filled `template.html` document** — with every\nelement from the streaming protocol populated in place — to a single `.html` file in\n`/mnt/user-data/outputs/`, then render it. The full required delivery sequence (`create_file`\n→ `present_files` → `visualize:show_widget` → one short sentence) is specified in the\n**Step 6 — Output and presentation** section below; follow it exactly.\n\nThe HTML file **must**:\n\n- Be written in a single `create_file` call (no progressive `StrReplace` edits, no multi-file\n  split).\n- Contain a complete, standalone HTML document (doctype → `</html>`) that renders without\n  external dependencies.\n- Preserve the template's `<head>` (CSS, fonts), section order, table skeletons, row labels, and\n  element IDs exactly. Only the empty targets defined below are populated.\n\nWrite in professional financial/credit analysis language. Always reference specific companies by\nname. The target company is **always the first column / first row** in every table. Render order\nof content inside the file follows the page top-to-bottom so the artifact is human-readable\nas well as browser-renderable: cover/header fields first, then Peers Comparison sub-sections\n(1–6), Ratings Chart, ESG, and citations/sources last.\n\nAttribute substantive claims with numbered citation references. The exact inline markup, the\nURL-less fallback, and the rule that `n` matches the row position of the source inside\n`#pa-sources` are defined in [references/shared-citations.md](references/shared-citations.md).\n\n### Cover / header fields (write first)\n\n- `#pa-report-date` — e.g. `April 20, 2026` (plain text)\n- `#pa-footer-date` — same value (plain text)\n- `#pa-target-company` — canonical name of the target (plain text)\n- `#pa-peer-count` — integer count of peers resolved in Step 2 (plain text)\n- `#pa-company-chips` — `<span class=\"company-chip target\">Target</span>` followed by one\n  `<span class=\"company-chip\">Peer</span>` per peer (space-separated; target first)\n- `#pa-cover-img-right`, `#pa-cover-img-bottom` — optional. If you have image URLs or data URIs\n  to use, set the `src` attributes **and** add the `has-cover-image` class to the corresponding\n  container (`<div class=\"cover-top has-cover-image\">` and/or `<div class=\"cover-bottom has-cover-image\">`).\n  If you do not have images, leave the template as-is — the empty image strips will collapse\n  automatically and the cover will render as a clean navy block with the accent bar.\n\n### Report body — sections, streaming protocol & charts\n\nBefore emitting, read [`references/report-spec.md`](references/report-spec.md) for the\nauthoritative body-authoring spec: the Section 1 sub-sections (Peers Table, Peers Rating,\nCredit Drivers, Key Indicators, Scorecards, Conclusion), Section 2 (Ratings Chart + analysis),\nSection 3 (ESG Table + analysis), where the optional `#pa-cite-*` recaps and the\n`#pa-sources` rows go, the **streaming protocol** (element → content mapping), the reference\nHTML snippets, the Ratings-Chart SVG template (constants, rating→value map, coordinate\nformulae), and the class-selection rules and conventions. **The spec also carries three\nAmendments that override this base layout — apply them.** Populate every `#pa-*` target\nexactly as specified there.\n\n---\n\n## Step 6 — Output and presentation (required final steps)\n\n> ## ⚠️ CRITICAL — THE SKILL IS NOT COMPLETE UNTIL THE REPORT IS VISIBLY RENDERED\n>\n> Writing the file is **not** delivery. After you write the HTML you **must** actively render\n> it with every display tool available, in order, before you say anything else. Do not end\n> your turn until the rendered report is on screen.\n\nFollow this exact sequence. Do not skip a step, reorder, or substitute alternatives:\n\n1. **Write the HTML file in a single call.** Call `create_file` to write the entire standalone\n   HTML document (`<!doctype html>` → `</html>`) to\n   `/mnt/user-data/outputs/{target_company_slug}_peer_analysis.html` in **one** call.\n   `{target_company_slug}` is the target's canonical name lowercased with spaces and special\n   characters replaced by underscores (e.g. `apple_inc_peer_analysis.html`). No progressive\n   edits, no multi-file split.\n2. **Present the file.** Immediately call `present_files` on that exact path to surface the\n   artifact to the user.\n3. **Show the widget.** Immediately call `visualize:show_widget` on the same file to render the\n   report visually. Call this even if `present_files` already succeeded — firing both renderers\n   is what guarantees the report always appears.\n4. **Confirm in one short sentence.** Only after the renderers return, add a single brief\n   sentence in chat (e.g. `Peer Analysis for {Target Company} — the report is available above as\n   a self-contained HTML artifact.`). Nothing more.\n\nIf a display tool call fails or is unavailable, immediately try the other one rather than\nstopping. Never end your turn at step 1, and never paste the HTML into chat or suggest shell\ncommands.\n\n---\n\n## Tips\n\n- Run ALL data-gathering tool calls in a single parallel batch (one message, many tool calls).\n- Deliver the report as **one** `.html` file in `/mnt/user-data/outputs/`, then render it with\n  **both** `present_files` and `visualize:show_widget` (see Step 6). Never paste it as a fenced\n  ` ```html ` code block, never split across files or messages, and never stop at file creation.\n- The target company always appears as the first column / first row in every table and\n  comparison.\n- The conclusion must orient around the target company — how it differentiates from its peers.\n- If fewer than 3 peers are returned, leave the unused column/row IDs empty. The pre-shaped\n  tables keep those cells blank — do not attempt to collapse or restructure the table.\n- If `getCreditOpinion` does not return a particular section, write `Not available` in the\n  corresponding cell rather than leaving it blank.\n- `getEntitySectorOutlook` typically applies to all companies in the same sector — call once\n  and reuse.\n- Emit the ratings-chart SVG directly into `#pa-ratings-chart` — the template no longer builds\n  the chart at render time. Pick the `.outlook-badge` class yourself using the rules above.\n- For companies with fewer than 5 historical ratings, either repeat the oldest available rating\n  value to fill the trailing points, or reduce `maxPts` in the chart formula to the largest\n  available count (and drop the corresponding `Rating k` x-axis labels).\n- Inline citations follow the shared citations skill — read\n  [references/shared-citations.md](references/shared-citations.md) before authoring any `[n]`\n  reference or the Citations block.\n\n---\n\n## Amendments (in `references/report-spec.md`)\n\nThree amendments in [`references/report-spec.md`](references/report-spec.md) override the base\nreport layout and **must be applied**:\n\n1. **Most recent fiscal year** — always populate Key Indicators and Scorecards from each\n   entity's most recent FY-end `getEntityFinancials_v2` data (with the distorted-EBITDA `†`\n   handling), not whatever year the credit opinion cites.\n2. **Visual Enhancements** — rating summary cards (`#pa-rating-cards`), financial comparison\n   bar charts (`#pa-fi-charts`), and the ESG score heatmap (`#pa-esg-heatmap`).\n3. **Section layout / ratings-chart / ESG overrides** — emit rating cards instead of the\n   `<tbody id=\"pa-peers-rating\">` table, the enhanced ratings chart, and the ESG heatmap\n   instead of the `<tbody id=\"pa-esg-table\">` table.\n\nSee the spec for the full rules, reference snippets, the updated element-ID mapping, and the\nexact list of base elements to omit.\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}