Skip to content

Coding Standards

This page summarises the enforced standards. The authoritative sources are the repo's CLAUDE.md and documentations/claude/CODING_STANDARDS.md; the design system is documentations/01-layout/guidelines/niftytoolkit-uiux-theme-guidelines.md.

Hard guardrails

  1. No TypeScript in the app — .jsx/.js only (edge functions are Deno/TS and are exempt).
  2. No supabase.from() anywhere in src/.
  3. No supabase.rpc() outside hooks; no supabase.functions.invoke() outside services.
  4. No new Supabase clients — use src/lib/supabaseClient.js.
  5. No inline EF name strings — use EDGE_FN.CONSTANT.
  6. No Redux — reads use cached hooks; mutations use TanStack useMutation or local state.
  7. No console.log in frontend code.
  8. No inline styles — Tailwind utilities only.
  9. No hardcoded hex colors in class strings (chart stroke/fill values are the only exception).
  10. No legacy theme imports (@/theme/lightTheme / darkTheme) — use cn() + isLight.
  11. Every component handles dark & light via isLight.
  12. No speculative abstractions — implement exactly what's asked.
  13. No .md docs unless requested.
  14. Never modify existing migrations — add new ones.
  15. No cross-tier downward imports (users/admin/).
  16. Every new feature ships a tests/ folder (4-layer model).

No-comments policy

Write zero comments by default. Add one only when the why is non-obvious (a hidden constraint, a workaround, a subtle invariant). Never comment what the code does. No docstrings.

Naming

EntityConventionExample
ComponentsPascalCaseTradePlanBriefingCard.jsx
Hooksuse + camelCaseuseNifty50MoodData.js
ServicescamelCase + ServicetradePlannerService.js
Tablessnake_casetrade_planner_plans
RPCsget_{entity}get_nifty50_market_mood
Edge functionskebab domain-actiontrade-planner-save
MigrationsYYYYMMDD_NNN_name.sql20260601_133_index_radar_rpc.sql
EF config keysUPPER_SNAKE_CASEEDGE_FN.SAVE_PLAN

Testing — mandatory 4-layer model

LayerScope
1 — Pure computationutils / pure functions, no mocks
2 — Unithooks + services (mock supabase + cache)
3 — Component smokereal component import; first test asserts it mounts (validates react-icons/ri imports)
4 — Page / route integrationreal page + real sub-components, mocked hooks/services; assert supabase.from() is never called

react-icons/ri is never mocked in component tests — that's exactly what the mount test validates. Coverage thresholds: 70% lines, 80% functions.