{"data":{"slug":"github-eosphoros-ai-db-gpt-skills-business-report-e004e55d7da0","title":"Traceable Business Report Generation","summary":"Generate structured, multi-section HTML reports from templates and structured data using reference nodes for dynamic value resolution.","url":"https:\/\/skillshunter.net\/skills\/github-eosphoros-ai-db-gpt-skills-business-report-e004e55d7da0","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-eosphoros-ai-db-gpt-skills-business-report-e004e55d7da0","markdown_url":"https:\/\/skillshunter.net\/skills\/github-eosphoros-ai-db-gpt-skills-business-report-e004e55d7da0.md","download_url":"https:\/\/skillshunter.net\/skills\/github-eosphoros-ai-db-gpt-skills-business-report-e004e55d7da0\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"The skill requires structured data in the form of artifacts with defined result selectors. Users must provide a template path and a REPORT_SPEC object with title, sections, and reference nodes for dynamic value resolution.","instructions":"---\nname: business-report\ndescription: This skill should be used when a user asks for an analysis report, a business review, a post-mortem, or any structured multi-section HTML deliverable over already-executed SQL\/Python analysis. Trigger keywords include \"\u5206\u6790\u62a5\u544a\", \"\u590d\u76d8\u62a5\u544a\", \"\u7ecf\u8425\u62a5\u544a\", \"\u751f\u6210\u62a5\u544a\", \"report\", \"analysis report\", \"business review\", \"post-mortem\", \"html report\".\n---\n\n# Traceable Business Report (template-driven)\n\nRender a multi-section analysis report **from a template plus structured data**, so every\nnumber in the report is resolved by the backend from a captured artifact result instead of\nbeing typed by the model. This is the default path for report generation: prefer it over\nhand-writing HTML.\n\n## Why\n\nHand-written report HTML is validated against the captured artifacts after the fact: a\nnumber the model remembers (or copies from an earlier report) does not exist in any\nartifact, the render is rejected, and repairing dozens of HTML numbers is slow. With this\ntemplate the model only supplies **pointers** (`artifact_id` + result path); the backend\nresolves and formats the value, and a wrong pointer fails immediately with the exact\nselector to fix.\n\n## Tool call\n\n```json\n{\n  \"template_path\": \"business-report\/templates\/business_report.html\",\n  \"title\": \"Olist \u5df4\u897f\u7ad9\u7ecf\u8425\u590d\u76d8\u62a5\u544a\",\n  \"data\": {\n    \"REPORT_SPEC\": { \"...\": \"see below\" }\n  }\n}\n```\n\n`data.REPORT_SPEC` may be a JSON object or a JSON string. Do not pass `html` together with\n`template_path`. **Prefer the object form**: a spec hand-escaped into a JSON string is a\nfrequent, fatal mistake \u2014 one wrong escape makes the whole call unparsable and nothing\nrenders.\n\n```json\n{\n  \"template_path\": \"business-report\/templates\/business_report.html\",\n  \"title\": \"Olist \u5df4\u897f\u7ad9\u7ecf\u8425\u590d\u76d8\u62a5\u544a\",\n  \"data\": {\"REPORT_SPEC\": {\"title\": \"\u2026\"}}\n}\n```\n\n## Reference nodes (the only way to put a value in the report)\n\nEvery value is a reference node; the backend replaces it with the captured value and binds\nthe rendered `<span>` to the producing artifact:\n\n```json\n{\"artifact_id\": \"sql-f6f8810...\", \"path\": [\"rows\", 0, \"gmv\"], \"format\": \"money2\"}\n{\"artifact_id\": \"sql-29da2e3...\", \"path\": [\"rows\", 0, \"product_gmv\"], \"format\": \"money2\"}\n{\"artifact_id\": \"sql-7de826c...\", \"kind\": \"sql\", \"quote\": \"r.score <= 2\"}\n{\"artifact_id\": \"reference-e7ae093...\", \"format\": \"text\"}\n```\n\n- `field` names a key of a **Python** artifact result (`result_selector_examples` in the\n  manifest lists them). For a SQL metric use `path`\n  `[\"rows\", <index>, \"<column>\"]` with a name from the manifest `columns` (the result is\n  `{\"columns\": [...], \"rows\": [...]}`). A SQL selector that names a `field` is refused with\n  `RESULT_SELECTOR_INVALID`, which lists the available keys.\n- Python artifacts must expose their metrics as a JSON result field (for example\n  `{\"RESULT_JSON\": \"{...}\"}`); reference `{\"artifact_id\": \"python-\u2026\", \"field\":\n  \"RESULT_JSON\", \"path\": [\"driver_analysis\", \"items\", 0, \"corr\"]}`.\n- `format`: `money2`, `num2`, `num1`, `int`, `pct` (adds `%`), `text`\/`raw`.\n- Never inline a literal number. Prose numbers must also be reference nodes: **a section\n  whose text contains digits must carry evidence** (a KPI ref, a table built from\n  `artifact_id` + `columns`, a chart, or bound values in `intro`\/`bullets`), otherwise the\n  render is refused before the browser with `REPORT_TEMPLATE_SPEC_INVALID`, which names the\n  section and lists the available artifacts.\n- Layout labels (headings, table headers, section titles) must contain no digits; use\n  reference nodes for anything numeric, including threshold labels.\n- Get real artifact IDs and result fields from `report_evidence_manifest` before writing\n  the spec.\n- Start with `artifact_types=[\"sql\", \"python\", \"chart\"]`, then select the needed\n  `artifact_ids` with `detail=true` (at most twelve per call). Read the governing KB\n  slices separately. A catalog contains identifiers and columns, not the results;\n  read a persisted output when the preview is truncated. A new report agent receives\n  its own first catalog even if the lead already read the same version.\n- Numeric preflight reports all unbound literals together, with spec JSON paths and\n  SQL\/Python producer candidates. Correct every listed value; adding one KPI to the\n  section does not bind the remaining prose. Use a producer table plus a qualitative\n  summary when per-value prose would be too long. Uncaptured derived totals require\n  a captured calculation or a summary without that number.\n\n## REPORT_SPEC shape\n\n```jsonc\n{\n  \"title\": \"\u2026\", \"subtitle\": \"\u2026\", \"scope\": \"\u5206\u6790\u7a97\u53e3 \uff5c \u53e3\u5f84 \uff5c \u8d27\u5e01\",\n  \"kpis\": [{\"label\": \"\u5546\u54c1 GMV\", \"unit\": \"R$\", \"hint\": \"SUM(price)\", \"ref\": <ref>}],\n  \"sections\": [\n    {\"heading\": \"\u4e00\u3001\u603b\u4f53\u7ecf\u8425\u8868\u73b0\", \"kpis\": [...], \"intro\": [[part, \u2026]], \"table\": {...},\n     \"chart\": {...}, \"bullets\": [[part, \u2026]], \"list\": [[part, \u2026]],\n     \"recommendations\": [{\"badge\": \"P0\", \"cls\": \"p0\", \"title\": \"\u2026\",\n                          \"lines\": [{\"label\": \"\u4f9d\u636e\", \"parts\": [part, \u2026]}]}],\n     \"note\": {\"label\": \"\u53e3\u5f84\u8bf4\u660e\", \"parts\": [part, \u2026], \"ref\": <ref>}}\n  ]\n}\n```\n\n- `<part>` is either a plain string (no digits) or a reference node.\n- `table`: **name the producer and the columns; the engine expands the rows.** Never write\n  one reference node per cell \u2014 a 10x5 table would cost ~5,500 characters and overrun the\n  model output limit.\n\n  ```jsonc\n  {\"artifact_id\": \"sql-f6f88101\u2026\", \"label\": \"\u54c1\u7c7b\u660e\u7ec6\", \"limit\": 10,\n   \"columns\": [\"category\", {\"field\": \"gmv\", \"label\": \"GMV\", \"format\": \"money2\"}, \"orders_cnt\"]}\n  ```\n\n  A `columns` entry is a field name (result key, also used as the label) or\n  `{\"field\", \"label\", \"format\"}`. `limit`\/`offset` window the artifact rows; each expanded\n  cell carries its own `path` selector. The explicit\n  `\"rows\": [[part, \u2026], \u2026]` form is only for cells that no artifact row can produce.\n- `chart`: only when a real ChartArtifact exists. Image chart:\n  `{\"refs\": [\"<sql-id>\", \"<chart-id>\"], \"img\": \"artifact:\/\/\u2026.json\", \"caption\": \"\u2026\"}`.\n  ECharts host (the engine then needs one producer with a selector and a target id):\n  `{\"refs\": [\"<sql-id>\", \"<chart-id>\"], \"renderer\": \"echarts\", \"chart_id\": \"<chart-id>\",\n   \"host_id\": \"chart-1\", \"producer\": {\"artifact_id\": \"<python-id>\", \"field\": \"CHART_DATA_JSON\"},\n  \"caption\": \"\u2026\"}`. `<figure>`\/`<img>` are chart hosts and must be covered by a chart artifact.\n- `recommendations` produce `<li>` items; give at least as many as the user requested, and\n  keep the section heading containing \u201c\u5efa\u8bae\u201d.\n- `note.ref`: bind the knowledge-space slice actually used for the methodology statement.\n  A whole-page binding does not count.\n\n## Chart configuration\n\nCharts are not limited to the automatic line\/bar\/scatter choice. Use `chart.option`\nfor a full JSON ECharts configuration, including any built-in series type, composed\nseries, dataset\/encode, multiple coordinates and zoom controls. For example:\n\n```json\n{\"caption\":\"Composition\",\"producer\":{\"artifact_id\":\"sql-real\",\"path\":[]},\n \"option\":{\"series\":[{\"type\":\"pie\",\"radius\":[\"40%\",\"70%\"],\n \"encode\":{\"itemName\":\"actual_category\",\"value\":\"actual_measure\"}}]}}\n```\n\nThe engine injects the producer's captured rows\/columns as the default dataset.\nFor structured charts, select `series.data`, `nodes`, `links`, `dataset.source`,\nor individual data values using `{artifact_id,field,path}` references. Do not\ninline observed data. Use captured tree\/graph\/boxplot\/candlestick structures;\nrequest only a missing conversion via request_report_calculation when necessary.\nMap charts can set `maps={mapName:{artifact_id,field,path}}` to register captured\nGeoJSON, then use that mapName in the option. All input IDs, selectors, resolved\noptions and geography are captured and checked against the rendered chart.\nNo chart-type whitelist is imposed; JavaScript callbacks and extra plugins are\nnot executable through JSON options. Captured Python chart images remain supported.\nPlaceholder-based skill templates use `data.REPORT_CHARTS=[<chart>, ...]` for the\nsame renderer, independently of their preset chart layout.\n\n## Output budget\n\nThe whole spec travels in **one** tool-call argument, and the model output limit is about\n8k tokens: a payload that is cut off cannot be parsed, so the render never even starts.\nKeep the spec small \u2014 tables by `artifact_id` + `columns` (never per-cell references),\n`limit` instead of pasted rows, short `intro`\/`bullets`, and no repeated prose. If a\nrender result says the arguments were cut off by the output limit, shrink the spec\ninstead of resending it.\n\nA long report may be built in pieces. Send the first part as\n`data={\"REPORT_SPEC\": {...}}`, then extend the saved spec with\n`data={\"REPORT_SPEC_APPEND\": {...}}` (call it again with `retry_saved=true` when a render\nwas already attempted): `sections` and `kpis` are **appended**, every other key\n**overwrites**. The engine stores the merged spec, so never resend a part you already\nsent, and finish with the required recommendation section.\n\nKPI values must use `ref`, not `value`. Paragraphs use `sections[].intro` as arrays\nof parts; recommendations belong to `sections[].recommendations` and contain a\n`title` and `lines[].parts`. Unknown keys such as `placeholders`, `sections[].parts`\nor top-level `recommendations` are rejected with a JSON path before rendering.\n`REPORT_SPEC` repairs retain unspecified root fields; an explicitly supplied\n`sections` or `kpis` replaces that complete list. A root field set to `null` is\nremoved, including an unsupported field from a previous invalid spec.\n`REPORT_SPEC_APPEND` extends those\nlists and does not insert an identical fragment twice.\nPreflight (6), document assembly (6), actual render validation (3), and invalid calls\n(3) have separate budgets and a total cap of 18 report calls. Pre-render spec\/selector\nfailures never spend render attempts. Progress compares the merged spec and error;\nretry_saved and template HTML length are not progress signals. Fix all returned\nJSON paths together. An identical input with the same failure stops retries.\n\nThe report agent's tool schema is generated from this same spec model. Captured\ncharts belong only in sections[].chart: `{\"refs\":[\"real-chart-id\"],\"caption\":\"\u2026\"}`.\nImage URLs are resolved from the captured chart output. Native figures use the\nexisting AutoChart frontend. ECharts still uses its existing reviewed template and\nbootstrap; an empty div without rendering code is not a chart.\n\nIf an essential derived result is truly missing, call request_report_calculation\nwith its name, formula and real SQL\/Python source_artifact_ids, then terminate.\nThe lead computes only that missing result with code_interpreter using the injected\nREPORT_CALCULATION_INPUTS JSON file and prints JSON for normal artifact capture.\nResume the saved spec and bind the new Python artifact; never rerun full analysis.\n\nRecommendation lines may contain a standalone `{\"proposal\":\"reduce the rate\nto 5%\"}` or a qualitative goal. The engine labels these as proposed, unobserved\ntargets. A reference node may also carry `proposal`; its artifact_id and\nfield\/path select the rationale. Proposal nodes are not allowed in KPI or\nobserved-value paragraphs, where actual measurements still require sources.\n\nOn failure, a labelled draft can preview independently validated blocks through\nthe existing HTML preview. It does not create a report_id or indicate completion.\nUse status=completed to determine success, never the mere presence of draft HTML.\n\n## Failure handling\n\nFor a large nested result, request only its relevant subtree with\n`report_evidence_manifest(artifact_ids=[\"real-id\"], detail=true,\nselectors={\"real-id\":{\"field\":\"CHART_DATA_JSON\",\"path\":[\"stats_table\"]}})`.\nSelector examples also name fields inside captured JSON strings; truncated previews\nare not evidence that a result is missing. This reuses the manifest and result\nselector, and never reexecutes analysis.\n\nNested Python tables may use the same field\/path selector on the table node,\nfor example `{\"artifact_id\":\"python-id\",\"field\":\"CHART_DATA_JSON\",\n\"path\":[\"stats_table\"],\"columns\":[\"actual_column\"]}`. Prefer an object with\nrows and columns. The engine expands both SQL and Python rows and retains the\ncomplete selector for every cell; do not paste per-cell values into the spec.\n\nThe render error names the exact `artifact_id`, selector and container. Fix the **spec**\n(`data.REPORT_SPEC`), then call `retry_saved=true` with the corrected data only \u2014 never\nresend full HTML and never rerun completed analysis.\n","use_cases":["Generate an analysis report from SQL\/Python analysis results","Create a business review with structured data and visualizations","Produce a post-mortem report with reference-based value resolution"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/eosphoros-ai\/DB-GPT\/blob\/83e7ff9a50c6e1f87aa878f21d2d1355a1d79dbc\/skills\/business-report\/SKILL.md","source_commit":"83e7ff9a50c6e1f87aa878f21d2d1355a1d79dbc","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T15:43:47.000000Z","updated_at":"2026-11-16T08:27:30.000000Z","seo_title":"Generate Business Reports from Templates","seo_description":"Create multi-section HTML reports with dynamic data resolution using reference nodes. Ideal for analysis reports and business reviews.","seo_keywords":["generate business report","analysis report template","html report generation","structured data report","dynamic report generation","business review template"]}}