From c37955c51ba533d7f2b749936f35bf6691be0dd7 Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Tue, 11 Aug 2026 15:39:16 -0400 Subject: [PATCH] add agent rules --- .opencode/opencode.json | 1 + .opencode/rules/formatting.md | 16 ++++++++++++++++ .opencode/rules/linting.md | 15 +++++++++++++++ .opencode/rules/tailwind.md | 20 ++++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 .opencode/rules/formatting.md create mode 100644 .opencode/rules/linting.md create mode 100644 .opencode/rules/tailwind.md diff --git a/.opencode/opencode.json b/.opencode/opencode.json index c7b26b9..639e3e7 100644 --- a/.opencode/opencode.json +++ b/.opencode/opencode.json @@ -1,4 +1,5 @@ { "$schema": "https://opencode.ai/config.json", "plugin": ["@sveltejs/opencode"], + "instructions": [".opencode/rules/*.md"] } diff --git a/.opencode/rules/formatting.md b/.opencode/rules/formatting.md new file mode 100644 index 0000000..8b49570 --- /dev/null +++ b/.opencode/rules/formatting.md @@ -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`. diff --git a/.opencode/rules/linting.md b/.opencode/rules/linting.md new file mode 100644 index 0000000..d0e205f --- /dev/null +++ b/.opencode/rules/linting.md @@ -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. diff --git a/.opencode/rules/tailwind.md b/.opencode/rules/tailwind.md new file mode 100644 index 0000000..c8da43f --- /dev/null +++ b/.opencode/rules/tailwind.md @@ -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.