Skip to content

Feature AI prompts in home Quick Start + add /prompts page#125

Merged
justin808 merged 8 commits into
mainfrom
jg-conductor/home-quick-start-prompts
Jun 9, 2026
Merged

Feature AI prompts in home Quick Start + add /prompts page#125
justin808 merged 8 commits into
mainfrom
jg-conductor/home-quick-start-prompts

Conversation

@justin808

@justin808 justin808 commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace the home page Quick Start shell-command cards with copy-able AI-agent prompts, led by React Server Components (the marquee, "no license required").
  • Add a new /prompts page: a browsable prompt library grouped by intent (Get started, Server rendering, Migrate, Build features, Optimize & go to production), linked from the home Quick Start via "Browse all prompts →" and from the navbar.
  • Each prompt embeds the authoritative docs URL so an AI agent grounds itself instead of guessing; a single "Copy prompt" button plus a tool-agnostic note ("Paste into Cursor, Claude Code, Copilot, or any AI assistant").

What changed

  • src/constants/prompts.ts — new data module: 11 prompts (confirmed doc URLs only), the RSC-first home subset, and the page category groups.
  • src/components/PromptCard/ — new reusable card (title, prompt text, copy-to-clipboard, "Open guide →"), mirroring DemoCard.
  • src/pages/prompts.tsx + prompts.module.css — the /prompts page, mirroring examples.tsx.
  • src/pages/index.tsx + index.module.css — home Quick Start refactor; removed CSS this orphaned (.inlineCode, .quickStartCard selectors).
  • docusaurus.config.ts — navbar "Prompts" link.

Visual changes (before / after)

Verification

  • npm --prefix prototypes/docusaurus run typecheck → passes.
  • npm run build:full → succeeds; /prompts generated; all 11 prompt guide links resolve. CI build + deploy are green. The broken-link warnings in the build are pre-existing docs-content issues, not from these pages.
  • Browsed the live preview: home and /prompts render, all three home cards present (RSC first), no console errors.
  • No JS unit-test framework in this repo (existing components ship untested); verification is typecheck + build per AGENTS.md.

