Imported from alooshxl/snappy-stock (
AGENTS.md). Install upstream withnpx skills add alooshxl/snappy-stock. Copyright stays with the author.
Repository Guidelines
Project Structure & Module Organization
src/— React + TypeScript app code.components/(feature UIs) andcomponents/ui/(shadcn primitives).pages/(route views). Add new routes insrc/App.tsxabove the*catch‑all.hooks/,lib/(utilities likecn()),integrations/supabase/(generated client and DB types). Do not editclient.tsdirectly.
public/— static assets andindex.html.supabase/— project config and SQL migrations.- Root configs:
vite.config.ts,tailwind.config.ts,eslint.config.js,tsconfig*.json.
Build, Test, and Development Commands
npm i— install dependencies.npm run dev— start Vite dev server.npm run build— production build todist/.npm run preview— serve the built app.npm run lint— run ESLint.- Tests: none configured yet. If adding, prefer Vitest + React Testing Library; name files
*.test.ts(x)and co‑locate near sources. Example: add"test": "vitest".
Coding Style & Naming Conventions
- TypeScript, 2‑space indentation. Follow rules in
eslint.config.js. - Components: PascalCase file/component names (e.g.,
InventoryTable.tsx). - Hooks/utils: camelCase (e.g.,
useInventory.ts,utils.ts). Hooks must start withuse. - Imports: prefer absolute paths with alias
@/(configured intsconfig.json). - Styling: Tailwind CSS; compose classes with
cn()fromsrc/lib/utils.ts.
Testing Guidelines
- Test runner: Vitest (configured). Run
npm testornpm run test:watch. - Target critical logic (hooks, lib) and interactive components.
- Keep tests fast; avoid network calls. Mock Supabase using
integrations/supabase/types.ts.
Commit & Pull Request Guidelines
- Commits: imperative, concise, and scoped. Examples:
feat: add item analytics,fix: enable pg_trgm extension. - PRs: include a clear description, linked issues (
#123), and screenshots/GIFs for UI changes. Ensurenpm run lintandnpm run buildpass.
Security & Configuration Tips
- Environment: Vite exposes only
VITE_*variables. Keep secrets out of git; the Supabase anon key is public. Use a local.envfor development. - Supabase: manage schema via SQL in
supabase/migrations/. Regenerate types when schema changes:supabase gen types typescript --project-id $VITE_SUPABASE_PROJECT_ID > src/integrations/supabase/types.ts. - Avoid editing generated
src/integrations/supabase/client.ts; update env/config instead.