---
name: artifact
description: "Handling rules for visual and document artifacts: PDFs, HTML reports, dashboards, slides and formula rendering. Load when creating, editing, verifying, or opening any of these artifact types."
title: artifact
canonical_url: https://skilld.dev/gh/masihmoafi/skills/artifact
last_updated: 2026-11-12T14:03:31.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install masihmoafi/skills/artifact`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/artifact`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/masihmoafi/skills/artifact) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/artifact`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/artifact --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/artifact --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Artifact

Rules for producing, checking and opening PDFs, HTML reports, slides and formulas. Check every artifact visually before showing it: text visible and legible, consistent, inside its borders.

## Visual design check

Before showing a diagram, chart, slide or report: the primary takeaway is apparent at a glance to its audience; every accent colour carries information; every size or colour difference means something; elements sit on one grid and text aligns to its reading direction (right for Persian); steps and containers have room to breathe.

## PDFs

- For a scanned PDF: run `pdfinfo`, then one `pdftotext -layout` check; if it is empty, render pages with `pdftoppm` to `tmp/pdfs/` and inspect the PNGs at original detail.
- Keep a short inventory: page count, text-extraction result and what the pages contain.
- Stay local; use no online OCR or upload unless the user asks.
- After creating or editing a PDF the user will inspect, render a page to check it, then open it for the user with the environment's opener and confirm the viewer started.

## HTML reports

- After creating or materially editing a user-facing HTML artifact, open it for the user unless they say not to. A screenshot or headless render verifies it; it does not replace opening it.
- Open HTML in Chromium. For a site folder, especially one with assets, scripts or maps, serve it locally: `setsid python3 -m http.server <port> --directory <site-dir> >/tmp/<task>-server.log 2>&1 &`, then open `http://127.0.0.1:<port>/...`. Use `file://` only for a simple standalone page; if Chromium keeps loading, switch to the local server before saying it is open.
- Browser automation and screenshots are costly. Use cheaper local checks unless the UI, formulas or charts are new or materially changed; then do one visual pass before opening.
- Make alternative designs switchable in the HTML rather than describing them in chat.

## Slides and print layout

- For browser-printed HTML slides, do not rely on `.active` styles: print mode often forces every `.slide` to `display:flex`, so put `flex-direction`, `justify-content` and `gap` on the base `.slide` class.
- Check layout by rendering the PDF pages, not by reading extracted text: spot-check the most layout-sensitive pages and make a contact sheet for the whole deck.
- In RTL decks with image and text split layouts, a grid inherits `direction: rtl` and reverses its columns. Set the split container to `direction:ltr` and the text area back to `direction:rtl`.
- For mixed Persian and English slide text, prefer Persian-led phrasing and isolate short English terms; long English-led bullets often render in broken order in PDF.

## Formulas in HTML

- Browsers show raw TeX delimiters (`\(...\)`, `\[...\]`, `$$...$$`) as text unless a renderer or MathML is present.
- In handwritten HTML, write native MathML; Chromium and Firefox render it offline without JavaScript:

```html
<div class="math-display">
  <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
    <msub><mi>s</mi><mi>k</mi></msub><mo>=</mo>
    <munderover><mo>&#x2211;</mo><mrow><mi>j</mi><mo>=</mo><mn>0</mn></mrow><mi>k</mi></munderover>
    <msub><mi>p</mi><mi>r</mi></msub><mo>(</mo><msub><mi>r</mi><mi>j</mi></msub><mo>)</mo>
  </math>
</div>
```

Give `.math-display` `direction: ltr` and `overflow: auto` so wide formulas scroll inside RTL pages.


- From Markdown, or when hand-written MathML is too slow for a large document, convert with Pandoc and keep the `.md` beside the `.html`: `pandoc input.md -s --mathml -c style.css -o output.html`.
- MathJax or KaTeX is acceptable only when its script and CSS are included and verified; avoid CDN renderers unless network use is acceptable.
- A plain-text formula is acceptable only when the user does not need typeset math; explain ambiguous notation in words, for example that `G_inverse(s_k)` means the inverse CDF.
- Before delivery, confirm the formulas became MathML with no raw delimiters left, then open the page and check they render as math:

```bash
rg -n '<math' output.html | head
rg -n '\[|\]|\$\$' output.html | head
```
