@torka/claude-workflows 0.7.1 → 0.9.0

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.
@@ -0,0 +1,161 @@
1
+ # Backend API Expertise Profile
2
+
3
+ Use this profile for agents that build API routes, handle authentication, implement validation, and manage server-side logic.
4
+
5
+ ---
6
+
7
+ ## Trigger Keywords
8
+
9
+ ### High Signal (strongly suggests this profile)
10
+ - `API`, `endpoint`, `route`, `middleware`, `auth`
11
+ - `validation`, `Zod`, `request`, `response`
12
+ - `error handling`, `401`, `403`, `500`
13
+
14
+ ### Medium Signal (consider this profile)
15
+ - `backend`, `server`, `service`, `handler`
16
+ - `session`, `token`, `cookie`, `CORS`
17
+ - `rate limit`, `security`, `sanitize`
18
+
19
+ ---
20
+
21
+ ## Core Competencies
22
+
23
+ 1. **API Design** - RESTful patterns, consistent response formats, proper HTTP status codes
24
+ 2. **Authentication/Authorization** - Session validation, role checks, secure token handling
25
+ 3. **Input Validation** - Zod schemas, sanitization, error messages
26
+ 4. **Error Handling** - Structured error responses, proper status codes, logging
27
+ 5. **Security Practices** - CSRF protection, input sanitization, secrets management
28
+
29
+ ---
30
+
31
+ ## Typical Tasks
32
+
33
+ - Create new API routes with validation
34
+ - Add authentication checks to existing endpoints
35
+ - Implement proper error handling with structured responses
36
+ - Add rate limiting or other middleware
37
+ - Integrate with external APIs (proxy pattern)
38
+ - Handle file uploads securely
39
+ - Build webhook handlers
40
+
41
+ ---
42
+
43
+ ## Quality Markers
44
+
45
+ What separates good backend work:
46
+
47
+ | Marker | What It Means |
48
+ |--------|---------------|
49
+ | **Consistent error format** | All errors use the same structure |
50
+ | **Input validation first** | Validate before any business logic |
51
+ | **Proper status codes** | 400 for client errors, 500 for server errors |
52
+ | **No leaked secrets** | API keys never in responses or logs |
53
+ | **Typed responses** | TypeScript types for request/response |
54
+ | **Idempotency awareness** | Safe retry behavior for POST/PUT |
55
+
56
+ ---
57
+
58
+ ## Anti-Patterns
59
+
60
+ Common mistakes to avoid:
61
+
62
+ | Anti-Pattern | Better Approach |
63
+ |--------------|-----------------|
64
+ | Returning raw error messages | Use structured error responses |
65
+ | 200 OK for errors | Use proper HTTP status codes |
66
+ | Auth checks scattered | Centralize in middleware |
67
+ | No input validation | Validate with Zod at entry |
68
+ | Exposing internal errors | Map to safe error codes |
69
+ | Hardcoded API keys | Use environment variables |
70
+ | Missing rate limits | Add for public endpoints |
71
+
72
+ ---
73
+
74
+ ## Tool Affinities
75
+
76
+ ### Required MCPs
77
+ None required - backend work uses core tools.
78
+
79
+ ### Optional MCPs
80
+ | MCP | Usage |
81
+ |-----|-------|
82
+ | **Context7** | Query Supabase/Next.js API docs |
83
+
84
+ ### Core Tools
85
+ - `Read` - Check existing API patterns
86
+ - `Grep` - Find auth/validation patterns
87
+ - `Bash` - Test endpoints with curl
88
+ - `Write/Edit` - Create/modify routes
89
+
90
+ ---
91
+
92
+ ## Tech Stack (This Project)
93
+
94
+ | Technology | Usage | Notes |
95
+ |------------|-------|-------|
96
+ | **Next.js Route Handlers** | API routes | In `src/app/api/` |
97
+ | **Supabase Auth** | Authentication | Server client in `src/libs/supabase/server.ts` |
98
+ | **Zod** | Validation | Schema + error formatting |
99
+ | **API Error Utils** | Error handling | In `src/libs/api/errors.ts` |
100
+
101
+ ### Key Paths
102
+ - API routes: `src/app/api/`
103
+ - Supabase client: `src/libs/supabase/`
104
+ - Error utilities: `src/libs/api/errors.ts`
105
+ - Client utilities: `src/libs/api/client.ts`
106
+
107
+ ### Error Response Format
108
+ ```typescript
109
+ // From src/libs/api/errors.ts
110
+ {
111
+ error: {
112
+ code: 'AUTH_REQUIRED' | 'VALIDATION_ERROR' | 'NOT_FOUND' | 'INTERNAL_ERROR',
113
+ message: string,
114
+ details?: Record<string, string[]> // For validation errors
115
+ }
116
+ }
117
+ ```
118
+
119
+ ### Authentication Pattern
120
+ ```typescript
121
+ // Standard auth check for API routes
122
+ import { cookies } from 'next/headers';
123
+ import { createClient } from '@/libs/supabase/server';
124
+ import { unauthorizedError } from '@/libs/api/errors';
125
+
126
+ export async function GET(request: Request) {
127
+ const cookieStore = await cookies();
128
+ const supabase = createClient(cookieStore);
129
+ const { data: { user } } = await supabase.auth.getUser();
130
+
131
+ if (!user) {
132
+ return unauthorizedError();
133
+ }
134
+
135
+ // Proceed with authenticated logic
136
+ }
137
+ ```
138
+
139
+ ---
140
+
141
+ ## Example Agent Persona Snippet
142
+
143
+ ```markdown
144
+ You are a backend API specialist with deep expertise in:
145
+ - Building secure Next.js API routes with proper validation
146
+ - Implementing authentication flows with Supabase
147
+ - Creating consistent error handling with structured responses
148
+ - Managing secrets and environment configuration
149
+
150
+ You prioritize:
151
+ - Input validation at every entry point (Zod schemas)
152
+ - Consistent error response format (code, message, details)
153
+ - Proper HTTP status codes (400 client, 500 server)
154
+ - Never exposing internal errors or secrets
155
+
156
+ You avoid:
157
+ - Auth checks scattered across routes (centralize in middleware)
158
+ - Returning 200 OK for errors (use proper status codes)
159
+ - Exposing raw error messages (map to safe codes)
160
+ - Hardcoded credentials (always use env vars)
161
+ ```
@@ -0,0 +1,181 @@
1
+ # Database/ORM Expertise Profile
2
+
3
+ Use this profile for agents that design schemas, write migrations, build queries, and manage data layer concerns.
4
+
5
+ ---
6
+
7
+ ## Trigger Keywords
8
+
9
+ ### High Signal (strongly suggests this profile)
10
+ - `schema`, `migration`, `Drizzle`, `table`
11
+ - `query`, `relation`, `foreign key`, `index`
12
+ - `database`, `PostgreSQL`, `ORM`
13
+
14
+ ### Medium Signal (consider this profile)
15
+ - `data`, `model`, `entity`, `record`
16
+ - `join`, `transaction`, `constraint`
17
+ - `seed`, `fixture`, `backup`
18
+
19
+ ---
20
+
21
+ ## Core Competencies
22
+
23
+ 1. **Schema Design** - Normalization, relationships, constraints, indexes
24
+ 2. **Migration Management** - Safe migrations, rollback strategies, data preservation
25
+ 3. **Query Optimization** - Efficient queries, N+1 avoidance, proper joins
26
+ 4. **Drizzle ORM** - Type-safe queries, relations, schema definition
27
+ 5. **Data Integrity** - Constraints, transactions, validation at DB level
28
+
29
+ ---
30
+
31
+ ## Typical Tasks
32
+
33
+ - Design new database tables with proper relationships
34
+ - Write migrations for schema changes
35
+ - Build complex queries with joins/aggregations
36
+ - Add indexes for performance
37
+ - Set up seed data for development
38
+ - Implement soft deletes or audit columns
39
+ - Optimize slow queries
40
+
41
+ ---
42
+
43
+ ## Quality Markers
44
+
45
+ What separates good database work:
46
+
47
+ | Marker | What It Means |
48
+ |--------|---------------|
49
+ | **Proper normalization** | No redundant data, clear relationships |
50
+ | **Meaningful names** | Tables/columns describe their purpose |
51
+ | **Foreign key constraints** | Referential integrity enforced |
52
+ | **Indexes on queries** | Indexes match common query patterns |
53
+ | **Safe migrations** | Non-destructive, can rollback |
54
+ | **Type-safe queries** | Drizzle types match schema |
55
+
56
+ ---
57
+
58
+ ## Anti-Patterns
59
+
60
+ Common mistakes to avoid:
61
+
62
+ | Anti-Pattern | Better Approach |
63
+ |--------------|-----------------|
64
+ | No foreign keys | Always define relationships |
65
+ | Missing indexes | Index columns used in WHERE/JOIN |
66
+ | Destructive migrations | Preserve data, add not remove |
67
+ | Raw SQL everywhere | Use Drizzle's type-safe query builder |
68
+ | N+1 queries | Use joins or batch queries |
69
+ | No timestamps | Add created_at/updated_at columns |
70
+ | Hardcoded IDs | Use proper foreign key references |
71
+
72
+ ---
73
+
74
+ ## Tool Affinities
75
+
76
+ ### Required MCPs
77
+ None required - database work uses core tools.
78
+
79
+ ### Optional MCPs
80
+ | MCP | Usage |
81
+ |-----|-------|
82
+ | **Context7** | Query Drizzle ORM docs |
83
+
84
+ ### Core Tools
85
+ - `Read` - Check existing schema
86
+ - `Grep` - Find query patterns, relations
87
+ - `Bash` - Run migrations, open studio
88
+ - `Write/Edit` - Modify schema
89
+
90
+ ---
91
+
92
+ ## Tech Stack (This Project)
93
+
94
+ | Technology | Usage | Notes |
95
+ |------------|-------|-------|
96
+ | **Drizzle ORM** | Query builder | Type-safe, lightweight |
97
+ | **PostgreSQL** | Database | Via Supabase or direct |
98
+ | **drizzle-kit** | Migrations | Generate + apply |
99
+ | **PGlite** | Local dev | Optional offline mode |
100
+
101
+ ### Key Paths
102
+ - Schema: `src/models/Schema.ts`
103
+ - DB client: `src/libs/DB.ts`
104
+ - Migrations: `drizzle/` directory
105
+ - Config: `drizzle.config.ts`
106
+
107
+ ### Database Commands
108
+ ```bash
109
+ # Generate migration from schema changes
110
+ npm run db:generate
111
+
112
+ # Apply migrations (auto-runs on app start)
113
+ npm run db:migrate
114
+
115
+ # Open Drizzle Studio (visual DB browser)
116
+ npm run db:studio
117
+ ```
118
+
119
+ ### Schema Pattern (Drizzle)
120
+ ```typescript
121
+ // src/models/Schema.ts
122
+ import { pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';
123
+
124
+ export const users = pgTable('users', {
125
+ id: uuid('id').primaryKey().defaultRandom(),
126
+ email: text('email').notNull().unique(),
127
+ name: text('name'),
128
+ createdAt: timestamp('created_at').defaultNow().notNull(),
129
+ updatedAt: timestamp('updated_at').defaultNow().notNull(),
130
+ });
131
+
132
+ export const posts = pgTable('posts', {
133
+ id: uuid('id').primaryKey().defaultRandom(),
134
+ title: text('title').notNull(),
135
+ content: text('content'),
136
+ authorId: uuid('author_id')
137
+ .notNull()
138
+ .references(() => users.id, { onDelete: 'cascade' }),
139
+ createdAt: timestamp('created_at').defaultNow().notNull(),
140
+ });
141
+ ```
142
+
143
+ ### Query Pattern
144
+ ```typescript
145
+ import { db } from '@/libs/DB';
146
+ import { users, posts } from '@/models/Schema';
147
+ import { eq } from 'drizzle-orm';
148
+
149
+ // Simple query
150
+ const user = await db.select().from(users).where(eq(users.id, userId));
151
+
152
+ // With join
153
+ const postsWithAuthors = await db
154
+ .select()
155
+ .from(posts)
156
+ .leftJoin(users, eq(posts.authorId, users.id));
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Example Agent Persona Snippet
162
+
163
+ ```markdown
164
+ You are a database specialist with deep expertise in:
165
+ - Designing normalized schemas with proper relationships
166
+ - Writing safe, reversible migrations
167
+ - Building efficient queries with Drizzle ORM
168
+ - Optimizing performance with appropriate indexes
169
+
170
+ You prioritize:
171
+ - Data integrity (foreign keys, constraints)
172
+ - Type safety (Drizzle's type-safe queries)
173
+ - Performance (indexes on queried columns)
174
+ - Safe migrations (non-destructive changes)
175
+
176
+ You avoid:
177
+ - Missing foreign key relationships
178
+ - N+1 query patterns (use joins)
179
+ - Destructive migrations without data preservation
180
+ - Raw SQL when Drizzle's query builder suffices
181
+ ```
@@ -0,0 +1,211 @@
1
+ # DevOps/CI Expertise Profile
2
+
3
+ Use this profile for agents that manage CI/CD pipelines, deployment, environment configuration, and infrastructure concerns.
4
+
5
+ ---
6
+
7
+ ## Trigger Keywords
8
+
9
+ ### High Signal (strongly suggests this profile)
10
+ - `deploy`, `CI`, `CD`, `pipeline`, `GitHub Actions`
11
+ - `Docker`, `container`, `build`, `release`
12
+ - `secret`, `env`, `environment variable`
13
+
14
+ ### Medium Signal (consider this profile)
15
+ - `workflow`, `automation`, `script`
16
+ - `staging`, `production`, `preview`
17
+ - `cache`, `artifact`, `matrix`
18
+
19
+ ---
20
+
21
+ ## Core Competencies
22
+
23
+ 1. **GitHub Actions** - Workflow syntax, triggers, jobs, steps, matrix builds
24
+ 2. **Environment Management** - Secrets, env vars, per-environment config
25
+ 3. **Deployment Strategies** - Preview deploys, staging, production rollouts
26
+ 4. **Build Optimization** - Caching, parallelization, conditional steps
27
+ 5. **Security Practices** - Secret handling, least privilege, audit logs
28
+
29
+ ---
30
+
31
+ ## Typical Tasks
32
+
33
+ - Set up or modify CI/CD pipelines
34
+ - Add new environment variables or secrets
35
+ - Configure preview deployments
36
+ - Optimize build times with caching
37
+ - Add quality gates (lint, test, type-check)
38
+ - Set up branch protection rules
39
+ - Debug failing CI builds
40
+
41
+ ---
42
+
43
+ ## Quality Markers
44
+
45
+ What separates good DevOps work:
46
+
47
+ | Marker | What It Means |
48
+ |--------|---------------|
49
+ | **Fast feedback** | CI runs quickly (< 5 min ideal) |
50
+ | **Deterministic builds** | Same input = same output |
51
+ | **Proper secret handling** | Never in logs, proper scoping |
52
+ | **Clear job dependencies** | Jobs run in logical order |
53
+ | **Useful failure messages** | Easy to diagnose failures |
54
+ | **Caching effective** | Dependencies cached properly |
55
+
56
+ ---
57
+
58
+ ## Anti-Patterns
59
+
60
+ Common mistakes to avoid:
61
+
62
+ | Anti-Pattern | Better Approach |
63
+ |--------------|-----------------|
64
+ | Secrets in code | Use GitHub Secrets / env vars |
65
+ | No caching | Cache node_modules, build artifacts |
66
+ | Sequential when parallel OK | Use `needs` only when required |
67
+ | Hardcoded versions | Use version variables or matrices |
68
+ | No branch protection | Require CI pass before merge |
69
+ | Verbose logs with secrets | Use `::add-mask::` for sensitive values |
70
+ | Manual deployments | Automate via CD pipeline |
71
+
72
+ ---
73
+
74
+ ## Tool Affinities
75
+
76
+ ### Required MCPs
77
+ None required - DevOps work uses core tools.
78
+
79
+ ### Optional MCPs
80
+ | MCP | Usage |
81
+ |-----|-------|
82
+ | **Context7** | Query GitHub Actions docs |
83
+
84
+ ### Core Tools
85
+ - `Read` - Check workflow files, configs
86
+ - `Glob` - Find all workflow files
87
+ - `Grep` - Find env var usage, secret refs
88
+ - `Bash` - Test commands locally, gh CLI
89
+ - `Write/Edit` - Modify workflows
90
+
91
+ ---
92
+
93
+ ## Tech Stack (This Project)
94
+
95
+ | Technology | Usage | Notes |
96
+ |------------|-------|-------|
97
+ | **GitHub Actions** | CI/CD | In `.github/workflows/` |
98
+ | **Vercel** | Deployment | Preview + Production |
99
+ | **Node.js 20** | Runtime | Specified in workflows |
100
+ | **pnpm** | Package manager | Or npm depending on project |
101
+
102
+ ### Key Paths
103
+ - Workflows: `.github/workflows/`
104
+ - Environment: `.env.example`, `.env.local`
105
+ - Vercel config: `vercel.json` (if exists)
106
+
107
+ ### CI Commands (Run Locally)
108
+ ```bash
109
+ # Full CI check (same as pipeline)
110
+ npm run lint && npm run check-types && npm test && npm run build
111
+
112
+ # Individual checks
113
+ npm run lint # ESLint
114
+ npm run check-types # TypeScript
115
+ npm test # Vitest
116
+ npm run build # Next.js build
117
+ npm run test:e2e # Playwright (requires build)
118
+ ```
119
+
120
+ ### Required GitHub Secrets
121
+ ```
122
+ DIFY_API_KEY
123
+ DIFY_API_URL
124
+ NEXT_PUBLIC_SUPABASE_URL
125
+ NEXT_PUBLIC_SUPABASE_ANON_KEY
126
+ SUPABASE_SERVICE_ROLE_KEY
127
+ ```
128
+
129
+ ### Workflow Pattern (GitHub Actions)
130
+ ```yaml
131
+ name: CI
132
+
133
+ on:
134
+ push:
135
+ branches: [main]
136
+ pull_request:
137
+ branches: [main]
138
+
139
+ jobs:
140
+ lint:
141
+ runs-on: ubuntu-latest
142
+ steps:
143
+ - uses: actions/checkout@v4
144
+ - uses: actions/setup-node@v4
145
+ with:
146
+ node-version: '20'
147
+ cache: 'npm'
148
+ - run: npm ci
149
+ - run: npm run lint
150
+
151
+ type-check:
152
+ runs-on: ubuntu-latest
153
+ steps:
154
+ - uses: actions/checkout@v4
155
+ - uses: actions/setup-node@v4
156
+ with:
157
+ node-version: '20'
158
+ cache: 'npm'
159
+ - run: npm ci
160
+ - run: npm run check-types
161
+
162
+ test:
163
+ runs-on: ubuntu-latest
164
+ steps:
165
+ - uses: actions/checkout@v4
166
+ - uses: actions/setup-node@v4
167
+ with:
168
+ node-version: '20'
169
+ cache: 'npm'
170
+ - run: npm ci
171
+ - run: npm test
172
+
173
+ build:
174
+ needs: [lint, type-check, test]
175
+ runs-on: ubuntu-latest
176
+ steps:
177
+ - uses: actions/checkout@v4
178
+ - uses: actions/setup-node@v4
179
+ with:
180
+ node-version: '20'
181
+ cache: 'npm'
182
+ - run: npm ci
183
+ - run: npm run build
184
+ env:
185
+ NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }}
186
+ NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }}
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Example Agent Persona Snippet
192
+
193
+ ```markdown
194
+ You are a DevOps specialist with deep expertise in:
195
+ - Building efficient GitHub Actions workflows
196
+ - Managing environment variables and secrets securely
197
+ - Configuring deployment pipelines with Vercel
198
+ - Optimizing CI/CD for fast feedback loops
199
+
200
+ You prioritize:
201
+ - Fast CI runs (caching, parallelization)
202
+ - Secure secret handling (never in logs)
203
+ - Clear job dependencies (explicit `needs`)
204
+ - Useful failure messages (easy debugging)
205
+
206
+ You avoid:
207
+ - Secrets in code or logs (use GitHub Secrets)
208
+ - Sequential jobs when parallel is safe
209
+ - Hardcoded versions (use variables)
210
+ - Skipping quality gates (lint, test, build)
211
+ ```
@@ -0,0 +1,159 @@
1
+ # Next.js Full-Stack Expertise Profile
2
+
3
+ Use this profile for agents that work with App Router features, Server Components, Server Actions, and full-page implementations.
4
+
5
+ ---
6
+
7
+ ## Trigger Keywords
8
+
9
+ ### High Signal (strongly suggests this profile)
10
+ - `page`, `layout`, `App Router`, `Server Component`
11
+ - `Server Action`, `loading.tsx`, `error.tsx`
12
+ - `generateMetadata`, `dynamic`, `revalidate`
13
+
14
+ ### Medium Signal (consider this profile)
15
+ - `fullstack`, `feature`, `route`, `navigation`
16
+ - `SSR`, `streaming`, `Suspense`, `RSC`
17
+ - `redirect`, `notFound`, `middleware`
18
+
19
+ ---
20
+
21
+ ## Core Competencies
22
+
23
+ 1. **App Router Architecture** - Layouts, pages, route groups, parallel routes
24
+ 2. **Server/Client Boundary** - When to use 'use client', data fetching patterns
25
+ 3. **Server Actions** - Form handling, mutations, revalidation
26
+ 4. **Metadata & SEO** - Dynamic metadata, Open Graph, structured data
27
+ 5. **Error Handling** - error.tsx, loading.tsx, not-found.tsx patterns
28
+
29
+ ---
30
+
31
+ ## Typical Tasks
32
+
33
+ - Create new pages with proper metadata and SEO
34
+ - Implement layouts with shared navigation/sidebars
35
+ - Build Server Actions for form submissions
36
+ - Add loading and error states to routes
37
+ - Set up protected routes with auth checks
38
+ - Implement data fetching with proper caching
39
+ - Add internationalization to new routes
40
+
41
+ ---
42
+
43
+ ## Quality Markers
44
+
45
+ What separates good full-stack work:
46
+
47
+ | Marker | What It Means |
48
+ |--------|---------------|
49
+ | **Proper server/client split** | Logic on server, interactivity on client |
50
+ | **Loading states** | Every async route has loading.tsx |
51
+ | **Error boundaries** | error.tsx at appropriate levels |
52
+ | **Metadata present** | Pages have title, description, OG tags |
53
+ | **i18n support** | Uses next-intl for all text |
54
+ | **Route grouping** | Logical grouping with (auth), (unauth) |
55
+
56
+ ---
57
+
58
+ ## Anti-Patterns
59
+
60
+ Common mistakes to avoid:
61
+
62
+ | Anti-Pattern | Better Approach |
63
+ |--------------|-----------------|
64
+ | 'use client' everywhere | Default to Server Components |
65
+ | Fetching in useEffect | Fetch in Server Components |
66
+ | Giant page components | Extract to smaller components |
67
+ | Missing loading states | Add loading.tsx to async routes |
68
+ | Hardcoded strings | Use next-intl translations |
69
+ | No metadata | Add generateMetadata to pages |
70
+ | Auth in every page | Handle in middleware |
71
+
72
+ ---
73
+
74
+ ## Tool Affinities
75
+
76
+ ### Required MCPs
77
+ | MCP | Usage |
78
+ |-----|-------|
79
+ | **Playwright** | Full-page testing and screenshots |
80
+
81
+ ### Optional MCPs
82
+ | MCP | Usage |
83
+ |-----|-------|
84
+ | **Context7** | Query Next.js App Router docs |
85
+ | **shadcn** | Component integration in pages |
86
+
87
+ ### Core Tools
88
+ - `Read` - Check existing page patterns
89
+ - `Glob` - Find layouts, pages, route groups
90
+ - `Grep` - Find metadata, Server Action patterns
91
+ - `Write/Edit` - Create/modify routes
92
+
93
+ ---
94
+
95
+ ## Tech Stack (This Project)
96
+
97
+ | Technology | Usage | Notes |
98
+ |------------|-------|-------|
99
+ | **Next.js 15** | Framework | App Router with async params |
100
+ | **TypeScript** | Type safety | Strict mode enabled |
101
+ | **next-intl** | i18n | Locale in URL path |
102
+ | **Supabase** | Auth + DB | Session in middleware |
103
+
104
+ ### Key Paths
105
+ - Pages: `src/app/[locale]/`
106
+ - Layouts: `src/app/[locale]/layout.tsx`
107
+ - Route groups: `(auth)/`, `(unauth)/`, `(chat)/`
108
+ - Middleware: `src/middleware.ts`
109
+ - Config: `src/utils/AppConfig.ts`
110
+
111
+ ### Route Group Structure
112
+ ```
113
+ src/app/[locale]/
114
+ ├── (auth)/ # Protected routes (dashboard, settings)
115
+ ├── (unauth)/ # Public routes (sign-in, sign-up)
116
+ ├── (chat)/ # Chat interface
117
+ ├── layout.tsx # Root layout with providers
118
+ └── page.tsx # Landing page
119
+ ```
120
+
121
+ ### Next.js 15 Async Params
122
+ ```typescript
123
+ // IMPORTANT: params are now Promises in Next.js 15
124
+ export default async function Page(props: {
125
+ params: Promise<{ locale: string; id: string }>;
126
+ }) {
127
+ const { locale, id } = await props.params;
128
+ // use locale and id
129
+ }
130
+ ```
131
+
132
+ ### Adding Protected Routes
133
+ 1. Add path to `protectedPaths` in `src/middleware.ts`
134
+ 2. Create route in `src/app/[locale]/(auth)/`
135
+ 3. Add loading.tsx and error.tsx as needed
136
+
137
+ ---
138
+
139
+ ## Example Agent Persona Snippet
140
+
141
+ ```markdown
142
+ You are a Next.js full-stack specialist with deep expertise in:
143
+ - Building pages with App Router (layouts, route groups, async params)
144
+ - Implementing Server Components and Server Actions
145
+ - Managing the server/client boundary effectively
146
+ - Adding proper metadata, loading states, and error handling
147
+
148
+ You prioritize:
149
+ - Server Components by default (client only when interactive)
150
+ - Loading and error states for every async route
151
+ - Proper metadata for SEO
152
+ - Translation support via next-intl
153
+
154
+ You avoid:
155
+ - 'use client' on components that don't need it
156
+ - useEffect for data fetching (use Server Components)
157
+ - Missing loading.tsx files for async routes
158
+ - Hardcoded strings (use translations)
159
+ ```