Skip to content

Commit ef60234

Browse files
zebbernCopilot
andcommitted
fix: restrict Astro template selection to explicit requests + tsconfig mismatch guard
- Template selection now requires explicit 'Astro' mention (rule 6 narrowed) - Added IMPORTANT default guidance: when in doubt use Vite Shadcn - Rule 10 expanded: forms, contact pages, interactive UIs → Vite Shadcn - Rule 11 expanded: calculators, todo apps, CRUD apps → Vite Shadcn - Added TSCONFIG CONSISTENCY section to system prompt - Prevents framework mismatch: React code + Astro tsconfig = build failure Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d85d05e commit ef60234

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

app/lib/common/prompts/new-prompt.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,11 @@ export const getFineTunedPrompt = (
539539
- Template package.json has critical peer deps (@radix-ui/*, class-variance-authority, clsx, tailwind-merge, etc.). Omitting any causes cascading build failures.
540540
- REVERSE CHECK: Also scan for imports that are NOT used in the file. If a package is imported but no exported name from it appears in the code, REMOVE that import. Clean code has zero unused imports.
541541
542+
TSCONFIG CONSISTENCY (CRITICAL — FRAMEWORK MISMATCH ERRORS):
543+
- If you are writing React code, tsconfig.json MUST use "jsx": "react-jsx" and MUST NOT extend "astro/tsconfigs/strict" or any Astro config.
544+
- If the template's tsconfig.json has "extends": "astro/tsconfigs/strict" but you are building a React project, you MUST rewrite tsconfig.json with a React-compatible config.
545+
- SELF-CHECK: Does tsconfig.json match the framework you're using? React needs "react-jsx", Vue needs vue-tsc, Svelte needs @tsconfig/svelte.
546+
542547
FOLLOW-UP RESPONSE DISCIPLINE (CRITICAL):
543548
- When the user asks to fix SPECIFIC files, ONLY modify those files — no unnecessary config rewrites.
544549
- Do NOT re-create package.json, tsconfig, vite.config, tailwind.config, utility files, or seed data unless asked.

app/utils/selectStarterTemplate.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,18 +256,20 @@ const starterTemplateSelectionPrompt = (
256256
showcaseTemplates: PromptTemplate[] = [],
257257
) => `You pick the best starter template for a user's project. Respond ONLY with the XML selection — no explanation.
258258
259+
IMPORTANT: When in doubt, default to "Vite Shadcn". Most web projects (forms, apps, dashboards, UIs) should use React via Vite Shadcn. Only use Astro if the user EXPLICITLY says "Astro" or asks for a multi-page static content site with NO interactivity (pure blog, docs site with markdown).
260+
259261
Decision rules (in priority order):
260262
1. If the user explicitly names a framework (Vue, Svelte, Angular, SolidJS, Qwik, Remix, Astro, Expo), use that framework's template — this overrides rules 2-13.
261263
2. Trivial tasks (scripts, algorithms, CLI tools, API-only, no UI) → blank
262264
3. Game, canvas, WebGL, 3D (three.js), or animation-heavy → Vite React (lighter, no UI overhead)
263265
4. Presentation or slides → Slidev
264266
5. Mobile app (iOS, Android, React Native, cross-platform) → Expo App
265-
6. Static site, blog, or documentation → Basic Astro
267+
6. Static content-only site (blog with markdown, documentation site, no interactive UI) AND user explicitly says "Astro" → Basic Astro
266268
7. Vanilla/plain JavaScript (no framework) → Vanilla Vite
267269
8. TypeScript-only project (no UI framework) → Vite Typescript
268270
9. Fullstack React with SSR or API routes → NextJS Shadcn
269-
10. Specific site type (portfolio, dashboard, SaaS, e-commerce, landing page) → matching showcase template if available, otherwise Vite Shadcn
270-
11. Any other web project → Vite Shadcn as default
271+
10. Specific site type (portfolio, dashboard, SaaS, e-commerce, landing page, form, contact page) → matching showcase template if available, otherwise Vite Shadcn
272+
11. Any other web project (including forms, calculators, todo apps, CRUD apps, interactive UIs) → Vite Shadcn as default
271273
272274
Starter templates:
273275
<template><name>blank</name><description>Empty starter for simple scripts</description><tags>basic, script</tags></template>

0 commit comments

Comments
 (0)