Skip to content

CheerpJ docs: an "AI agents" button in the nav, with the agent prompt and the skill - #514

Merged
GabrielaReyna merged 4 commits into
mainfrom
cheerpj/docs-agent-prompt
Nov 4, 2026
Merged

GabrielaReyna merged 4 commits into
mainfrom
cheerpj/docs-agent-prompt

Conversation

@sderossi

@sderossi sderossi commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Why

Add a fixed 'for AI' button / information panel on each page of the docs. The design is temporary and should be improved.

Change

An "AI agents" button in the CheerpJ docs nav, next to Discord and GitHub. It opens a panel:

  • Use CheerpJ with a coding agent: the prompt cheerpj.com's header copies ("Use the CheerpJ skill (https://cheerpj.com/skills/cheerpj/SKILL.md) to help me run our Java application in the browser."), with a Copy button;
  • Or install the skill: npx skills add leaningtech/skills --skill cheerpj, with a Copy button;
  • Read the skill (SKILL.md), and Are you an AI agent? Read this (cheerpj.com/agents.md), as in cheerpj.com's menu.

How

  • cheerpj-brand/AgentMenu.astro: the panel, as a native popover. It opens in the top layer, so the nav's overflow-hidden doesn't clip it, and closes on Esc or a click outside. It comes before <main> in the HTML, so an agent reading raw HTML meets the skill link near the top of every page.
  • cheerpj-brand/AgentButton.astro: the button, in two places, because the nav is full on phones (Demos ends at 352 px on a 360 px screen):
    • 1024 px and up: "AI agents" with its label, in the nav;
    • 640–1023 px: icon only, in the nav;
    • below 640 px: in the bar under the nav, opposite the menu toggle.
  • CheerpJ only (isCheerpj), so the other docs sites don't change.
  • The prompt matches cheerpj.com's sites/cheerpj/src/lib/agent-prompt.ts (leaningtech.com repo); a comment says to keep the two in step.

🤖 Generated with Claude Code

… and the skill

The button opens a panel with cheerpj.com's agent prompt, which points the
agent at the CheerpJ skill, the skill's install command, and links to the
skill and agents.md, each with a Copy button. It's a native popover, so the
nav's overflow-hidden doesn't clip it, and it closes on Esc or a click
outside. The nav is full on phones, so below 640px the button sits in the bar
under it, beside the breadcrumbs; up to 1023px it's an icon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Deploying labs-browserpod-previews with  Cloudflare Pages  Cloudflare Pages

Latest commit: 51d25ec
Status: ✅  Deploy successful!
Preview URL: https://06d51737.labs-browserpod-previews.pages.dev
Branch Preview URL: https://cheerpj-docs-agent-prompt.labs-browserpod-previews.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Deploying labs-cheerpj-previews with  Cloudflare Pages  Cloudflare Pages

Latest commit: 51d25ec
Status: ✅  Deploy successful!
Preview URL: https://ef9aa2b8.labs-cheerpj-previews.pages.dev
Branch Preview URL: https://cheerpj-docs-agent-prompt.labs-cheerpj-previews.pages.dev

View logs

GabrielaReyna and others added 3 commits November 3, 2026 19:51
astro-icon emits the mdi:content-copy <symbol> inside the first copy
button's SVG and points the second button's <use> at it. Setting
button.textContent for the "Copied" feedback removed that <symbol>, so
clicking the first button blanked the second button's icon for the two
seconds until the label was restored.

Swap only the text in the button's <span>, leaving the SVG in place.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The button: a robot rather than a terminal window, and a rule between it
and Discord and GitHub, which it is not one of — it opens a panel where
they lead somewhere else. Its colours stay theirs.

The panel: a close button in the corner, a plain popovertargetaction
="hide" that needs no script. The copy buttons drop their "Copy" label
for the icon alone and tick for two seconds once the text is on the
clipboard, so the prompt gets the width the label was taking. The tick
fades over the copy icon rather than replacing it: astro-icon keeps each
icon's shared <symbol> in its first occurrence, so hiding one blanks the
other button. Nothing ticks when the clipboard is barred — the text is
selected to copy by hand instead, and nothing was copied to report.
Their labels now say which is which, where both read "Copy" before.

The panel's two links lose their thick orange underline for orange text,
white on hover, one at each edge of the code blocks above them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The panel is fixed and uncapped, so on a window shorter than its content
— a phone held sideways, or a short desktop window — everything below
the fold was out of reach: the page behind cannot scroll it, and the
panel had no overflow of its own to scroll. At 844x390 that lost the
install command's copy button and both links.

Cap it at the window less the nav above and a little air below, and let
it scroll inside itself. Roomy windows are unchanged: nothing reaches
the cap, so no scrollbar appears. The vh line before the dvh one is for
browsers without dvh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@GabrielaReyna GabrielaReyna left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some cosmetic changes and fixed a bug with the copy buttons (icon gone when clicking one of them). This is ready to merge (unless another PR is merged prior).

@GabrielaReyna
GabrielaReyna marked this pull request as ready for review November 4, 2026 14:15
@GabrielaReyna
GabrielaReyna merged commit 39b8543 into main Nov 4, 2026
8 checks passed
@GabrielaReyna
GabrielaReyna deleted the cheerpj/docs-agent-prompt branch November 4, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants