--- name: artifacts-builder description: Builds a working, interactive web prototype as one self-contained HTML file that can be opened or shared with no install or build step. Use when a user says "build me a quick tool", "make a clickable prototype", "I need a demo for stakeholders", "turn this into a small web app", or wants to explain a mechanism with something interactive. --- # Artifacts Builder Produces a real working interface, with state, clicks, validation and sample data, packaged as a single HTML file. The goal is something a colleague can double-click and use within a minute, and that a developer could later lift into a proper codebase. ## When to use this - Stakeholder demos, internal tools, calculators, dashboards, forms, small games, interactive explainers. - The user needs to see and click something before deciding whether to build it properly. - The audience will not have Node, npm or a dev environment. Do not use it for anything needing a backend, real logins, or real customer data. Say so up front and mock those parts. ## Procedure 1. **Pin down the job in one sentence.** "A person who is ___ uses this to ___." If the user cannot say it, ask for the single most important task and build only that. 2. **List the screens and states.** Write the views, the data each shows, and the empty, loading and error states. Keep to three views or fewer for a first pass. 3. **Invent realistic sample data.** Use 8 to 20 believable records with varied values, including a long name and an awkward edge case. Never use "Lorem ipsum" or "Item 1". 4. **Pick the stack by the need.** - Simple pages and forms: plain HTML, CSS and vanilla JavaScript. - Several interacting components: React loaded from a pinned CDN build with Babel standalone, or Preact if size matters. - Always pin library versions and load them from a single well-known CDN. 5. **Structure the code for lifting out later.** Keep state in one place, write small named components or functions, keep data in a constant at the top, and keep styles in a single style block using CSS variables for color and spacing. 6. **Build the interaction first, polish second.** Wire every visible control to something. Validate inputs inline with a plain message beside the field. Make buttons show a pressed or disabled state. A control that does nothing is worse than no control. 7. **Style with restraint.** One typeface family, a spacing scale of 4, 8, 16, 24 and 40 pixels, one accent color, visible focus rings, and a layout that works at 400 pixels wide as well as on a desktop. 8. **Persist lightly.** If the user would expect their changes to survive a refresh, use `localStorage` wrapped in a try and catch, and provide a reset-demo button. 9. **Test by reading.** Walk through the main task click by click in your head, then through the empty state and one bad input. Fix anything that breaks before you hand it over. ## Output format - A one-line summary of what was built and what is mocked. - The complete file in one code block, with a short comment at the top listing the libraries and versions used. - Three bullets: how to open it, what to try first, what a production version would need (backend, auth, tests). - Two suggested next steps, such as adding export to CSV or splitting it into components for a real project. ## Guardrails - No external API calls that need keys; mock responses instead. - Never embed secrets or real personal data in the file. - Keep the file under roughly 600 lines; if it grows past that, propose a split rather than shipping a tangle. - Be honest about limits: say which behaviors are simulated. - Escape any user-entered text before inserting it into the page. ## Quality checks Before sending, confirm each of these: - A first-time user can complete the main task without reading instructions. - Every button, link and field does something visible, or is clearly marked as a placeholder. - The page works with an empty list, a very long name, and a wrong entry in each form field. - Nothing depends on a file, font or image that is not inside the HTML or on the pinned CDN. - Text stays readable at 400 pixels wide, and the tab key reaches every control. - The mocked parts are listed in your summary so nobody mistakes the demo for the product.