chartifact
Copilot instructions83 starsChanged 12 months agoMITView on GitHub
Welcome to the Chartifact codebase! This document provides essential guidance for AI coding agents to be productive in this repository. Chartifact is a low-code framework for creating interactive, data-driven documents such as dashboards, reports, and presentations. Below are the key aspects to understand: Chartifact consists of several interoperating modules:
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
15 rules. About 0 are common, 9 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 45
Use standard CSS for styling documents.
- Distinctive: line 49
NO HTML elements are allowed: - use only Markdown formatting.
- Distinctive: line 50
No custom JavaScript execution or raw HTML in Markdown.
- Very specific: line 57
Use simple string arrays for options: "options": ["Option1", "Option2"]
- Very specific: line 61
Place chart specifications in the resources.charts section
- Very specific: line 65
ALWAYS add responsive CSS for grid containers: Use min-width: 0 and overflow: hidden for grid areas containing tabulators
- Very specific: line 74
If you are asked to create an example, do it in the packages/web-deploy/json folder, do not modify the destination folder …
- Distinctive: line 75
IMPORTANT: NO HTML elements are allowed.
- Very specific: line 77
After you know it validates statically, validate dynamically.
- Distinctive: line 82
After creating or modifying examples, always run a smoke test to ensure they render correctly.
- Very specific: line 83
Use the packages\html-wrapper\test\example.mjs script to generate an HTML file from your JSON example.
- Distinctive: line 86
All components render correctly
- Distinctive: line 88
If issues are found, fix them before finalizing your changes.
- Distinctive: line 93
If the agent is run in the cloud:
- Distinctive: line 98
If the agent is run locally:
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions for Chartifact
Welcome to the Chartifact codebase! This document provides essential guidance for AI coding agents to be productive in this repository. Chartifact is a low-code framework for creating interactive, data-driven documents such as dashboards, reports, and presentations. Below are the key aspects to understand:
Big Picture Architecture
Chartifact consists of several interoperating modules:
- Document Schema: Defines plugins and components that communicate via reactive variables. Key components include:
- Text: Markdown with dynamic placeholders.
- Inputs: Textboxes, checkboxes, sliders, dropdowns.
- Tables: Sortable, selectable, and editable data grids.
- Charts: Vega and Vega-Lite visualizations.
- Diagrams: Mermaid diagrams, including data-driven generation.
- Images: Dynamic image URLs based on variables.
- Presets: Named sets of variable values for quick scenario switching.
- Sandboxed Runtime: Securely renders documents in isolated environments.
- VS Code Extension: Provides tools for editing, previewing, and exporting documents.
- Web-Based Viewer and Editor: Enables quick edits and sharing.
Developer Workflows
Build
- For now, don't build. We can add this later.
Testing
- Currently we don't have much test coverage. We can add this later.
Version Control
- Do NOT check in UMD build artifacts: Files matching
*.umd.jsindocs/dist/v1/are build outputs and should not be committed in PRs - Do NOT edit
docs/schema/idoc_v1.d.tsdirectly: This file is generated frompackages/schema-doc/src/. Edit the source files in the schema-doc package instead - Do NOT check in built schema files: Files
docs/schema/idoc_v1.d.tsanddocs/schema/idoc_v1.jsonare generated frompackages/schema-doc/src/during the build process and should not be committed in PRs - These files are generated during the build process and committing them creates unnecessary merge conflicts
Project-Specific Conventions
- File Formats:
.idoc.md: Markdown format for human-readable documents..idoc.json: JSON format for structured, programmatic generation. This is compiled to markdown.
- Styling:
- Use standard CSS for styling documents. Examples are provided for articles, dashboards, and slides.
- Security:
- Documents are rendered in sandboxed iframes.
- NO HTML elements are allowed - use only Markdown formatting.
- No custom JavaScript execution or raw HTML in Markdown.
- For layouts and styling, use only CSS classes applied to groups and standard Markdown elements.
Component Capabilities and Constraints
- Dropdown Components:
- Dropdown options must be strings only, not objects
- Use simple string arrays for options:
"options": ["Option1", "Option2"] - For data-driven options, use
dynamicOptionswith a data source. Seedocs\assets\examples\json\features\7.dropdown.idoc.json
- Chart Components:
- Place chart specifications in the
resources.chartssection - Reference charts using
{"type": "chart", "chartKey": "yourChartKey"}
- Place chart specifications in the
- Tabulator Components (Critical):
- ALWAYS add responsive CSS for grid containers: Use
min-width: 0andoverflow: hiddenfor grid areas containing tabulators - This prevents tabulator measurement errors that cause infinite growth and call stack overflow
- Example:
"#table { grid-area: table; min-width: 0; overflow: hidden; }" - Also include:
".tabulator { max-width: 100%; overflow: auto; }"and".tabulator .tabulator-table { min-width: fit-content; }"
- ALWAYS add responsive CSS for grid containers: Use
Examples
- Source code for examples is in the
packages/web-deploy/jsonfolder - Examples in this repo use the json format and are compiled to markdown.
- If you are asked to create an example, do it in the
packages/web-deploy/jsonfolder, do not modify the destination folderdocs/assets/examples- this will be populated by a build. - IMPORTANT: NO HTML elements are allowed.
- Validate the json against the TypeScript schema declaration of InteractiveDocumentWithSchema in
docs\schema\idoc_v1.d.ts - After you know it validates statically, validate dynamically. See
packages\compiler\test\validate.mjs
Smoke Test
- After creating or modifying examples, always run a smoke test to ensure they render correctly.
- Use the
packages\html-wrapper\test\example.mjsscript to generate an HTML file from your JSON example. - Open the generated HTML file in a browser to verify that:
- There are no console errors or warnings
- All components render correctly
- Interactive elements function as expected
- If issues are found, fix them before finalizing your changes.
- Attach the smoke screenshot to your PR for verification.
Runtime host
If the agent is run in the cloud:
- There is a sandboxed runtime that securely renders documents available at https://microsoft.github.io/chartifact/view
- The url above can accept a
loadparameter to specify the document to render, for example https://microsoft.github.io/chartifact/view/?load=https://raw.githubusercontent.com/microsoft/chartifact/562d086/packages/web-deploy/json/sales-dashboard.idoc.json - ALWAYS provide a preview link when creating or modifying examples - include the preview link in PR comments and descriptions automatically so examples can be tested immediately without being asked.
If the agent is run locally:
- the user can preview documents using the VS Code extension.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

