Files
portal/AGENTS.md
T
NeilClack 91d162c746 Rebuild admin pages around DataTable/AdminModal; restructure categories/groups and v2 groups API
Remove the generic $lib/svelte-admin CRUD layer and AdminTable.svelte; each
admin route now owns its own form/modal logic. Add DataTable.svelte,
superform-errors.ts, and profile-specific modal/field components.

Flatten proclamation categories/groups and drop subscription levels; add the
v2 groups API; update v1/v2 endpoints, serializers, auth, and regenerated
Prisma client with the new migrations.

Document the overhaul plan in docs/ADMIN_OVERHAUL.md.
2026-09-10 09:38:01 -05:00

4.5 KiB

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:

AGENTS.md

at your project root:

# Radiant Wave Portal AI Guide

## Mission

You are working on portal.radiantwavetech.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.radiantwavetech.com

Stack:

  • SvelteKit 2
  • Svelte 5
  • TypeScript
  • Tailwind CSS v4
  • Prisma 7
  • PostgreSQL
  • Better Auth
  • Vitest
  • Playwright

Package manager:

npm


Quick Start

Install:

npm install

Generate types:

npm run prepare

Run development:

npm run dev

Required environment:

DATABASE_URL
BETTER_AUTH_SECRET
BETTER_AUTH_URL

Architecture Map

Routes

Protected routes:

(protected)/

Require authentication and profile.

User routes:

(user)/

User-facing functionality.

Admin routes:

admin/

Require:

roleId <= 3

Roles:

SUPER = 1
ADMIN = 2
STAFF = 3
USER = 4

Database

Prisma generated client:

src/lib/generated/prisma/

Do not import Prisma from:

node_modules/.prisma/client

Database singleton:

src/lib/db.ts

Authentication

Server:

src/lib/auth.ts

Browser:

src/lib/auth-client.ts

Session handling:

src/hooks.server.ts

Admin Architecture

Admin forms are route-specific.

Example:

admin/[model]/
  ModelForm.svelte

Do not recreate deleted generic components:

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:

$state()
$derived()
$effect()
$props()

Do not use:

writable()
derived()
legacy stores

For Svelte-specific patterns, read:

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:

docs/ai/testing-patterns.md

Only load that file when modifying tests.


API Rules

For API routes, authentication, keys, or integrations, read:

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:

npm run check

Lint:

npm run lint

Format:

npm run format

Tests:

npm run test

Build:

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.