// docs / ai fix prompts
AI improvement prompts
Every finding has a Copy prompt button beneath the remediation. Click it, paste into Claude / Cursor / Copilot, and the agent gets the canonical improvement recipe for that website-quality issue — no Claude API call from us.
Come funziona
Al clic si combinano due pezzi di dati:
- La segnalazione: titolo, descrizione, evidenza, remediation, CWE, già caricati con il report.
- Il framework del tuo codebase: rilevato dalle segnalazioni
discovery.tech-fingerprintdella scansione (Next.js, React, Vue, Django, Express, Rails, Laravel, Flask). Se non viene rilevato alcun framework, si usa una ricetta generica (il prompt dell'agente chiede poi al LLM di rilevarlo dallo stato del repo).
Templates live in lib/scanner/fix-prompts.ts. The registry has check-specific guidance for crawlability, search presentation, semantic content, structured data, media, performance, accessibility, forms, mobile/i18n, runtime, owner journeys, and repo-quality issues. For everything else, the existing remediation field on the finding becomes the generic recipe.
Com'è fatto il prompt
Fix the "Hero image is lazy-loaded and missing dimensions" finding on /pricing. Issue: The largest above-the-fold image is marked loading="lazy" and has no explicit width/height. That can delay LCP and create layout shift. Codebase context: Next.js. Recommended fix: Use next/image or the existing image component with explicit width/height, responsive sizes, meaningful alt text, and priority/fetchPriority for the first major visual on the page. Constraints: - Don't break existing tests; run the test suite after the change. - Match the codebase's existing style and lint config. - Add a brief comment explaining the performance reasoning only where the fix would otherwise look arbitrary. - If the fix needs a new dependency, install it via the project's package manager (npm / pnpm / pip / bundle / composer). Reference: Core Web Vitals / Largest Contentful Paint guidance.
Framework supportati
Mostriamo snippet specifici per framework per:
- Next.js, React, Vue, Nuxt, Svelte (frontend)
- Express, Fastify (backend Node.js)
- Django, Flask (Python)
- Ruby on Rails
- Laravel (PHP)
- ASP.NET Core (pianificato, oggi fallback generico)
Il rilevamento del framework è best-effort. Annusiamo tag __NEXT_DATA__, __NUXT__, cookie hash (laravel_session), header X-Powered-By e qualche altro segnale. Se usi un framework custom, il prompt torna alla ricetta generica e l'agente lo capisce dal tuo package.json.
Usalo dal tuo agente AI
Se hai collegato il server MCP, lo stesso prompt è esposto come comando slash. Da Claude Desktop:
/fixweb-fix finding_id=550e8400-e29b-41d4-a716-446655440000
The renderer looks up the finding, detects the framework from the parent scan when available, renders the templated prompt, and injects it into your conversation as the user message. No round-trip to our Claude API; templates are pure and free.
Perché non chiamiamo Claude a ogni clic
Al lancio abbiamo considerato di chiamare la Anthropic API a ogni clic per rifinire il prompt con il contesto del codebase. Non l'abbiamo fatto, perché:
- L'agente in cui l'utente incolla il prompt ha già il contesto del codebase: sta usando Cursor / Claude Desktop con il repo aperto.
- I template per coppia (check × framework) coprono ~80% del valore senza alcun costo per clic.
- Un opt-in “Rifinisci con AI per il mio codebase” potrebbe chiamare l'API più avanti se gli utenti lo vogliono. Oggi no.
