Skip to content
prod e051e98
Browse

Copy-as-prompt button

Copy as prompt · Copy page · Open in ChatGPT/Claude

Every doc page carries a small split-button beside its title (and at the foot of the article). It turns the page into something an AI assistant can act on — framed by what kind of page it is. A Build playbook tells the assistant to execute the steps in your repo; a Learn guide tells it to tutor you; a system page tells it to help author the library.

The button is one control with three outputs, each built from the same page metadata:

ActionBuilder (page-prompt.ts)What you getUse it when
Copy as prompt (main button)buildPagePrompt()The page wrapped in a persona + mission + rules preamble, then the full bodyYou want an assistant to act on the page (run the steps, tutor you, fill the template)
Copy page (menu)buildPageMarkdown()The raw page as clean Markdown — # title + > Source: + body, no persona wrapperYou want the plain content (paste into a doc, or into a chat where you’ll frame it yourself)
Open in ChatGPT / Claude (menu)buildOpenAsk()A short, persona-aware ask + the live URL (the assistant fetches the page itself)You want to jump straight into a chat without pasting the whole page

The persona system — framing by doc-type

Section titled “The persona system — framing by doc-type”

The core idea: the receiving assistant’s role changes with the page’s doc-type, so the copied prompt produces the right behaviour. The preamble is built in three layers:

  1. Personawho the assistant is (“You are a senior implementation assistant…”).
  2. Missionwhat to do with this page (“Execute the procedure below in your real workspace…”).
  3. Rulesbinding constraints (steps in order, verify against # Expected:, checklist gates, stop-and-report…).
flowchart TD
  A[Doc page] --> B["PageCopyPrompt.astro<br/>builds one meta object"]
  B --> C{"resolvePersona()<br/>path type → kind → shelf"}
  C --> D["Posture<br/>execute · verify · understand · use · evaluate · author"]
  D --> E1["buildPagePrompt()<br/>Copy as prompt"]
  D --> E2["buildOpenAsk()<br/>Open in ChatGPT / Claude"]
  B --> E3["buildPageMarkdown()<br/>Copy page"]
  E1 --> F[CopyPageButton.astro]
  E2 --> F
  E3 --> F
Shelf · typePostureThe assistant becomes
build / playbooks · sops · runbooksexecuteSenior implementation assistant — runs the steps in your real repo
build / checklistsverifyVerification partner — confirms each item is genuinely done
build / blueprintsunderstandArchitecture advisor — explains the design before you touch code
learn / handbooks · guides · concepts · research · case-studiesunderstandTechnical tutor — explains, then helps you apply
resources / templates · kits · cheatsheets · referenceuseHands-on assistant — adapts the artifact for your project
directoryevaluateResearch assistant — compares options and helps you choose
system_docs · any …/meta/authoring/… pageauthorZajLibrary documentation assistant — the only place the “documentation assistant” framing is correct

resolvePersona() picks the posture in this order (most reliable first):

  1. Authoring overridesystem_docs shelf or any …/meta/authoring/… path → author.
  2. Path type segment<shelf>/<type>/… (the IA enforces this; content-path-audit.py validates it).
  3. kind frontmatter — fallback when the path type is unknown (the enum in content.config.ts).
  4. Shelf default — then a neutral generic persona.

For execute pages the rules block also gets:

  • Step-awareness — when a page has stepNumber, a line like “This is step 1 of phase 1 (~10 min) — do only this step, then stop at its ## Checklist.”
  • Category-scoped rules — CodeCanyon/Laravel pages (category: laravel or a codecanyon tag/collection) append a secrets-discipline rule. Narrow rules stay scoped — they never appear on unrelated pages.
You want to…Do this in page-prompt.ts
Add a new doc-typeAdd a row to TYPE_META ({ label, posture }), and to KIND_TO_SEGMENT if a kind value should map to it
Change a persona’s wordingEdit the relevant entry in POSTURES (persona / mission / rules / openAsk)
Add a category-scoped ruleExtend CODECANYON_EXECUTE_RULES (or add a sibling set + a guard in resolvePersona)
Surface a new metadata fieldAdd it to PagePromptMeta, pass it from PageCopyPrompt.astro, and add a metadataLines entry

After any change, run npm run build — the persona text ships inside each page’s static HTML, so a green build plus a spot-check of the rendered data-prompt is the verification.