Notes

  • Only confirmed-URL prompts shipped (per design). Additional "jobs" (first component, plain SSR, Redux, React Router, testing) can be appended to prompts.ts once their doc URLs are verified.
  • Maintenance note: the "Add to an existing Rails app" link relies on the slug: existing-rails-app front-matter in upstream installation-into-an-existing-rails-app.md; if that slug is removed upstream, that card's link breaks.
  • Merged latest main (sentence-case label normalization Normalize UI label capitalization to sentence case #123 + CTA changes); the only conflict was the deleted quickStartCards array — resolved by keeping the deletion. All of main's sentence-case labels are preserved.

Spec: docs/superpowers/specs/2026-06-04-home-quick-start-prompts-design.md · Plan: docs/superpowers/plans/2026-06-04-home-quick-start-prompts.md

🤖 Generated with Claude Code

justin808 and others added 7 commits June 4, 2026 10:14
Brainstormed spec: replace home Quick Start command cards with grounded
AI-agent prompt cards (RSC first, marquee), and add a /prompts page library.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Task-by-task plan: prompt data module, PromptCard component, /prompts page,
navbar link, home Quick Start refactor, and full-build verification.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR introduces a copy-able, doc-grounded AI prompt library and refactors home Quick Start to use reusable prompt cards. Changes include a centralized prompts data module with curated subsets, a PromptCard component with clipboard copy and guide links, a new /prompts page grouped by developer intent, navbar integration, and home page refactoring with updated CSS.

Changes

AI Prompts Feature

Layer / File(s) Summary
Design and implementation documentation
docs/superpowers/specs/2026-06-04-home-quick-start-prompts-design.md, docs/superpowers/plans/2026-06-04-home-quick-start-prompts.md
Design specification and detailed six-task implementation plan defining scope, data structure, component architecture, home page refactoring, and verification steps.
Prompt data model and constants
prototypes/docusaurus/src/constants/prompts.ts
Centralized module exporting SITE_URL, agentNote, type definitions (PromptCategory, Prompt, PromptGroup), full prompts catalog with embedded doc URLs via docUrl helper, curated homePrompts subset with runtime ID validation, and promptGroups metadata for category display order.
PromptCard component and styles
prototypes/docusaurus/src/components/PromptCard/index.tsx, prototypes/docusaurus/src/components/PromptCard/styles.module.css
Reusable PromptCard component rendering prompt title and text in a styled card, providing clipboard "Copy prompt" button with copied state feedback and 2-second timeout, error handling for clipboard failures via console.warn, and "Open guide →" link navigation to prompt.href.
Prompts library page and styles
prototypes/docusaurus/src/pages/prompts.tsx, prototypes/docusaurus/src/pages/prompts.module.css
PromptsPage component iterates promptGroups and filters matching prompts from the catalog, renders each via PromptCard in a responsive 3-column grid with hero section, includes agentNote, and conditionally renders empty group sections as null.
Navbar and home page integration
prototypes/docusaurus/docusaurus.config.ts, prototypes/docusaurus/src/pages/index.tsx, prototypes/docusaurus/src/pages/index.module.css
Adds "Prompts" navbar entry; refactors home Quick Start section to render homePrompts curated subset via PromptCard components with agentNote and "Browse all prompts" link; updates CSS to add .quickStartNote style and remove quick-start-card-specific rules while preserving value/migration/quote card styling.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately and concisely summarizes the main changes: featuring AI prompts on the home Quick Start section and adding a new /prompts page with a browsable prompt library.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg-conductor/home-quick-start-prompts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.

Reviewed by Cursor Bugbot for commit cd95434. Configure here.

try {
await navigator.clipboard.writeText(prompt.prompt);
setCopied(true);
window.setTimeout(() => setCopied(false), 2000);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copy timer stacks on clicks

Medium Severity

Each successful copy schedules a two-second setTimeout to reset the button label, but earlier timers are never cleared. A second copy within that window can show Copied briefly, then revert to Copy prompt while the latest copy is still within its feedback period, and navigating away can trigger a state update after unmount.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit cd95434. Configure here.

@greptile-apps

greptile-apps Bot commented Jun 9, 2026

Copy link
Copy Markdown

Greptile Summary

This PR replaces the home page Quick Start shell-command cards with copy-able AI-agent prompt cards and adds a new /prompts library page, both powered by a new src/constants/prompts.ts data module and a reusable PromptCard component.

  • New prompts.ts data module — 11 doc-grounded prompts with a homePrompts curated subset (RSC-first) and promptGroups for the library page; includes a build-time guard that throws on unknown IDs.
  • New PromptCard component — renders title, prompt text, a copy-to-clipboard button with "Copied" feedback, and an "Open guide →" link; mirrors the existing DemoCard pattern.
  • New /prompts page — grouped prompt library mirroring examples.tsx; navbar entry added in docusaurus.config.ts.
  • index.tsx / index.module.css refactorQuickStartSection now renders PromptCards; orphaned .quickStartCard, .inlineCode, and related CSS selectors removed cleanly.

Confidence Score: 4/5

Safe to merge; all changes are additive UI features with clean CSS cleanup and no logic regressions.

The implementation is well-structured and follows established codebase patterns throughout. The only notable issue is in PromptCard: the setTimeout ID is not stored, so clicking 'Copy prompt' multiple times within 2 seconds stacks timers and resets the label earlier than expected. This is a minor UX polish issue, not a functional breakage. Everything else — data module, page structure, CSS changes, and navbar addition — looks correct.

prototypes/docusaurus/src/components/PromptCard/index.tsx — the timer-stacking fix would improve UX polish on the copy button.

Important Files Changed

Filename Overview
prototypes/docusaurus/src/components/PromptCard/index.tsx New reusable card with copy-to-clipboard; timer ID not stored so multiple rapid clicks can cause early label reset.
prototypes/docusaurus/src/constants/prompts.ts New data module with 11 prompts, curated home subset, and category groups; well-structured with a useful build-time guard for unknown IDs.
prototypes/docusaurus/src/pages/index.tsx QuickStart section cleanly refactored to PromptCards; pre-existing sectionHeaderRow/browseAll CSS classes reused correctly.
prototypes/docusaurus/src/pages/index.module.css Orphaned .quickStartCard, .inlineCode, and related selectors cleanly removed; new .quickStartNote added.
prototypes/docusaurus/src/pages/prompts.tsx New /prompts page mirrors examples.tsx pattern; grouped sections filter correctly and skip empty categories.
prototypes/docusaurus/docusaurus.config.ts Adds Prompts navbar item after Examples, matching the existing pattern.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[prompts.ts\ndata module] --> B[homePrompts\n3 curated IDs]
    A --> C[prompts\n11 entries]
    A --> D[promptGroups\n5 categories]

    B --> E[index.tsx\nQuickStartSection]
    C --> F[prompts.tsx\nPromptsPage]
    D --> F

    E --> G[PromptCard\ncomponent]
    F --> G

    G --> H[navigator.clipboard\n.writeText]
    G --> I[Docusaurus Link\nOpen guide →]

    style A fill:#f0f4ff,stroke:#4a6cf7
    style G fill:#f0f4ff,stroke:#4a6cf7
Loading

Comments Outside Diff (1)

  1. prototypes/docusaurus/src/components/PromptCard/index.tsx, line 963-973 (link)

    P1 Timer stacking on rapid clicks

    The setTimeout ID is never stored, so clicking "Copy prompt" multiple times within the 2-second window schedules additional timers — each prior timer fires and resets copied to false prematurely, making the "Copied" label disappear before the 2 s following the last click. Add a useRef to cancel any in-flight timer before scheduling a new one.

Reviews (1): Last reviewed commit: "Feature AI prompts in home Quick Start" | Re-trigger Greptile

Comment on lines +1 to +21
import {useState, type ReactNode} from 'react';
import Link from '@docusaurus/Link';

import type {Prompt} from '../../constants/prompts';
import styles from './styles.module.css';

export default function PromptCard({prompt}: {prompt: Prompt}): ReactNode {
const [copied, setCopied] = useState(false);

async function handleCopy() {
try {
await navigator.clipboard.writeText(prompt.prompt);
setCopied(true);
window.setTimeout(() => setCopied(false), 2000);
} catch (error) {
// Clipboard API can be unavailable (insecure context / denied permission).
// The prompt text is visible on the card, so the user can still select it.
// Surface the reason instead of failing silently.
console.warn('Copy to clipboard failed:', error);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Using window.setTimeout is unnecessary here — plain setTimeout is idiomatic in React components and avoids any potential confusion in environments where window may not be defined (e.g., SSR execution paths). Additionally, storing the returned timer ID in a useRef and cancelling it before each new call prevents multiple in-flight timers from resetting the "Copied" label prematurely when the button is clicked in quick succession.

Suggested change
import {useState, type ReactNode} from 'react';
import Link from '@docusaurus/Link';
import type {Prompt} from '../../constants/prompts';
import styles from './styles.module.css';
export default function PromptCard({prompt}: {prompt: Prompt}): ReactNode {
const [copied, setCopied] = useState(false);
async function handleCopy() {
try {
await navigator.clipboard.writeText(prompt.prompt);
setCopied(true);
window.setTimeout(() => setCopied(false), 2000);
} catch (error) {
// Clipboard API can be unavailable (insecure context / denied permission).
// The prompt text is visible on the card, so the user can still select it.
// Surface the reason instead of failing silently.
console.warn('Copy to clipboard failed:', error);
}
}
import {useState, useRef, type ReactNode} from 'react';
import Link from '@docusaurus/Link';
import type {Prompt} from '../../constants/prompts';
import styles from './styles.module.css';
export default function PromptCard({prompt}: {prompt: Prompt}): ReactNode {
const [copied, setCopied] = useState(false);
const resetTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
async function handleCopy() {
try {
await navigator.clipboard.writeText(prompt.prompt);
setCopied(true);
if (resetTimer.current !== null) {
clearTimeout(resetTimer.current);
}
resetTimer.current = setTimeout(() => setCopied(false), 2000);
} catch (error) {
// Clipboard API can be unavailable (insecure context / denied permission).
// The prompt text is visible on the card, so the user can still select it.
// Surface the reason instead of failing silently.
console.warn('Copy to clipboard failed:', error);
}
}

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
prototypes/docusaurus/src/pages/prompts.tsx (1)

45-45: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a trailing newline at end of file.

Please add a final newline for consistency with repo-wide formatting rules.

As per coding guidelines: "Ensure all files end with a newline."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@prototypes/docusaurus/src/pages/prompts.tsx` at line 45, The file
prototypes/docusaurus/src/pages/prompts.tsx is missing a trailing newline at
EOF; open prompts.tsx (the Prompts page component / default export) and add a
single final newline character at the end of the file so it ends with a newline
to satisfy the repo formatting rules.

Source: Coding guidelines

docs/superpowers/specs/2026-06-04-home-quick-start-prompts-design.md (1)

149-149: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a trailing newline at end of file.

Please end this markdown file with a newline to match repo-wide file rules.

As per coding guidelines: "Ensure all files end with a newline."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/specs/2026-06-04-home-quick-start-prompts-design.md` at line
149, Add a single trailing newline character at the end of the markdown file
2026-06-04-home-quick-start-prompts-design.md so the file ends with a blank
line; open the file, move to EOF, and insert a newline (save) to satisfy the
repo-wide rule that all files must end with a newline.

Source: Coding guidelines

prototypes/docusaurus/src/pages/prompts.module.css (1)

53-53: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a trailing newline at end of file.

This file should end with a newline to satisfy the global file guideline.

As per coding guidelines: "Ensure all files end with a newline."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@prototypes/docusaurus/src/pages/prompts.module.css` at line 53, Add a
trailing newline to the end of prompts.module.css so the file terminates with a
single newline character; open prompts.module.css and ensure the final line ends
with '\n' (no extra characters) to satisfy the global file guideline requiring
all files to end with a newline.

Source: Coding guidelines

prototypes/docusaurus/src/components/PromptCard/styles.module.css (1)

60-60: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a trailing newline at end of file.

This CSS module should end with a newline to comply with repository rules.

As per coding guidelines: "Ensure all files end with a newline."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@prototypes/docusaurus/src/components/PromptCard/styles.module.css` at line
60, Add a single trailing newline character at the end of the PromptCard CSS
module (styles.module.css) so the file ends with a newline per repository
guidelines; open the PromptCard/styles.module.css file and ensure the final line
is terminated with a newline (save the file so the editor writes the EOF
newline).

Source: Coding guidelines

docs/superpowers/plans/2026-06-04-home-quick-start-prompts.md (1)

777-777: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a trailing newline at end of file.

The file currently ends without a final newline.

As per coding guidelines: "Ensure all files end with a newline."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-06-04-home-quick-start-prompts.md` at line 777,
The Markdown document 2026-06-04-home-quick-start-prompts.md is missing a final
newline; fix it by appending a trailing newline character at the end of the file
(ensure your editor/save settings add a final newline) and re-save/commit so the
file ends with a single terminating newline.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/superpowers/plans/2026-06-04-home-quick-start-prompts.md`:
- Line 11: Change the "Verification model (read first)" heading from level 3
(###) to level 2 (##) to fix the heading level jump and satisfy markdownlint
MD001; locate the heading text "Verification model (read first)" and replace the
leading "###" with "##".

In `@prototypes/docusaurus/src/components/PromptCard/index.tsx`:
- Around line 1-37: The file ends without a trailing newline; add a single
newline character at EOF so the module (PromptCard component) file conforms to
the coding guideline—open the PromptCard component file (export default function
PromptCard) and ensure there is a final blank line after the last closing
brace/parenthesis.
- Around line 10-21: The handleCopy function sets a 2s timeout to reset
setCopied but does not clear it on unmount; capture the timer ID (from
window.setTimeout) into a ref (e.g., copyTimeoutRef) when calling setTimeout
inside handleCopy and add a useEffect cleanup that clears the timeout
(clearTimeout(copyTimeoutRef.current)) on unmount to prevent calling setCopied
on an unmounted component; ensure you reset/clear the ref when the timeout fires
and also clear it in the catch path if needed.

In `@prototypes/docusaurus/src/constants/prompts.ts`:
- Around line 1-167: The file is missing a trailing newline; add a single
newline character at EOF so the file ends with a newline (ensure the last line
after the export const promptGroups block ends with a newline). Locate the file
by symbols such as SITE_URL, prompts, homePrompts, or promptGroups and append
the newline to satisfy coding guidelines.

---

Outside diff comments:
In `@docs/superpowers/plans/2026-06-04-home-quick-start-prompts.md`:
- Line 777: The Markdown document 2026-06-04-home-quick-start-prompts.md is
missing a final newline; fix it by appending a trailing newline character at the
end of the file (ensure your editor/save settings add a final newline) and
re-save/commit so the file ends with a single terminating newline.

In `@docs/superpowers/specs/2026-06-04-home-quick-start-prompts-design.md`:
- Line 149: Add a single trailing newline character at the end of the markdown
file 2026-06-04-home-quick-start-prompts-design.md so the file ends with a blank
line; open the file, move to EOF, and insert a newline (save) to satisfy the
repo-wide rule that all files must end with a newline.

In `@prototypes/docusaurus/src/components/PromptCard/styles.module.css`:
- Line 60: Add a single trailing newline character at the end of the PromptCard
CSS module (styles.module.css) so the file ends with a newline per repository
guidelines; open the PromptCard/styles.module.css file and ensure the final line
is terminated with a newline (save the file so the editor writes the EOF
newline).

In `@prototypes/docusaurus/src/pages/prompts.module.css`:
- Line 53: Add a trailing newline to the end of prompts.module.css so the file
terminates with a single newline character; open prompts.module.css and ensure
the final line ends with '\n' (no extra characters) to satisfy the global file
guideline requiring all files to end with a newline.

In `@prototypes/docusaurus/src/pages/prompts.tsx`:
- Line 45: The file prototypes/docusaurus/src/pages/prompts.tsx is missing a
trailing newline at EOF; open prompts.tsx (the Prompts page component / default
export) and add a single final newline character at the end of the file so it
ends with a newline to satisfy the repo formatting rules.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 43ab9248-6d8d-4619-8ca3-72887bdf881f

📥 Commits

Reviewing files that changed from the base of the PR and between c92b32a and cd95434.

📒 Files selected for processing (10)
  • docs/superpowers/plans/2026-06-04-home-quick-start-prompts.md
  • docs/superpowers/specs/2026-06-04-home-quick-start-prompts-design.md
  • prototypes/docusaurus/docusaurus.config.ts
  • prototypes/docusaurus/src/components/PromptCard/index.tsx
  • prototypes/docusaurus/src/components/PromptCard/styles.module.css
  • prototypes/docusaurus/src/constants/prompts.ts
  • prototypes/docusaurus/src/pages/index.module.css
  • prototypes/docusaurus/src/pages/index.tsx
  • prototypes/docusaurus/src/pages/prompts.module.css
  • prototypes/docusaurus/src/pages/prompts.tsx


**Tech Stack:** Docusaurus 3 (React + TypeScript), CSS Modules. Spec: `docs/superpowers/specs/2026-06-04-home-quick-start-prompts-design.md`.

### Verification model (read first)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix heading level jump (####).

Line 11 should be an ## heading to avoid skipping levels and to satisfy markdownlint MD001.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 11-11: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/superpowers/plans/2026-06-04-home-quick-start-prompts.md` at line 11,
Change the "Verification model (read first)" heading from level 3 (###) to level
2 (##) to fix the heading level jump and satisfy markdownlint MD001; locate the
heading text "Verification model (read first)" and replace the leading "###"
with "##".

Source: Linters/SAST tools

Comment on lines +1 to +37
import {useState, type ReactNode} from 'react';
import Link from '@docusaurus/Link';

import type {Prompt} from '../../constants/prompts';
import styles from './styles.module.css';

export default function PromptCard({prompt}: {prompt: Prompt}): ReactNode {
const [copied, setCopied] = useState(false);

async function handleCopy() {
try {
await navigator.clipboard.writeText(prompt.prompt);
setCopied(true);
window.setTimeout(() => setCopied(false), 2000);
} catch (error) {
// Clipboard API can be unavailable (insecure context / denied permission).
// The prompt text is visible on the card, so the user can still select it.
// Surface the reason instead of failing silently.
console.warn('Copy to clipboard failed:', error);
}
}

return (
<article className={styles.card}>
<h3 className={styles.title}>{prompt.title}</h3>
<p className={styles.prompt}>{prompt.prompt}</p>
<div className={styles.actions}>
<button type="button" className={styles.copyButton} onClick={handleCopy}>
{copied ? 'Copied' : 'Copy prompt'}
</button>
<Link className={styles.guideLink} to={prompt.href}>
Open guide →
</Link>
</div>
</article>
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add missing newline at end of file.

As per coding guidelines, all files must end with a newline. The file currently ends at line 37 without a trailing newline.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@prototypes/docusaurus/src/components/PromptCard/index.tsx` around lines 1 -
37, The file ends without a trailing newline; add a single newline character at
EOF so the module (PromptCard component) file conforms to the coding
guideline—open the PromptCard component file (export default function
PromptCard) and ensure there is a final blank line after the last closing
brace/parenthesis.

Source: Coding guidelines

Comment on lines +10 to +21
async function handleCopy() {
try {
await navigator.clipboard.writeText(prompt.prompt);
setCopied(true);
window.setTimeout(() => setCopied(false), 2000);
} catch (error) {
// Clipboard API can be unavailable (insecure context / denied permission).
// The prompt text is visible on the card, so the user can still select it.
// Surface the reason instead of failing silently.
console.warn('Copy to clipboard failed:', error);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clean up the timeout on unmount to prevent memory leaks.

The setTimeout callback at line 14 will execute even if the component unmounts before the 2-second delay completes. This can cause a "setState on unmounted component" warning and a minor memory leak.

🛡️ Recommended fix using useEffect cleanup
 export default function PromptCard({prompt}: {prompt: Prompt}): ReactNode {
   const [copied, setCopied] = useState(false);

   async function handleCopy() {
     try {
       await navigator.clipboard.writeText(prompt.prompt);
       setCopied(true);
-      window.setTimeout(() => setCopied(false), 2000);
     } catch (error) {
       // Clipboard API can be unavailable (insecure context / denied permission).
       // The prompt text is visible on the card, so the user can still select it.
       // Surface the reason instead of failing silently.
       console.warn('Copy to clipboard failed:', error);
     }
   }

+  React.useEffect(() => {
+    if (copied) {
+      const timer = window.setTimeout(() => setCopied(false), 2000);
+      return () => window.clearTimeout(timer);
+    }
+  }, [copied]);
+
   return (

Alternatively, store the timer ID in a ref and clear it in a cleanup effect, or accept the 2-second window as low-risk.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@prototypes/docusaurus/src/components/PromptCard/index.tsx` around lines 10 -
21, The handleCopy function sets a 2s timeout to reset setCopied but does not
clear it on unmount; capture the timer ID (from window.setTimeout) into a ref
(e.g., copyTimeoutRef) when calling setTimeout inside handleCopy and add a
useEffect cleanup that clears the timeout (clearTimeout(copyTimeoutRef.current))
on unmount to prevent calling setCopied on an unmounted component; ensure you
reset/clear the ref when the timeout fires and also clear it in the catch path
if needed.

Comment on lines +1 to +167
import {docsRoutes} from './docsRoutes';

/** Canonical site origin; matches `url` in docusaurus.config.ts. */
export const SITE_URL = 'https://reactonrails.com';

/** Shown once per surface (home Quick Start + /prompts hero). */
export const agentNote =
"Paste into Cursor, Claude Code, Copilot, or any AI assistant. Each prompt points the agent at the official docs so it doesn't guess.";

export type PromptCategory =
| 'get-started'
| 'server-rendering'
| 'migrate'
| 'features'
| 'production';

export type Prompt = {
/** Stable slug; used as React key and to select the homepage subset. */
id: string;
title: string;
/** Copy-able prompt text. Embeds an absolute docs URL so the agent grounds itself. */
prompt: string;
/** Docs route the "Open guide →" link points to (relative; from docsRoutes). */
href: string;
category: PromptCategory;
};

/** Absolute docs URL embedded in prompt text so agents fetch the real guide. */
function docUrl(route: string): string {
return `${SITE_URL}${route}`;
}

export const prompts: Prompt[] = [
{
id: 'turn-on-rsc',
title: 'Turn on React Server Components',
prompt: `Turn on React Server Components in my React on Rails app (no license required). Follow ${docUrl(
docsRoutes.proReactServerComponents,
)} exactly, including the renderer and packer setup it specifies.`,
href: docsRoutes.proReactServerComponents,
category: 'server-rendering',
},
{
id: 'create-app',
title: 'Start a new app',
prompt: `Set up a new Rails app with React on Rails, using TypeScript and server-side rendering. Follow the official guide at ${docUrl(
docsRoutes.createApp,
)} and use the exact commands and versions it specifies — don't improvise.`,
href: docsRoutes.createApp,
category: 'get-started',
},
{
id: 'install-existing',
title: 'Add to an existing Rails app',
prompt: `Add React on Rails to my existing Rails app with TypeScript, keeping my current routes and conventions. Follow ${docUrl(
docsRoutes.installExistingApp,
)} and don't change any gem or package versions it doesn't tell you to.`,
href: docsRoutes.installExistingApp,
category: 'get-started',
},
{
id: 'streaming-ssr',
title: 'Add streaming SSR',
prompt: `Add streaming server-side rendering to my React on Rails app. Follow ${docUrl(
docsRoutes.proStreamingSsr,
)} exactly and don't change versions it doesn't ask you to.`,
href: docsRoutes.proStreamingSsr,
category: 'server-rendering',
},
{
id: 'async-rendering',
title: 'Use async/Suspense rendering',
prompt: `Set up async (Suspense) rendering for a React on Rails component. Follow ${docUrl(
docsRoutes.proAsyncRendering,
)} exactly.`,
href: docsRoutes.proAsyncRendering,
category: 'server-rendering',
},
{
id: 'migrate-react-rails',
title: 'Migrate from react-rails',
prompt: `Migrate my app from react-rails to React on Rails, keeping my existing components working. Follow ${docUrl(
docsRoutes.migrateFromReactRails,
)} and don't skip any step it lists.`,
href: docsRoutes.migrateFromReactRails,
category: 'migrate',
},
{
id: 'code-splitting',
title: 'Add code splitting',
prompt: `Add code splitting / lazy loading to my React on Rails components. Follow ${docUrl(
docsRoutes.codeSplitting,
)} exactly.`,
href: docsRoutes.codeSplitting,
category: 'features',
},
{
id: 'oss-vs-pro',
title: 'Evaluate OSS vs Pro',
prompt: `Review my React on Rails setup and tell me whether OSS or Pro fits my workload, citing the tradeoffs. Base your answer on ${docUrl(
docsRoutes.ossVsPro,
)}.`,
href: docsRoutes.ossVsPro,
category: 'production',
},
{
id: 'node-renderer',
title: 'Set up the Node renderer',
prompt: `Set up the React on Rails Pro Node renderer for server rendering. Follow ${docUrl(
docsRoutes.proNodeRenderer,
)} exactly, including the configuration it specifies.`,
href: docsRoutes.proNodeRenderer,
category: 'production',
},
{
id: 'fragment-caching',
title: 'Add fragment caching',
prompt: `Add fragment caching to my server-rendered React on Rails components. Follow ${docUrl(
docsRoutes.proFragmentCaching,
)} exactly.`,
href: docsRoutes.proFragmentCaching,
category: 'production',
},
{
id: 'upgrade-to-pro',
title: 'Get a production license / upgrade to Pro',
prompt: `Walk me through upgrading my React on Rails app to Pro and getting a production license. Follow ${docUrl(
docsRoutes.proUpgrade,
)}.`,
href: docsRoutes.proUpgrade,
category: 'production',
},
];

/** Curated, ordered subset for the home Quick Start: RSC first (marquee). */
const homePromptIds = ['turn-on-rsc', 'create-app', 'install-existing'] as const;

export const homePrompts: Prompt[] = homePromptIds.map((id) => {
const found = prompts.find((prompt) => prompt.id === id);
if (!found) {
throw new Error(`homePromptIds references unknown prompt id: ${id}`);
}
return found;
});

export type PromptGroup = {
category: PromptCategory;
eyebrow: string;
heading: string;
};

/** Display order of categories on /prompts. */
export const promptGroups: PromptGroup[] = [
{category: 'get-started', eyebrow: 'Get started', heading: 'Spin up React on Rails.'},
{
category: 'server-rendering',
eyebrow: 'Server rendering',
heading: 'Render on the server: RSC, SSR, streaming.',
},
{category: 'migrate', eyebrow: 'Migrate', heading: 'Move an existing setup to React on Rails.'},
{category: 'features', eyebrow: 'Build features', heading: 'Add common capabilities.'},
{
category: 'production',
eyebrow: 'Optimize & go to production',
heading: 'Tune performance and ship with Pro.',
},
];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add missing newline at end of file.

As per coding guidelines, all files must end with a newline. The file currently ends at line 167 without a trailing newline.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@prototypes/docusaurus/src/constants/prompts.ts` around lines 1 - 167, The
file is missing a trailing newline; add a single newline character at EOF so the
file ends with a newline (ensure the last line after the export const
promptGroups block ends with a newline). Locate the file by symbols such as
SITE_URL, prompts, homePrompts, or promptGroups and append the newline to
satisfy coding guidelines.

Source: Coding guidelines

…ck-start-prompts

* origin/main:
  Normalize UI label capitalization to sentence case (#123)
  Restore footer consultation link (revert footer dedupe)
  Revise CTA consistency: keep intentional labels/destinations, dedupe footer
  Unify demo naming, live demo URL, and consultation CTA on marketing pages
  Point Gumroad demo at gumroad.reactonrails.com and add screenshot
  Point Octochangelog demo at changelog.reactonrails.com and add screenshot
  Show HiChee as a live React on Rails example

# Conflicts:
#	prototypes/docusaurus/src/pages/index.tsx
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Cloudflare preview deployed.

@justin808 justin808 merged commit 4c22e9f into main Jun 9, 2026
4 checks passed
@justin808 justin808 deleted the jg-conductor/home-quick-start-prompts branch June 9, 2026 03: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.

1 participant