Skip to content

stark-ai-de/agent-skills / plugins/stark-ai-developer/skills/visual-reports

visual-reports

Verified

Create and update visual reports with optional native interaction, one guided topic at a time, useful diagrams, concise points, joint comparisons and complete offline HTML/Markdown/JSON exports. Use when richer output helps an authorized answer or the user asks for a visual report; keep small answers in chat. Not production application UI or clinical advice.

FileKindSize
SKILL.mdskill md11.5 KB
agents/openai.yamlconfig779 B
assets/completion-example.mdmarkdown3.2 KB
assets/graphite-grain/configurator.htmlother17.7 KB
assets/graphite-grain/configurator.mjsscript6.9 KB
assets/graphite-grain/relaxed.cssother4.2 KB
assets/openai-icon.pngbinary10.3 KB
assets/openai-icon.svgother318 B
assets/preview.jsscript3.4 KB
assets/report-recipes.mjsscript19.2 KB
assets/report-runtime.cssother16.4 KB
assets/report-runtime.jsscript23.9 KB
assets/report-shell.htmlother14.1 KB
references/comparisons.mdmarkdown4.8 KB
references/filesystem-handoff.mdmarkdown4.7 KB
references/managed-reports.mdmarkdown5.2 KB
references/markdown-input.mdmarkdown3.9 KB
references/model-v2.mdmarkdown10.1 KB
references/renderer.mdmarkdown24.5 KB
references/report-contract.mdmarkdown33.1 KB
references/selection.mdmarkdown4.8 KB
scripts/benchmark.mjsscript2.2 KB
scripts/cache_icon.pyscript9.2 KB
scripts/export-assets.mjsscript4.1 KB
scripts/lib/blocks-v2.mjsscript21.7 KB
scripts/lib/cli.mjsscript3.7 KB
scripts/lib/export-path.mjsscript1.6 KB
scripts/lib/generator-entry.mjsscript472 B
scripts/lib/markdown-input.mjsscript9.8 KB
scripts/lib/preview.mjsscript4.9 KB
scripts/lib/report-state.mjsscript13.4 KB
scripts/lib/report-store.mjsscript7.0 KB
scripts/lib/templates.mjsscript4.7 KB
scripts/render-report.mjsscript40.0 KB
tests/browser-delivery.mjsscript25.4 KB
tests/browser-smoke.pyscript15.5 KB
tests/browser-topics.mjsscript21.1 KB
tests/cache-icon.test.mjsscript5.0 KB
tests/export-assets.test.mjsscript5.5 KB
tests/render-report.test.mjsscript14.3 KB
tests/report-state.test.mjsscript11.7 KB
tests/topics.test.mjsscript6.4 KB
tests/v2.test.mjsscript21.1 KB

tests/topics.test.mjs

View on GitHub
// SPDX-License-Identifier: Apache-2.0
import test from "node:test";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import { renderReport, validateReport, extractReport } from "../scripts/render-report.mjs";
import { starter } from "../scripts/lib/templates.mjs";
import { parseMarkdown } from "../scripts/lib/markdown-input.mjs";
import { exampleReport } from "../assets/report-recipes.mjs";

test("v2 starts with one topic at a time and keeps full exports", async () => {
  const report = starter({ id: "topic-test" });
  delete report.presentation;
  const { html, json, markdown } = await renderReport(report);
  assert.match(html, /class="topic-guide"/);
  assert.equal((html.match(/class="topic-panel"/g) ?? []).length, report.sections.length);
  assert.equal((html.match(/class="topic-radio"/g) ?? []).length, report.sections.length);
  assert.match(html, /class="topic-slider"/);
  for (const section of report.sections) {
    assert.ok(html.includes(`id="block-${section.id}"`));
    assert.ok(markdown.includes(section.title));
  }
  assert.deepEqual(extractReport(html), report);
  assert.deepEqual(JSON.parse(json), report);
});

test("explicit topics group ordered sections without losing content or escaping", async () => {
  const report = starter({ id: "topic-groups" });
  report.presentation = "topics";
  report.topics = [
    {
      id: "evidence",
      title: "Evidence & <limits>",
      shortTitle: "Evidence",
      sectionIds: ["section-1", "section-2"],
    },
    { id: "action", title: "Next action", sectionIds: ["section-3"] },
  ];
  const { html, json } = await renderReport(report);
  assert.equal((html.match(/class="topic-panel"/g) ?? []).length, 2);
  assert.match(html, /Evidence &amp; &lt;limits&gt;/);
  assert.doesNotMatch(html, /Evidence & <limits>/);
  assert.deepEqual(extractReport(html), report);
  assert.deepEqual(JSON.parse(json), report);
  for (const section of report.sections) assert.ok(html.includes(`id="block-${section.id}"`));
});

test("responsive comparison labels retain escaped option conditions and complete exports", async () => {
  const report = starter({ id: "topic-comparison-conditions" });
  const comparison = exampleReport("r01");
  const section = comparison.sections.find((item) => item.kind === "comparison");
  section.data.options[0].note = 'Requires an "annual" contract & <approval>';
  section.data.options[1].note = "";
  report.sections.push(section);
  report.sources.push(...comparison.sources);
  const { html, json, markdown } = await renderReport(report);
  const body = html.match(/<table class="comparison">[\s\S]*?<tbody>([\s\S]*?)<\/tbody>/)[1];
  const label = `${section.data.options[0].label} · Requires an &quot;annual&quot; contract &amp; &lt;approval&gt;`;
  assert.equal(
    body.split(`data-label="${label}"`).length - 1,
    section.data.criteria.length,
    "every responsive comparison row exposes the option condition",
  );
  assert.ok(body.includes(`data-label="${section.data.options[1].label}"`));
  assert.doesNotMatch(body, /data-label="[^"]* · "/);
  assert.deepEqual(extractReport(html), report);
  assert.deepEqual(JSON.parse(json), report);
  const snapshot = JSON.parse(markdown.match(/(`{3,})json\n([\s\S]*?)\n\1/)[2]);
  assert.deepEqual(snapshot, { current: report, original: report });
});

test("topic grouping rejects missing, duplicate, reordered and unknown sections", () => {
  const base = starter({ id: "topic-invalid" });
  const bad = (topics) => {
    const report = structuredClone(base);
    report.topics = topics;
    return report;
  };
  const topic = (sectionIds) => [{ id: "one", title: "One", sectionIds }];
  for (const ids of [
    ["section-1", "section-2"],
    ["section-1", "section-1", "section-2", "section-3"],
    ["section-2", "section-1", "section-3"],
    ["section-1", "unknown", "section-3"],
  ])
    assert.throws(() => validateReport(bad(topic(ids))), /topics/);
  assert.throws(
    () => validateReport(bad([{ id: "x", title: "", sectionIds: ["section-1"] }])),
    /topic/,
  );
});

test("topic identifiers cannot collide with radio or page identifiers", async () => {
  const report = starter({ id: "topic-prefixes" });
  report.topics = [
    { id: "x", title: "One", sectionIds: ["section-1", "section-2"] },
    { id: "select-x", title: "Two", sectionIds: ["section-3"] },
  ];
  const { html } = await renderReport(report);
  for (const id of [
    "topic-select-x",
    "topic-page-x",
    "topic-select-select-x",
    "topic-page-select-x",
  ]) {
    assert.equal(html.split(`id="${id}"`).length - 1, 1, id);
  }
});

test("reading and legacy slides retain their existing presentation", async () => {
  const reading = starter({ id: "reading-test" });
  reading.presentation = "reading";
  assert.doesNotMatch((await renderReport(reading)).html, /class="topic-guide"/);
  const legacy = exampleReport("r09");
  assert.equal(legacy.presentation, "slides");
  assert.doesNotMatch((await renderReport(legacy)).html, /class="topic-guide"/);
});

test("Markdown authors can group sections and select reading explicitly", async () => {
  const sample = await readFile(
    new URL("../assets/completion-example.md", import.meta.url),
    "utf8",
  );
  const withTopics = sample.replace(
    "::takeaway[",
    '::topic{id="overview" title="Overview" short="Start" sections="summary,latency"}\n::topic{id="details" title="Details" sections="capacity,cost,flow,schedule,observations"}\n::takeaway[',
  );
  const report = parseMarkdown(withTopics);
  assert.deepEqual(
    report.topics.map((topic) => topic.sectionIds.length),
    [2, 5],
  );
  assert.equal(report.topics[0].shortTitle, "Start");
  assert.equal((await renderReport(report)).html.match(/class="topic-panel"/g).length, 2);
  const reading = parseMarkdown(
    sample.replace('profile="code"', 'profile="code" presentation="reading"'),
  );
  assert.equal(reading.presentation, "reading");
  assert.doesNotMatch((await renderReport(reading)).html, /class="topic-guide"/);
});

test("the skill invocation prompt requests the same topic and graphic order", async () => {
  const metadata = await readFile(new URL("../agents/openai.yaml", import.meta.url), "utf8");
  const prompt = metadata
    .split("\n")
    .find((line) => line.trimStart().startsWith("default_prompt:"));
  assert.match(prompt, /Visual Reports/);
  assert.match(prompt, /one topic visible at a time/);
  assert.match(prompt, /graphic above concise bullets/);
  assert.doesNotMatch(prompt, /diagrams below/);
});
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall