---
name: artifacts
description: Generate standalone, downloadable artifacts — single-file HTML pages, SVG diagrams, PDFs, slide decks, JSON exports. Write to ./artifacts/<timestamp>-<slug>/ so the user can grab the file. Load whenever the user asks for "a file", "an export", "a downloadable", a one-off mockup, or a chart.
version: 0.1.0
author: QodeX
triggers:
  - artifact
  - export
  - download
  - one-file
  - standalone html
  - svg
  - mockup
  - pdf
slash-aliases:
  - artifact
  - artifacts
allowed-tools:
  - read_file
  - write_file
  - edit_text
  - multi_edit
  - ls
  - glob
  - grep
  - bash
---
# Artifacts — Deliver a File the User Can Take

The user wants a standalone deliverable, not just code changes inside the
project. Build it as a self-contained file in a predictable spot.

## Output location
```
./artifacts/<YYYY-MM-DD>-<slug>/<name>.<ext>
```
- Use the project's `cwd` (don't write to `$HOME` or `/tmp`).
- Create the directory if it doesn't exist.
- Slug = kebab-case summary of the artifact (max 6 words).
- If you generate multiple files, put them all under the same dated dir.

## Required formats — defaults & rules

### Standalone HTML
- **One file.** Inline CSS in `<style>`. Inline JS in `<script>`. No external dependencies unless the user said "use library X".
- If you NEED a library (charts, three.js), prefer ESM CDN with SRI hash; document why.
- `<!doctype html>`, `<meta charset>`, `<meta viewport>`. Always.
- Add a small footer line `<!-- generated by QodeX :: skill=artifacts :: <ISO> -->`.

### SVG
- Width/height in `viewBox` only. No fixed pixel dims.
- Self-contained: no external fonts; use system fonts or inline a base64 woff2 if absolutely required.
- Tag `<title>` and `<desc>` for accessibility.

### PDF
- Generate via the user's local tools (Chrome headless, Pandoc, wkhtmltopdf). Don't hit external services.
- If no PDF toolchain is available, produce HTML first and write a one-liner the user can run.

### Slide deck
- Reveal.js single-file, OR a Markdown file that any deck tool can consume (Marp / Slidev). Ask if the choice isn't obvious.

### Data export
- JSON: pretty-print (2-space). Stable key order. Trailing newline.
- CSV: RFC 4180. UTF-8 with BOM only if the user is sending it to Excel.

## Quality checklist before declaring done
1. The file opens correctly with a double-click (HTML/SVG).
2. No `localhost:` / `http://0.0.0.0/` references baked in.
3. No accidental secrets, no leaked tokens, no internal-only URLs.
4. Print the **full absolute path** of every artifact in your summary so the user can `open <path>` directly.

## Examples of what artifacts SHOULD be
- "Show me a chart of the auth latency" → `artifacts/2026-05-29-auth-latency/chart.html`
- "Make me a one-pager about the project" → `artifacts/2026-05-29-project-onepager/index.html`
- "Export the schema as a diagram" → `artifacts/2026-05-29-schema/schema.svg`

## What artifacts is NOT for
- Project source files (just edit those in place).
- README updates (they live with the code, not under `./artifacts/`).
- Anything the user will check into git as part of the codebase.
