Skip to content

instant: build fix-card Copy AI prompt dynamically from title + link#94637

Open
aurorascharff wants to merge 1 commit into
canaryfrom
aurorascharff/dynamic-fix-prompts
Open

instant: build fix-card Copy AI prompt dynamically from title + link#94637
aurorascharff wants to merge 1 commit into
canaryfrom
aurorascharff/dynamic-fix-prompts

Conversation

@aurorascharff

@aurorascharff aurorascharff commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

What

Every fix card (dev overlay + docs pages) used to ship a multi-paragraph prompt string copied verbatim to the agent. This PR builds the prompt at click time from title + link so 71 prompt strings (36 docs MDX + 35 runtime) are deleted from source.

The template:

Before applying this fix:

1. Read the actual Next.js error in the dev overlay (or browser/terminal console) to identify the failing file, line, and component. Match the fix to that component — don't patch unrelated files.

2. Read the full context for this rule at <rule-url>, then read the specific fix section at <fix-url>. The fix section names the exact code shape, every constraint, and the imports allowed. Follow it exactly — don't improvise.

Apply the "<title>" fix.

Why

Old prompts repeated what the docs already say and never told the agent to read the dev overlay first. The new template always points at the docs (rule + fix anchor) and grounds the fix in the real error.

Changes

  • FixCard type: prompt?: stringcopyable?: boolean
  • CopyPromptButton: takes title + link, builds the prompt
  • 14 error MDX pages: every prompt={...} removed (36 strings)
  • instant-guidance-data.ts: every prompt: '...'copyable: true (35 strings)
  • Skill (.agents/skills/insight-error-page/SKILL.md): updated

Pairs with

vercel/front#73087 — same template in the docs-site <FixOption>.

The dev-overlay fix cards used to ship a multi-paragraph `prompt` string
per card that the user copied to their agent verbatim. Same for the
public docs pages, where each `<FixOption>` carried a matching `prompt={...}`
attribute (36 prompts across 14 pages).

Two problems with the verbatim approach:

1. The prompt repeats what the docs page already says — the agent receives
   either a long instruction OR a link to the docs that explains the same
   fix, but not both stitched together.
2. The agent has no obvious instruction to read the actual error in the
   dev overlay before applying the fix, so it can patch the wrong file.

This change collapses every prompt into a single template that the copy
button constructs at click time from `title + link`. The template:

- tells the agent to read the dev overlay (or browser/terminal console)
  to identify the failing file/line/component
- points at the rule docs URL AND the specific fix anchor URL
- names the fix to apply

No per-card prompt text anywhere. The runtime card type loses its
`prompt` field in favor of `copyable: boolean`. The `<FixOption>`
MDX component loses its `prompt` prop entirely (docs site PR ships the
matching component change).

Result: 71 prompt strings deleted from source (36 docs + 35 runtime),
one template lives in two render sites (dev overlay + docs page), both
emit identical output for the same fix.
Copilot AI review requested due to automatic review settings June 10, 2026 08:48
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Failing test suites

Commit: 0fb10a0 | About building and testing Next.js

pnpm test-start test/production/app-dir/metadata-static-route-cache/metadata-static-route-cache.test.ts (job)

  • app dir - metadata static routes cache > should generate different content after replace the static metadata file (DD)
Expand output

● app dir - metadata static routes cache › should generate different content after replace the static metadata file

next already started

  65 |   ) {
  66 |     if (this.childProcess) {
> 67 |       throw new Error('next already started')
     |             ^
  68 |     }
  69 |
  70 |     this._cliOutput = ''

  at NextStartInstance.start (lib/next-modes/next-start.ts:67:13)
  at Object.start (production/app-dir/metadata-static-route-cache/metadata-static-route-cache.test.ts:17:16)

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Stats cancelled

Commit: 0fb10a0
View workflow run

Copilot AI 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.

Pull request overview

This PR removes hard-coded multi-paragraph “Copy AI prompt” strings from fix cards and replaces them with a single standardized prompt template that is generated from the fix card title + docs link. This keeps the agent workflow consistently anchored to the canonical docs page while also explicitly instructing the agent to first inspect the real dev overlay error context.

Changes:

  • Replaced FixCard.prompt?: string with FixCard.copyable?: boolean, and updated the dev overlay to generate the copy prompt from title + link.
  • Updated instant-guidance-data.ts to mark relevant cards as copyable: true (removing the duplicated prompt strings).
  • Removed prompt={...} props from the affected errors/*.mdx pages and updated the authoring skill doc accordingly.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance.tsx Generates the copied AI prompt from title + link and gates the copy button via copyable.
packages/next/src/next-devtools/dev-overlay/components/instant/instant-guidance-data.ts Updates the FixCard type and replaces embedded prompt strings with copyable: true.
errors/instant-unrendered-segment.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-viewport-runtime.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-viewport-dynamic.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-runtime.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-random.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-random-client.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-metadata-runtime.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-metadata-dynamic.mdx Removes prompt props from <FixOption> entries (and collapses one <FixOption> tag to a single line).
errors/blocking-prerender-dynamic.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-current-time.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-current-time-client.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-crypto.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-crypto-client.mdx Removes prompt props from <FixOption> entries.
errors/blocking-prerender-client-hook.mdx Removes prompt props from <FixOption> entries.
.agents/skills/insight-error-page/SKILL.md Updates authoring guidance to reflect that prompts are generated dynamically and the page is the source of truth.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants