408 lines
4.5 KiB
Markdown
408 lines
4.5 KiB
Markdown
You're right — I gave you the optimized root content earlier, but I did not provide it cleanly as a single copy/paste artifact. Here it is.
|
|
|
|
Save this as:
|
|
|
|
```text
|
|
AGENTS.md
|
|
```
|
|
|
|
at your project root:
|
|
|
|
````text
|
|
# Rhemawave Portal AI Guide
|
|
|
|
## Mission
|
|
|
|
You are working on portal.Rhemawavetech.com.
|
|
|
|
Act as a senior engineer making complete, production-ready changes.
|
|
|
|
Do not stop after analysis.
|
|
Do not provide a plan and wait.
|
|
Do not describe what should be done instead of doing it.
|
|
|
|
When asked to make a change:
|
|
|
|
1. Inspect the relevant code.
|
|
2. Understand the existing implementation.
|
|
3. Make the change.
|
|
4. Validate the result.
|
|
5. Fix any problems introduced.
|
|
6. Report what changed and what was verified.
|
|
|
|
A task is incomplete until the implementation is finished and verified.
|
|
|
|
---
|
|
|
|
# Working Style
|
|
|
|
## Focused Context
|
|
|
|
Do not load the entire repository into context.
|
|
|
|
Use a focused approach:
|
|
|
|
1. Identify relevant files.
|
|
2. Read only necessary code.
|
|
3. Find existing patterns.
|
|
4. Make the smallest correct change.
|
|
|
|
Avoid:
|
|
- broad rewrites
|
|
- unrelated cleanup
|
|
- speculative refactors
|
|
- introducing unnecessary dependencies
|
|
|
|
Prefer:
|
|
- small diffs
|
|
- existing conventions
|
|
- explicit implementations
|
|
|
|
---
|
|
|
|
# Development Loop
|
|
|
|
Always follow this workflow:
|
|
|
|
## 1. Understand
|
|
|
|
Before editing:
|
|
|
|
- Locate relevant files.
|
|
- Inspect current behavior.
|
|
- Find similar working examples.
|
|
- Identify constraints.
|
|
|
|
## 2. Implement
|
|
|
|
Make the smallest correct change.
|
|
|
|
Follow existing architecture.
|
|
|
|
Do not replace working patterns with new abstractions unless required.
|
|
|
|
## 3. Verify
|
|
|
|
Run appropriate checks:
|
|
|
|
```sh
|
|
npm run check
|
|
npm run lint
|
|
npm run test
|
|
````
|
|
|
|
Use narrower commands when appropriate.
|
|
|
|
## 4. Complete
|
|
|
|
If validation fails:
|
|
|
|
* Diagnose the failure.
|
|
* Fix the issue.
|
|
* Run validation again.
|
|
|
|
Never finish with known failures.
|
|
|
|
---
|
|
|
|
# Project Overview
|
|
|
|
Application:
|
|
|
|
portal.Rhemawavetech.com
|
|
|
|
Stack:
|
|
|
|
* SvelteKit 2
|
|
* Svelte 5
|
|
* TypeScript
|
|
* Tailwind CSS v4
|
|
* Prisma 7
|
|
* PostgreSQL
|
|
* Better Auth
|
|
* Vitest
|
|
* Playwright
|
|
|
|
Package manager:
|
|
|
|
npm
|
|
|
|
---
|
|
|
|
# Quick Start
|
|
|
|
Install:
|
|
|
|
```sh
|
|
npm install
|
|
```
|
|
|
|
Generate types:
|
|
|
|
```sh
|
|
npm run prepare
|
|
```
|
|
|
|
Run development:
|
|
|
|
```sh
|
|
npm run dev
|
|
```
|
|
|
|
Required environment:
|
|
|
|
```text
|
|
DATABASE_URL
|
|
BETTER_AUTH_SECRET
|
|
BETTER_AUTH_URL
|
|
```
|
|
|
|
---
|
|
|
|
# Architecture Map
|
|
|
|
## Routes
|
|
|
|
Protected routes:
|
|
|
|
```text
|
|
(protected)/
|
|
```
|
|
|
|
Require authentication and profile.
|
|
|
|
User routes:
|
|
|
|
```text
|
|
(user)/
|
|
```
|
|
|
|
User-facing functionality.
|
|
|
|
Admin routes:
|
|
|
|
```text
|
|
admin/
|
|
```
|
|
|
|
Require:
|
|
|
|
```text
|
|
roleId <= 3
|
|
```
|
|
|
|
Roles:
|
|
|
|
```text
|
|
SUPER = 1
|
|
ADMIN = 2
|
|
STAFF = 3
|
|
USER = 4
|
|
```
|
|
|
|
---
|
|
|
|
# Database
|
|
|
|
Prisma generated client:
|
|
|
|
```text
|
|
src/lib/generated/prisma/
|
|
```
|
|
|
|
Do not import Prisma from:
|
|
|
|
```text
|
|
node_modules/.prisma/client
|
|
```
|
|
|
|
Database singleton:
|
|
|
|
```text
|
|
src/lib/db.ts
|
|
```
|
|
|
|
---
|
|
|
|
# Authentication
|
|
|
|
Server:
|
|
|
|
```text
|
|
src/lib/auth.ts
|
|
```
|
|
|
|
Browser:
|
|
|
|
```text
|
|
src/lib/auth-client.ts
|
|
```
|
|
|
|
Session handling:
|
|
|
|
```text
|
|
src/hooks.server.ts
|
|
```
|
|
|
|
---
|
|
|
|
# Admin Architecture
|
|
|
|
Admin forms are route-specific.
|
|
|
|
Example:
|
|
|
|
```text
|
|
admin/[model]/
|
|
ModelForm.svelte
|
|
```
|
|
|
|
Do not recreate deleted generic components:
|
|
|
|
```text
|
|
AdminForm.svelte
|
|
AdminPage.svelte
|
|
```
|
|
|
|
Registry metadata exists for:
|
|
|
|
* columns
|
|
* searches
|
|
* relations
|
|
|
|
Forms are manually implemented per route.
|
|
|
|
---
|
|
|
|
# Svelte Rules
|
|
|
|
This project uses Svelte 5 runes.
|
|
|
|
Use:
|
|
|
|
```text
|
|
$state()
|
|
$derived()
|
|
$effect()
|
|
$props()
|
|
```
|
|
|
|
Do not use:
|
|
|
|
```text
|
|
writable()
|
|
derived()
|
|
legacy stores
|
|
```
|
|
|
|
For Svelte-specific patterns, read:
|
|
|
|
```text
|
|
docs/ai/svelte-patterns.md
|
|
```
|
|
|
|
Only load that file when modifying Svelte components or Svelte logic.
|
|
|
|
---
|
|
|
|
# Testing Rules
|
|
|
|
Testing uses:
|
|
|
|
* Vitest
|
|
* Playwright browser testing
|
|
|
|
For testing patterns, read:
|
|
|
|
```text
|
|
docs/ai/testing-patterns.md
|
|
```
|
|
|
|
Only load that file when modifying tests.
|
|
|
|
---
|
|
|
|
# API Rules
|
|
|
|
For API routes, authentication, keys, or integrations, read:
|
|
|
|
```text
|
|
docs/ai/api.md
|
|
```
|
|
|
|
Only load that file when working on API functionality.
|
|
|
|
---
|
|
|
|
# Formatting
|
|
|
|
Prettier rules:
|
|
|
|
* tabs
|
|
* single quotes
|
|
* no trailing commas
|
|
* 80 character print width
|
|
|
|
Follow existing formatting.
|
|
|
|
---
|
|
|
|
# Important Commands
|
|
|
|
Check:
|
|
|
|
```sh
|
|
npm run check
|
|
```
|
|
|
|
Lint:
|
|
|
|
```sh
|
|
npm run lint
|
|
```
|
|
|
|
Format:
|
|
|
|
```sh
|
|
npm run format
|
|
```
|
|
|
|
Tests:
|
|
|
|
```sh
|
|
npm run test
|
|
```
|
|
|
|
Build:
|
|
|
|
```sh
|
|
npm run build
|
|
```
|
|
|
|
---
|
|
|
|
# Completion Standard
|
|
|
|
Before claiming a task is complete:
|
|
|
|
Confirm:
|
|
|
|
1. Code changes are implemented.
|
|
2. Relevant tests/checks were run.
|
|
3. Failures were fixed.
|
|
4. The final response explains:
|
|
|
|
* what changed
|
|
* files modified
|
|
* verification performed
|
|
|
|
Do not stop at:
|
|
|
|
* "I found the issue"
|
|
* "Here is a plan"
|
|
* "The next step would be"
|
|
|
|
Finish the work.
|
|
|
|
|