@strayl/agent 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +20 -5
- package/package.json +27 -27
- package/skills/api-creation/SKILL.md +631 -631
- package/skills/authentication/SKILL.md +294 -294
- package/skills/frontend-design/SKILL.md +108 -108
- package/skills/landing-creation/SKILL.md +125 -125
- package/skills/reference/SKILL.md +149 -149
- package/skills/web-application-creation/SKILL.md +231 -231
|
@@ -1,231 +1,231 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: web-application-creation
|
|
3
|
-
description: Initialize a new web application from the Strayl template using npx create-strayl-app. Handles project scaffolding, dependency installation, and dev server startup. Use when the user wants a full-featured app with multiple routes, forms, auth, database, or any complex logic.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Web Application Creation
|
|
7
|
-
|
|
8
|
-
## When to Use
|
|
9
|
-
|
|
10
|
-
- User asks to create, start, or scaffold a new web application
|
|
11
|
-
- User wants to build a new project from scratch
|
|
12
|
-
- The workspace repository is empty and needs a project initialized
|
|
13
|
-
- User says "create an app", "start a new project", "build me an app"
|
|
14
|
-
- User needs multiple routes, forms, auth, database, dashboards, CRUD
|
|
15
|
-
|
|
16
|
-
## When NOT to Use (use `landing-creation` instead)
|
|
17
|
-
|
|
18
|
-
- User wants a single-page landing, marketing page, or promotional site
|
|
19
|
-
- User says "make me a website", "create a homepage", "build a landing page"
|
|
20
|
-
- User's request implies a simple static site without complex backend logic
|
|
21
|
-
|
|
22
|
-
## Workflow
|
|
23
|
-
|
|
24
|
-
1. **Ask the user for the app name** before running any commands. The name will be used as the project directory name.
|
|
25
|
-
2. **Run the scaffolding command** in the repository root:
|
|
26
|
-
```
|
|
27
|
-
npx -y create-strayl-app@latest --name {app-name}
|
|
28
|
-
```
|
|
29
|
-
3. **Install dependencies:**
|
|
30
|
-
```
|
|
31
|
-
cd {app-name} && npm install
|
|
32
|
-
```
|
|
33
|
-
4. **Start the dev server** in background mode:
|
|
34
|
-
```
|
|
35
|
-
cd {app-name} && npm run dev
|
|
36
|
-
```
|
|
37
|
-
5. **Check logs** to confirm the server started successfully (look for "ready" or "listening on port 3000").
|
|
38
|
-
6. **Show preview** to the user with `showPreview`.
|
|
39
|
-
7. **Continue building** based on user's request. Common next steps:
|
|
40
|
-
- Need user accounts? → Read `/skills/authentication/SKILL.md`
|
|
41
|
-
- Need a database? → Read `/skills/database-management/SKILL.md`
|
|
42
|
-
- Need API endpoints / server logic? → Read `/skills/api-creation/SKILL.md`
|
|
43
|
-
- Need UI/UX design, styling, or visual polish? → Read `/skills/frontend-design/SKILL.md`
|
|
44
|
-
|
|
45
|
-
## Template Stack
|
|
46
|
-
|
|
47
|
-
| Layer | Technology | Version |
|
|
48
|
-
|-------|------------|---------|
|
|
49
|
-
| Framework | React + TanStack Start | React 19, Start 1.x |
|
|
50
|
-
| Bundler | Vite | 7.x |
|
|
51
|
-
| Language | TypeScript (strict) | 5.7+ |
|
|
52
|
-
| Routing | TanStack Router (file-based) | 1.x |
|
|
53
|
-
| Styling | Tailwind CSS + CSS custom properties | 4.x |
|
|
54
|
-
| UI Components | shadcn/ui (install as needed) | latest |
|
|
55
|
-
| Icons | Lucide React | 0.475+ |
|
|
56
|
-
| Theming | next-themes (light/dark + system) | 0.4.x |
|
|
57
|
-
| Font | Geist (fontsource) | — |
|
|
58
|
-
| Server | Nitro (SSR + server functions) | nightly |
|
|
59
|
-
|
|
60
|
-
## Project Structure
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
{app-name}/
|
|
64
|
-
├── public/
|
|
65
|
-
│ └── favicon.ico
|
|
66
|
-
├── src/
|
|
67
|
-
│ ├── components/
|
|
68
|
-
│ │ ├── theme-provider.tsx # next-themes wrapper
|
|
69
|
-
│ │ └── ui/ # Minimal starter components (button, input, label, textarea)
|
|
70
|
-
│ ├── hooks/
|
|
71
|
-
│ │ └── use-mobile.ts # useIsMobile() — viewport < 768px
|
|
72
|
-
│ ├── lib/
|
|
73
|
-
│ │ └── utils.ts # cn() — clsx + tailwind-merge
|
|
74
|
-
│ ├── routes/
|
|
75
|
-
│ │ ├── __root.tsx # Root layout (HTML shell, Geist font, ThemeProvider)
|
|
76
|
-
│ │ ├── index.tsx # Home page ("STRAYL" + theme toggle)
|
|
77
|
-
│ │ └── routeTree.gen.ts # Auto-generated route tree (DO NOT EDIT)
|
|
78
|
-
│ ├── router.tsx # Router config (empty context, scroll restoration)
|
|
79
|
-
│ └── styles.css # Tailwind 4 theme (colors, fonts, radius)
|
|
80
|
-
├── components.json # shadcn/ui config (style: new-york)
|
|
81
|
-
├── package.json
|
|
82
|
-
├── tsconfig.json
|
|
83
|
-
└── vite.config.ts # Vite + Nitro + TanStack Start + Tailwind plugins
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Critical Files — Know Before Editing
|
|
87
|
-
|
|
88
|
-
### `src/routes/__root.tsx` — App Shell
|
|
89
|
-
|
|
90
|
-
Uses `shellComponent` (NOT `component`) to define the HTML document structure:
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'
|
|
94
|
-
import '@fontsource-variable/geist'
|
|
95
|
-
import { ThemeProvider } from '../components/theme-provider'
|
|
96
|
-
import appCss from '../styles.css?url'
|
|
97
|
-
|
|
98
|
-
export const Route = createRootRoute({
|
|
99
|
-
head: () => ({
|
|
100
|
-
meta: [
|
|
101
|
-
{ charSet: 'utf-8' },
|
|
102
|
-
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
103
|
-
{ title: 'Strayl' },
|
|
104
|
-
],
|
|
105
|
-
links: [
|
|
106
|
-
{ rel: 'stylesheet', href: appCss },
|
|
107
|
-
{ rel: 'icon', href: '/favicon.ico' },
|
|
108
|
-
],
|
|
109
|
-
}),
|
|
110
|
-
shellComponent: RootDocument,
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
function RootDocument({ children }: { children: React.ReactNode }) {
|
|
114
|
-
return (
|
|
115
|
-
<html lang="en" suppressHydrationWarning>
|
|
116
|
-
<head><HeadContent /></head>
|
|
117
|
-
<body>
|
|
118
|
-
<ThemeProvider>{children}</ThemeProvider>
|
|
119
|
-
<Scripts />
|
|
120
|
-
</body>
|
|
121
|
-
</html>
|
|
122
|
-
)
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
**To add auth context**, add `beforeLoad` — it works alongside `shellComponent`:
|
|
127
|
-
```typescript
|
|
128
|
-
export const Route = createRootRoute({
|
|
129
|
-
beforeLoad: async () => {
|
|
130
|
-
const user = await getUser();
|
|
131
|
-
return { user };
|
|
132
|
-
},
|
|
133
|
-
head: () => ({ ... }),
|
|
134
|
-
shellComponent: RootDocument,
|
|
135
|
-
})
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### `src/router.tsx` — Router Instance
|
|
139
|
-
|
|
140
|
-
```typescript
|
|
141
|
-
export const getRouter = () => {
|
|
142
|
-
const router = createRouter({
|
|
143
|
-
routeTree,
|
|
144
|
-
context: {}, // ← empty by default; auth adds user here
|
|
145
|
-
scrollRestoration: true,
|
|
146
|
-
defaultPreloadStaleTime: 0,
|
|
147
|
-
})
|
|
148
|
-
return router
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### `vite.config.ts` — Plugin Order Matters
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
plugins: [
|
|
156
|
-
nitro(), // SSR / server functions
|
|
157
|
-
viteTsConfigPaths(), // @/* path aliases
|
|
158
|
-
tailwindcss(), // Tailwind CSS 4
|
|
159
|
-
tanstackStart(), // TanStack Start framework
|
|
160
|
-
viteReact(), // React Fast Refresh
|
|
161
|
-
]
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
**Do NOT rewrite this file.** Use `edit_file` to add plugins if needed.
|
|
165
|
-
|
|
166
|
-
### `src/styles.css` — Tailwind CSS 4 Theme
|
|
167
|
-
|
|
168
|
-
Uses `@theme inline {}` directive (NOT `tailwind.config.js`):
|
|
169
|
-
|
|
170
|
-
```css
|
|
171
|
-
@import "tailwindcss";
|
|
172
|
-
@import "tw-animate-css";
|
|
173
|
-
|
|
174
|
-
@custom-variant dark (&:is(.dark *));
|
|
175
|
-
@variant dark (&:where(.dark, .dark *));
|
|
176
|
-
|
|
177
|
-
@theme inline {
|
|
178
|
-
--color-background: var(--background);
|
|
179
|
-
--color-primary: var(--primary);
|
|
180
|
-
--font-sans: "Geist Variable", ui-sans-serif, system-ui, sans-serif;
|
|
181
|
-
/* ... radius, animations */
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
:root { /* light theme colors */ }
|
|
185
|
-
.dark { /* dark theme colors */ }
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
**To add custom colors**, edit the `:root` and `.dark` blocks. To add font families, add `@theme inline {}` entries.
|
|
189
|
-
|
|
190
|
-
## UI Components
|
|
191
|
-
|
|
192
|
-
The template ships with only **4 minimal starter components** in `src/components/ui/`: `button`, `input`, `label`, `textarea`. These are simple, unstyled wrappers — just enough to get started.
|
|
193
|
-
|
|
194
|
-
### Adding More Components
|
|
195
|
-
|
|
196
|
-
Use **shadcn/ui** to add any components you need:
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
npx shadcn@latest add card dialog sheet select badge separator scroll-area tabs accordion dropdown-menu
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
You can add any shadcn/ui component this way. Always install components as needed rather than building custom ones from scratch.
|
|
203
|
-
|
|
204
|
-
### Important
|
|
205
|
-
|
|
206
|
-
- **Do NOT hardcode a fixed set of UI components into every app.** Each app should have components appropriate for its purpose.
|
|
207
|
-
- **Design each app's UI uniquely** — use different layouts, color schemes, and component combinations. Avoid repeating the same card/dialog/sheet pattern everywhere.
|
|
208
|
-
- Use Tailwind CSS utility classes directly for custom layouts. Not everything needs a component wrapper.
|
|
209
|
-
- For complex components (data tables, charts, calendars, etc.), install them via shadcn: `npx shadcn@latest add table chart calendar`
|
|
210
|
-
|
|
211
|
-
## Protected Files — Edit Only, Never Rewrite
|
|
212
|
-
|
|
213
|
-
- `package.json` — use `npm install <pkg>`, use `edit_file` for scripts
|
|
214
|
-
- `tsconfig.json` — edit specific fields only
|
|
215
|
-
- `vite.config.ts` — edit, don't rewrite (plugin order matters)
|
|
216
|
-
- `src/styles.css` — append or edit (Tailwind @theme config)
|
|
217
|
-
- `src/routes/__root.tsx` — edit carefully (fonts, providers, beforeLoad)
|
|
218
|
-
- `src/routeTree.gen.ts` — NEVER edit (auto-generated by TanStack Router)
|
|
219
|
-
|
|
220
|
-
## Best Practices
|
|
221
|
-
|
|
222
|
-
- **Do NOT** use `npm create`, `npx create-vite`, or other scaffolding tools
|
|
223
|
-
- Always use the `--name` flag to specify the project name
|
|
224
|
-
- After creation, work inside the `{app-name}/` directory for all file edits
|
|
225
|
-
- Start editing from `src/routes/index.tsx` and create new routes as files in `src/routes/`
|
|
226
|
-
- Add UI components via `npx shadcn@latest add <component>` as needed — do NOT install alternative UI libraries (no MUI, Chakra, Ant Design, etc.)
|
|
227
|
-
- New routes auto-register via TanStack Router file-based routing (the `routeTree.gen.ts` regenerates on dev server restart)
|
|
228
|
-
- For protected routes, use the `_authed.tsx` layout pattern (see `authentication` skill)
|
|
229
|
-
- For server-side logic, use `createServerFn` (see `api-creation` skill)
|
|
230
|
-
- **Run `npm run build` after your first server function + route are written.** Build errors surface immediately when the codebase is small and easy to fix. Catching import/bundling errors early prevents hours of debugging later.
|
|
231
|
-
- **NEVER use `await import()` for server functions in components.** Always static imports + `useServerFn()` for mutations. See `api-creation` skill for correct patterns.
|
|
1
|
+
---
|
|
2
|
+
name: web-application-creation
|
|
3
|
+
description: Initialize a new web application from the Strayl template using npx create-strayl-app. Handles project scaffolding, dependency installation, and dev server startup. Use when the user wants a full-featured app with multiple routes, forms, auth, database, or any complex logic.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Web Application Creation
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- User asks to create, start, or scaffold a new web application
|
|
11
|
+
- User wants to build a new project from scratch
|
|
12
|
+
- The workspace repository is empty and needs a project initialized
|
|
13
|
+
- User says "create an app", "start a new project", "build me an app"
|
|
14
|
+
- User needs multiple routes, forms, auth, database, dashboards, CRUD
|
|
15
|
+
|
|
16
|
+
## When NOT to Use (use `landing-creation` instead)
|
|
17
|
+
|
|
18
|
+
- User wants a single-page landing, marketing page, or promotional site
|
|
19
|
+
- User says "make me a website", "create a homepage", "build a landing page"
|
|
20
|
+
- User's request implies a simple static site without complex backend logic
|
|
21
|
+
|
|
22
|
+
## Workflow
|
|
23
|
+
|
|
24
|
+
1. **Ask the user for the app name** before running any commands. The name will be used as the project directory name.
|
|
25
|
+
2. **Run the scaffolding command** in the repository root:
|
|
26
|
+
```
|
|
27
|
+
npx -y create-strayl-app@latest --name {app-name}
|
|
28
|
+
```
|
|
29
|
+
3. **Install dependencies:**
|
|
30
|
+
```
|
|
31
|
+
cd {app-name} && npm install
|
|
32
|
+
```
|
|
33
|
+
4. **Start the dev server** in background mode:
|
|
34
|
+
```
|
|
35
|
+
cd {app-name} && npm run dev
|
|
36
|
+
```
|
|
37
|
+
5. **Check logs** to confirm the server started successfully (look for "ready" or "listening on port 3000").
|
|
38
|
+
6. **Show preview** to the user with `showPreview`.
|
|
39
|
+
7. **Continue building** based on user's request. Common next steps:
|
|
40
|
+
- Need user accounts? → Read `/skills/authentication/SKILL.md`
|
|
41
|
+
- Need a database? → Read `/skills/database-management/SKILL.md`
|
|
42
|
+
- Need API endpoints / server logic? → Read `/skills/api-creation/SKILL.md`
|
|
43
|
+
- Need UI/UX design, styling, or visual polish? → Read `/skills/frontend-design/SKILL.md`
|
|
44
|
+
|
|
45
|
+
## Template Stack
|
|
46
|
+
|
|
47
|
+
| Layer | Technology | Version |
|
|
48
|
+
|-------|------------|---------|
|
|
49
|
+
| Framework | React + TanStack Start | React 19, Start 1.x |
|
|
50
|
+
| Bundler | Vite | 7.x |
|
|
51
|
+
| Language | TypeScript (strict) | 5.7+ |
|
|
52
|
+
| Routing | TanStack Router (file-based) | 1.x |
|
|
53
|
+
| Styling | Tailwind CSS + CSS custom properties | 4.x |
|
|
54
|
+
| UI Components | shadcn/ui (install as needed) | latest |
|
|
55
|
+
| Icons | Lucide React | 0.475+ |
|
|
56
|
+
| Theming | next-themes (light/dark + system) | 0.4.x |
|
|
57
|
+
| Font | Geist (fontsource) | — |
|
|
58
|
+
| Server | Nitro (SSR + server functions) | nightly |
|
|
59
|
+
|
|
60
|
+
## Project Structure
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
{app-name}/
|
|
64
|
+
├── public/
|
|
65
|
+
│ └── favicon.ico
|
|
66
|
+
├── src/
|
|
67
|
+
│ ├── components/
|
|
68
|
+
│ │ ├── theme-provider.tsx # next-themes wrapper
|
|
69
|
+
│ │ └── ui/ # Minimal starter components (button, input, label, textarea)
|
|
70
|
+
│ ├── hooks/
|
|
71
|
+
│ │ └── use-mobile.ts # useIsMobile() — viewport < 768px
|
|
72
|
+
│ ├── lib/
|
|
73
|
+
│ │ └── utils.ts # cn() — clsx + tailwind-merge
|
|
74
|
+
│ ├── routes/
|
|
75
|
+
│ │ ├── __root.tsx # Root layout (HTML shell, Geist font, ThemeProvider)
|
|
76
|
+
│ │ ├── index.tsx # Home page ("STRAYL" + theme toggle)
|
|
77
|
+
│ │ └── routeTree.gen.ts # Auto-generated route tree (DO NOT EDIT)
|
|
78
|
+
│ ├── router.tsx # Router config (empty context, scroll restoration)
|
|
79
|
+
│ └── styles.css # Tailwind 4 theme (colors, fonts, radius)
|
|
80
|
+
├── components.json # shadcn/ui config (style: new-york)
|
|
81
|
+
├── package.json
|
|
82
|
+
├── tsconfig.json
|
|
83
|
+
└── vite.config.ts # Vite + Nitro + TanStack Start + Tailwind plugins
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Critical Files — Know Before Editing
|
|
87
|
+
|
|
88
|
+
### `src/routes/__root.tsx` — App Shell
|
|
89
|
+
|
|
90
|
+
Uses `shellComponent` (NOT `component`) to define the HTML document structure:
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'
|
|
94
|
+
import '@fontsource-variable/geist'
|
|
95
|
+
import { ThemeProvider } from '../components/theme-provider'
|
|
96
|
+
import appCss from '../styles.css?url'
|
|
97
|
+
|
|
98
|
+
export const Route = createRootRoute({
|
|
99
|
+
head: () => ({
|
|
100
|
+
meta: [
|
|
101
|
+
{ charSet: 'utf-8' },
|
|
102
|
+
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
103
|
+
{ title: 'Strayl' },
|
|
104
|
+
],
|
|
105
|
+
links: [
|
|
106
|
+
{ rel: 'stylesheet', href: appCss },
|
|
107
|
+
{ rel: 'icon', href: '/favicon.ico' },
|
|
108
|
+
],
|
|
109
|
+
}),
|
|
110
|
+
shellComponent: RootDocument,
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
function RootDocument({ children }: { children: React.ReactNode }) {
|
|
114
|
+
return (
|
|
115
|
+
<html lang="en" suppressHydrationWarning>
|
|
116
|
+
<head><HeadContent /></head>
|
|
117
|
+
<body>
|
|
118
|
+
<ThemeProvider>{children}</ThemeProvider>
|
|
119
|
+
<Scripts />
|
|
120
|
+
</body>
|
|
121
|
+
</html>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**To add auth context**, add `beforeLoad` — it works alongside `shellComponent`:
|
|
127
|
+
```typescript
|
|
128
|
+
export const Route = createRootRoute({
|
|
129
|
+
beforeLoad: async () => {
|
|
130
|
+
const user = await getUser();
|
|
131
|
+
return { user };
|
|
132
|
+
},
|
|
133
|
+
head: () => ({ ... }),
|
|
134
|
+
shellComponent: RootDocument,
|
|
135
|
+
})
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### `src/router.tsx` — Router Instance
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
export const getRouter = () => {
|
|
142
|
+
const router = createRouter({
|
|
143
|
+
routeTree,
|
|
144
|
+
context: {}, // ← empty by default; auth adds user here
|
|
145
|
+
scrollRestoration: true,
|
|
146
|
+
defaultPreloadStaleTime: 0,
|
|
147
|
+
})
|
|
148
|
+
return router
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### `vite.config.ts` — Plugin Order Matters
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
plugins: [
|
|
156
|
+
nitro(), // SSR / server functions
|
|
157
|
+
viteTsConfigPaths(), // @/* path aliases
|
|
158
|
+
tailwindcss(), // Tailwind CSS 4
|
|
159
|
+
tanstackStart(), // TanStack Start framework
|
|
160
|
+
viteReact(), // React Fast Refresh
|
|
161
|
+
]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Do NOT rewrite this file.** Use `edit_file` to add plugins if needed.
|
|
165
|
+
|
|
166
|
+
### `src/styles.css` — Tailwind CSS 4 Theme
|
|
167
|
+
|
|
168
|
+
Uses `@theme inline {}` directive (NOT `tailwind.config.js`):
|
|
169
|
+
|
|
170
|
+
```css
|
|
171
|
+
@import "tailwindcss";
|
|
172
|
+
@import "tw-animate-css";
|
|
173
|
+
|
|
174
|
+
@custom-variant dark (&:is(.dark *));
|
|
175
|
+
@variant dark (&:where(.dark, .dark *));
|
|
176
|
+
|
|
177
|
+
@theme inline {
|
|
178
|
+
--color-background: var(--background);
|
|
179
|
+
--color-primary: var(--primary);
|
|
180
|
+
--font-sans: "Geist Variable", ui-sans-serif, system-ui, sans-serif;
|
|
181
|
+
/* ... radius, animations */
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
:root { /* light theme colors */ }
|
|
185
|
+
.dark { /* dark theme colors */ }
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**To add custom colors**, edit the `:root` and `.dark` blocks. To add font families, add `@theme inline {}` entries.
|
|
189
|
+
|
|
190
|
+
## UI Components
|
|
191
|
+
|
|
192
|
+
The template ships with only **4 minimal starter components** in `src/components/ui/`: `button`, `input`, `label`, `textarea`. These are simple, unstyled wrappers — just enough to get started.
|
|
193
|
+
|
|
194
|
+
### Adding More Components
|
|
195
|
+
|
|
196
|
+
Use **shadcn/ui** to add any components you need:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
npx shadcn@latest add card dialog sheet select badge separator scroll-area tabs accordion dropdown-menu
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
You can add any shadcn/ui component this way. Always install components as needed rather than building custom ones from scratch.
|
|
203
|
+
|
|
204
|
+
### Important
|
|
205
|
+
|
|
206
|
+
- **Do NOT hardcode a fixed set of UI components into every app.** Each app should have components appropriate for its purpose.
|
|
207
|
+
- **Design each app's UI uniquely** — use different layouts, color schemes, and component combinations. Avoid repeating the same card/dialog/sheet pattern everywhere.
|
|
208
|
+
- Use Tailwind CSS utility classes directly for custom layouts. Not everything needs a component wrapper.
|
|
209
|
+
- For complex components (data tables, charts, calendars, etc.), install them via shadcn: `npx shadcn@latest add table chart calendar`
|
|
210
|
+
|
|
211
|
+
## Protected Files — Edit Only, Never Rewrite
|
|
212
|
+
|
|
213
|
+
- `package.json` — use `npm install <pkg>`, use `edit_file` for scripts
|
|
214
|
+
- `tsconfig.json` — edit specific fields only
|
|
215
|
+
- `vite.config.ts` — edit, don't rewrite (plugin order matters)
|
|
216
|
+
- `src/styles.css` — append or edit (Tailwind @theme config)
|
|
217
|
+
- `src/routes/__root.tsx` — edit carefully (fonts, providers, beforeLoad)
|
|
218
|
+
- `src/routeTree.gen.ts` — NEVER edit (auto-generated by TanStack Router)
|
|
219
|
+
|
|
220
|
+
## Best Practices
|
|
221
|
+
|
|
222
|
+
- **Do NOT** use `npm create`, `npx create-vite`, or other scaffolding tools
|
|
223
|
+
- Always use the `--name` flag to specify the project name
|
|
224
|
+
- After creation, work inside the `{app-name}/` directory for all file edits
|
|
225
|
+
- Start editing from `src/routes/index.tsx` and create new routes as files in `src/routes/`
|
|
226
|
+
- Add UI components via `npx shadcn@latest add <component>` as needed — do NOT install alternative UI libraries (no MUI, Chakra, Ant Design, etc.)
|
|
227
|
+
- New routes auto-register via TanStack Router file-based routing (the `routeTree.gen.ts` regenerates on dev server restart)
|
|
228
|
+
- For protected routes, use the `_authed.tsx` layout pattern (see `authentication` skill)
|
|
229
|
+
- For server-side logic, use `createServerFn` (see `api-creation` skill)
|
|
230
|
+
- **Run `npm run build` after your first server function + route are written.** Build errors surface immediately when the codebase is small and easy to fix. Catching import/bundling errors early prevents hours of debugging later.
|
|
231
|
+
- **NEVER use `await import()` for server functions in components.** Always static imports + `useServerFn()` for mutations. See `api-creation` skill for correct patterns.
|