|
| 1 | +--- |
| 2 | +name: presenting-artifacts |
| 3 | +description: "Presents plans, proposals, research and investigation write-ups, comparisons, status reports, and other documents as skimmable, self-contained HTML pages with before-and-after drawings, serves them from the orb, and shares portal links where readers can comment on any block. Use when asked for a plan or a proposal, when asked to write up findings or a report for review, or when asked for a page, an artifact, or a link to share." |
| 4 | +metadata: |
| 5 | + sandbox-only: true |
| 6 | +--- |
| 7 | + |
| 8 | +# Presenting Artifacts |
| 9 | + |
| 10 | +An artifact here is a document for a person to read, written as one self-contained HTML page. A |
| 11 | +reader can skim it in two minutes, comment on any block, and open the same link again after |
| 12 | +each revision. This skill covers when to make a page, what goes in it, how to write it, how to |
| 13 | +make it easy to comment on, and how to share it. |
| 14 | + |
| 15 | +`<skill>` below is this skill's base directory. Run commands from the workspace root. |
| 16 | + |
| 17 | +## When to Make a Page |
| 18 | + |
| 19 | +Make a page when the user asks for one, or when the result is a document that someone will |
| 20 | +review, share, or come back to: |
| 21 | + |
| 22 | +- a plan, a proposal, or a design |
| 23 | +- a write-up of research, of an investigation, or of a review |
| 24 | +- a comparison of options |
| 25 | +- a status report |
| 26 | +- an explanation of a system or of a change that needs drawings |
| 27 | + |
| 28 | +Answer in the chat instead when the result fits in a short message and nobody needs to comment |
| 29 | +on its parts. A page costs the reader a click, so it must save more reading than that. |
| 30 | + |
| 31 | +## Workflow |
| 32 | + |
| 33 | +1. **Investigate.** Read the code, docs, and data the page depends on before writing. A page |
| 34 | + written from memory sends the reader to review guesses. |
| 35 | +2. **Create the page** from the template. `<slug>` names the topic in kebab-case, such as |
| 36 | + `redis-sessions`. Keep the file name for the life of the document so the link never changes. |
| 37 | + |
| 38 | + ```bash |
| 39 | + mkdir -p .amp/in/artifacts/pages |
| 40 | + cp <skill>/reference/page-template.html .amp/in/artifacts/pages/<slug>.html |
| 41 | + ``` |
| 42 | + |
| 43 | + Replace every `⟦…⟧` placeholder; each one says what belongs there. Delete the sections the |
| 44 | + document does not need. Keep the template's styles and script unchanged. |
| 45 | + |
| 46 | +3. **Check and share.** The script checks every page in the directory, starts or reuses a |
| 47 | + supervised static server, and prints each page's title and portal URL. It stops on leftover |
| 48 | + placeholders and repeated ids. Fix what it reports and run it again. |
| 49 | + |
| 50 | + ```bash |
| 51 | + node <skill>/scripts/share.mjs |
| 52 | + ``` |
| 53 | + |
| 54 | + Use `--check` to check without sharing and `--dir DIR` for another directory. Outside an orb |
| 55 | + there is no portal; the script prints file URLs to link instead. |
| 56 | + |
| 57 | +4. **Look at the page** when it has a drawing, a wide table, or markup the template does not |
| 58 | + have: take a screenshot with `agent-browser` and inspect it. Every drawing must line up, and |
| 59 | + nothing may run out of its block. |
| 60 | +5. **Reply** with the link first, then at most five lines: what you need from the reader by tag |
| 61 | + and name, the main point of the page, and how to comment. For a plan, the main point is the |
| 62 | + recommendation with what done looks like. The page holds the document; do not repeat it in |
| 63 | + the reply. |
| 64 | +6. **Stop or continue.** When the user asked for the document, the page is the deliverable: |
| 65 | + share it and end the turn. A plan that the user asked for ends the turn before its first |
| 66 | + step. When the user asked for the work and you planned first, share the page and continue |
| 67 | + with the steps that no open decision affects. |
| 68 | +7. **Keep the page current.** Revise the same file after each comment or decision. While you |
| 69 | + execute a plan, update the step chips and the header chip, so the link always shows the real |
| 70 | + state. |
| 71 | + |
| 72 | +Example reply: |
| 73 | + |
| 74 | +```markdown |
| 75 | +[Plan: Move session storage to Redis](https://t-abc-p3000.onamp.dev/redis-sessions.html "amp-portal") |
| 76 | + |
| 77 | +I need two answers before S3: **Q1** (who hosts Redis) and **Q2** (session lifetime). Without |
| 78 | +them I will use option A for both. |
| 79 | + |
| 80 | +I recommend writing to both stores first and switching reads after a day of matching results. |
| 81 | +The work is done when all reads come from Redis and the `sessions` table is dropped. There are |
| 82 | +5 steps; only S5, which drops the table, cannot be undone. |
| 83 | + |
| 84 | +To comment, use the review button in the corner of the page and select any block. |
| 85 | +``` |
| 86 | + |
| 87 | +## What Goes in a Page |
| 88 | + |
| 89 | +A page lets the reader act: approve, redirect, decide, or take the result and move on. These |
| 90 | +rules hold for every kind of page. |
| 91 | + |
| 92 | +- **Ground each claim in something you read.** Name the files, functions, commands, and |
| 93 | + sources. Label anything you could not verify as an assumption. |
| 94 | +- **Ask only what the reader must decide.** A question belongs under Decisions needed when its |
| 95 | + answer changes what happens next and neither the code nor the request settles it. Give each |
| 96 | + question options, a recommendation, and the default you will use without an answer. Decide |
| 97 | + everything else yourself and state the choice on the page. |
| 98 | +- **Size the page to the content.** A small plan needs the summary and two or three steps. |
| 99 | + Delete an empty section instead of filling it. |
| 100 | + |
| 101 | +The template has the sections of a plan and a Findings section for the other documents. Keep |
| 102 | +the parts that fit the document, and name the summary rows to fit. "Needs from you" stays the |
| 103 | +first row on every page. |
| 104 | + |
| 105 | +| Document | Other summary rows | Sections to keep | |
| 106 | +| ----------------------------------- | ------------------------------- | ------------------------------------------------------ | |
| 107 | +| Plan | Goal, Approach, Done when, Size | Decisions needed, Approach, Steps, Risks, and the rest | |
| 108 | +| Proposal or design | Goal, Approach, Size | Decisions needed, Approach, Risks, Alternatives | |
| 109 | +| Research, investigation, or review | Answer, Confidence | Findings with the most important first, Evidence | |
| 110 | +| Comparison of options | Recommendation, Compared on | Findings with one table that compares the options | |
| 111 | +| Status report | State, Next | What changed, Steps with current chips, Risks | |
| 112 | +| Explanation of a system or a change | Main point | Approach with its drawings, Findings for the parts | |
| 113 | + |
| 114 | +For a document that is not in the table, start from the summary and Findings. |
| 115 | + |
| 116 | +## What Goes in a Plan |
| 117 | + |
| 118 | +A plan lets the reader approve, redirect, or stop the work before it becomes expensive. Every |
| 119 | +part of the page serves that decision. |
| 120 | + |
| 121 | +- **State what done looks like.** Fill the summary's "Done when" row with the state that ends |
| 122 | + the work, written so that someone can check it: "All reads come from Redis, the `sessions` |
| 123 | + table is dropped, and `pnpm test` passes." The Verify line of the last step proves it. When |
| 124 | + you cannot state it, the goal is not yet clear: make that the first question under Decisions |
| 125 | + needed. |
| 126 | +- **Recommend one approach.** The reader should not have to choose between options that look |
| 127 | + equal. Put the others under Alternatives, each with the specific reason it lost. |
| 128 | +- **Put what would disprove an assumption under Risks**, with the earliest signal that it is |
| 129 | + false. |
| 130 | +- **Write down what you cannot plan yet.** A part of the work goes under Not yet specified when |
| 131 | + it is in scope but you cannot yet state it as a precise question or step, usually because it |
| 132 | + waits for an answer or for the result of an earlier step. Name the area and what it waits |
| 133 | + for, and leave it coarse: one item may later become several steps or none. The test is |
| 134 | + whether you can state the question now, not whether you can answer it. A question you can |
| 135 | + state goes under Decisions needed, even when nothing can act on it yet. When an item becomes |
| 136 | + clear, replace it with a question or a step that takes the next free tag. |
| 137 | +- **Make each step a result someone can check.** Name the step by what is true afterwards |
| 138 | + ("Sessions are written to both stores"), list what it touches, and say how to verify it. A |
| 139 | + step that cannot be verified is too vague. A step that touches unrelated areas is two steps. |
| 140 | +- **Order the steps to learn early.** Start with a thin slice that runs end to end. Put the |
| 141 | + largest unknown near the start. Put changes that are hard to undo, such as data migrations, |
| 142 | + deletions, and published interfaces, near the end and say that they are hard to undo. |
| 143 | +- **Say what is out of scope** when a reader could assume it is included. Out of scope is work |
| 144 | + that the goal does not cover; it never moves into the plan the way a Not yet specified item |
| 145 | + does. |
| 146 | + |
| 147 | +## Drawings |
| 148 | + |
| 149 | +A reader takes in a structure or a change faster from a drawing than from prose. Put a Before |
| 150 | +and After drawing in the Approach section of every page that proposes or explains a change; the |
| 151 | +template has the markup. Leave it out only when there is nothing to draw, such as a rename or a |
| 152 | +new constant value. |
| 153 | + |
| 154 | +Draw what the system does, not which files change: the path a request takes, the states an |
| 155 | +object moves through, the order of calls, or who owns the data. |
| 156 | + |
| 157 | +- Use the same view, layout, and labels in both panes, so that only the difference moves. |
| 158 | +- Draw unchanged parts with light lines (`─│┌┐└┘→↓`) and changed parts with heavy glyphs |
| 159 | + (`━┃┏┓┗┛▶▼●`). The page colors the heavy glyphs, so the eye lands on the change first. |
| 160 | +- Write a consequence that matters, such as a latency, a count, or an error, next to the part |
| 161 | + that causes it. |
| 162 | +- When the behavior is new and Before would be empty, show the result alone. |
| 163 | +- Say in the caption what the reader should notice. |
| 164 | + |
| 165 | +In the other sections, and in pages that do not describe a change, add a view where it carries |
| 166 | +information that the prose does not. Use the smallest view that fits: |
| 167 | + |
| 168 | +| To show | View | Markup | |
| 169 | +| -------------------------------------------------------------- | --------------------------- | ----------------------- | |
| 170 | +| A flow, states, or connected parts | Box drawing | `<pre class="diagram">` | |
| 171 | +| The order of calls at run time | Indented call tree | `<pre>` | |
| 172 | +| Logic or an algorithm | Pseudocode | `<pre>` | |
| 173 | +| Which files or components own what | Shallow tree with comments | `<pre>` | |
| 174 | +| A change inside such a tree, or exact text such as a signature | Lines that start `+` or `-` | `<pre class="diff">` | |
| 175 | + |
| 176 | +Wrap each view in `<figure id="fig-…">` with a `<figcaption>`, and start each line of a view at |
| 177 | +the first column of the file. A box drawing lines up only when every character takes one |
| 178 | +column: use spaces, and keep tabs, `&`, `<`, `>`, and emoji out. In the other views, which hold |
| 179 | +code, write `&` as `&` and `<` as `<`; a raw `<` can start a tag and swallow the rest of |
| 180 | +the page. Keep each pane of a Before and After pair within 38 columns and a single drawing |
| 181 | +within 80. When text cannot carry the drawing, use an inline `<svg>` that takes its colors from |
| 182 | +`currentColor`, so that it works in light and dark mode. |
| 183 | + |
| 184 | +The `explaining-code` skill has a worked example of each view. |
| 185 | + |
| 186 | +## Writing a Page That Can Be Skimmed |
| 187 | + |
| 188 | +Most readers read the header and the summary, scan the headings and tags, and open the detail |
| 189 | +only where they disagree. Write for that reader. |
| 190 | + |
| 191 | +- **The header and summary stand alone.** The summary opens with "Needs from you", because that |
| 192 | + is the row the reader must act on; write "Nothing, this is for your information" when that is |
| 193 | + true. A reader who stops after the summary knows what you need from them and the main point. |
| 194 | + For a plan, that reader also knows what done looks like and the size of the work. |
| 195 | +- **Headings state the takeaway.** Write "Write to both stores first, then switch reads", not |
| 196 | + "Migration strategy". The fixed section names, such as Steps and Risks, stay as they are. |
| 197 | +- **One idea per block, and its first sentence carries the point.** Keep paragraphs to three |
| 198 | + sentences. |
| 199 | +- **Choose the form by the content.** Use numbered items for a sequence, a table to compare |
| 200 | + several things on the same attributes, a drawing for behavior and structure, and `<details>` |
| 201 | + for proof and long code. |
| 202 | +- **Keep the main path short.** Put material the reader needs only to check your work into |
| 203 | + `<details>` under Evidence or Alternatives. Never put a decision or a risk inside `<details>`. |
| 204 | +- **Use the same word for the same thing** on the whole page. Put file paths, commands, and |
| 205 | + identifiers in `<code>`. |
| 206 | +- **Keep the page self-contained.** Use the template's inline styles and load nothing from |
| 207 | + another site. |
| 208 | + |
| 209 | +## Making the Page Easy to Comment On |
| 210 | + |
| 211 | +Amp adds a review button to every portal page. The reader selects an element and writes a |
| 212 | +comment. The comment arrives in this thread as a user message that starts with "Portal page |
| 213 | +comment from" and carries the page URL, a CSS selector for the element, and the first 200 |
| 214 | +characters of its text. The selector starts at the nearest `id`, so ids decide how precisely you |
| 215 | +can tell what the reader pointed at. |
| 216 | + |
| 217 | +- **Give every block a reader may comment on a unique `id`** that names its content, such as |
| 218 | + `step-dual-write`, not its position, such as `step-2`. Keep ids unchanged across revisions. |
| 219 | +- **Give each decision, finding, step, and risk a visible tag**: Q1, F1, S1, R1. Readers quote tags in chat |
| 220 | + and by voice ("Q2: take B"). After the page is shared, never renumber or reuse a tag; a new |
| 221 | + block takes the next free number. |
| 222 | +- **Put one decision, finding, step, or risk in each element**, so a comment has one possible target. |
| 223 | +- **Start each block with words that identify it**, because you see only its first 200 |
| 224 | + characters. |
| 225 | +- **Leave the review button working.** Add no click handlers, overlays, or fixed elements. |
| 226 | + |
| 227 | +When a comment arrives: |
| 228 | + |
| 229 | +1. Find the block from the `id` in the selector and the quoted text. |
| 230 | +2. Change that block and every other block the change affects. |
| 231 | +3. Record the change under "What changed" with the tags involved, and raise the version in the |
| 232 | + header. |
| 233 | +4. Keep a settled question in place: add a `done` chip that reads "Decided: A" and move the |
| 234 | + consequence into Approach and Steps. Deleting it would break the tags readers already quoted. |
| 235 | +5. Run the share script again and reply with what changed in one or two lines and the same link. |
| 236 | + |
| 237 | +Answer a comment that only asks a question in the thread. Also add the answer to the page when |
| 238 | +other readers would ask the same thing. |
| 239 | + |
| 240 | +## Sharing |
| 241 | + |
| 242 | +- People who can view the thread can open its portal links. To reach anyone else, the user |
| 243 | + changes the thread's visibility or selects Make Public under Portal Options in the Portal |
| 244 | + tab, which opens the link for a limited time without the review button. Tell the user about |
| 245 | + these options when they ask to share more widely; do not change access yourself. |
| 246 | +- The page is served from this thread's orb, and opening the link wakes a paused orb. When the |
| 247 | + user wants a copy that does not depend on the thread, offer to commit the HTML file to the |
| 248 | + repository. Do not commit it otherwise. |
0 commit comments