add agent rules

This commit is contained in:
Benjamin Palko 2026-08-11 15:39:16 -04:00
parent 9b9ae5c7f5
commit c37955c51b
4 changed files with 52 additions and 0 deletions

View file

@ -1,4 +1,5 @@
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@sveltejs/opencode"],
"instructions": [".opencode/rules/*.md"]
}

View file

@ -0,0 +1,16 @@
# Formatting
## Command
- `pnpm format` writes formatted code (Prettier).
- `pnpm lint` verifies formatting plus ESLint; use it as the check.
## Prettier
- `.prettierrc` is the source of truth for all Prettier settings. Read it rather than assuming defaults; if its values change, follow the file.
- Do not hand-format to match remembered settings — run `pnpm format` and let Prettier decide.
- `.prettierignore` lists files Prettier skips (lockfiles, `build/`, `node_modules/`, etc.). Respect it.
## Tailwind class ordering
- `prettier-plugin-tailwindcss` sorts utility class names automatically. Never manually reorder classes for sorting — just run `pnpm format`.

View file

@ -0,0 +1,15 @@
# Linting
## Command
- Run `pnpm lint` (Prettier check + ESLint) before finishing any work.
- If `pnpm lint` reports errors, fix them and re-run until clean.
- Never leave the repo in a state where `pnpm lint` fails.
## ESLint
- The flat config in `eslint.config.js` is the source of truth for enabled rules. Read it before making lint-related assumptions.
- `.svelte` files are handled by `eslint-plugin-svelte` with the TypeScript parser.
- `eslint.config.js` respects `.gitignore` — don't lint `build/`, `.svelte-kit/`, or `node_modules/`.
- Prefer fixing the root cause over suppressing: avoid `eslint-disable` comments unless truly necessary, and never disable an entire file.
- Run `pnpm lint` for the whole project after edits that touch Svelte, TypeScript, or configuration files.

View file

@ -0,0 +1,20 @@
# Tailwind CSS + daisyUI
## Version and integration
- Tailwind CSS 4 via the `@tailwindcss/vite` plugin. Configuration is CSS-first.
- Global theming and daisyUI plugin setup live in `src/app.css` — read it for the current theme names and page background setup. It is the source of truth for theme configuration.
- `tailwind.config.ts` only defines content globs. Do not add JS theme tokens there; use CSS-first `@theme` in `src/app.css` instead.
## Style rules
- Prefer Tailwind utilities and daisyUI component classes (e.g. `btn`, `card`, `badge`) and their theme colors over hand-written CSS.
- Avoid arbitrary values (`[ ... ]`) when a core utility exists.
- Add new design tokens via `@theme` in `src/app.css`, not in `tailwind.config.ts`.
- Put page/component styling in `src/routes/**` components with utilities; keep global styles in `src/app.css`.
- Static assets referenced by URL (e.g. `/background.jpg`) live in `static/`.
## Verification
- After styling changes, run `pnpm check` (Svelte typecheck) and `pnpm build`.
- Class ordering is handled by `prettier-plugin-tailwindcss` — run `pnpm format` rather than reordering classes by hand.