Skip to content
Back to skills

Frontend Standards

ASecurity

Use when implementing or refactoring frontend UI and business logic in apps/expo. Enforce business/UI layering, feature-based business folders, effect hooks, store usage rules, and Tailwind/NativeWind + clsx styling conventions.

  • 207 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added February 7, 2026
developmentrustreactrefactoringfrontendbackend

Works with

  • cli

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned February 12, 2026

npx -y skills add NeverSight/skills_feed --skill frontend-standards --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Frontend Standards?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Frontend Standards
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/neversight-frontend-standards/badge)](https://www.skillsdirectory.com/skills/neversight-frontend-standards)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: frontend-standards
description: Use when implementing or refactoring frontend UI and business logic in apps/expo. Enforce business/UI layering, feature-based business folders, effect hooks, store usage rules, and Tailwind/NativeWind + clsx styling conventions.
---

# Frontend Standards (Seagull)

## When to use
- Building or refactoring React Native screens/components in `apps/expo`.
- Moving logic into `apps/expo/src/business` modules.
- Deciding where logic/state/style belongs (business vs UI).

## Core rules
- **Business logic lives in `apps/expo/src/business/<module>/<feature>`**.
  - Files: `hooks.ts`, `effect.ts` (side effects only), `store.ts` (Zustand shared state), `types.ts`, `utils.ts`.
  - Business modules must not contain UI details (className/layout/components).
- **UI layer is pure**: no `trpc`, `queryClient`, `authClient`, `useQuery/useMutation`.
- **Hook contract**:
  - UI events call business methods; UI does not assemble payloads.
  - Derived data computed in hooks.
  - Side effects only in `effect.ts`, mounted once by page-level aggregate hook.
- **Store access**: UI may read store via selector only. No side effects in UI.
- **Styling**: TailwindCSS + NativeWind with `className`.
  - `className` composition must use `clsx`.
  - Use semantic tokens (`text-foreground`, `bg-primary`, `border-border`), avoid hardcoded colors.

## React Query / tRPC (TanStack Query) rules
- **Only business layer uses Query/Mutation**: keep `useQuery/useMutation`, `queryClient.invalidateQueries(...)` inside `apps/expo/src/business/**`.
- **Never put the whole `useMutation(...)` result object into `useEffect` deps** (it is not stable and can cause effect re-run loops).
  - Prefer destructuring: `const { mutate, mutateAsync, isPending } = useMutation(...)`, then depend on `mutateAsync`/`mutate` only if needed.
  - If you must reference mutation from async callbacks/timers/cleanup, prefer `useRef` or `store.getState()` over closures.
- **Query drives state; mutations only invalidate**:
  - Prefer “server truth → store flags” to be driven from query result (single source of truth).
  - Mutations should generally `invalidate`/`refetch` queries in `onSuccess/onSettled`, not directly flip multiple store flags.
- **Guard query/mutation with `enabled` and stable inputs**:
  - All query inputs must be stable and non-empty; use `enabled: isAuthed && !!id && !sessionLoading` style gating.
  - Avoid calling mutation in render; trigger from event or a guarded effect.
- **Avoid infinite loops**:
  - If an effect calls a mutation that invalidates a query, ensure the effect does not re-trigger solely because the query updated.
  - Use “attempt once per `id`” refs for auto-acquire patterns; never spam retries on every re-render.
- **TTL/lock heartbeats**:
  - `refetchInterval` refreshes query data, but does **not** extend TTL unless backend explicitly does so.
  - If backend has a `refresh` mutation, keep it and run it on an interval while owner; then invalidate `get` to sync `expiresAt`.
- **Cleanup must read latest state**:
  - For unmount releases, do not trust closed-over `hasLock`; use `useTripEditStore.getState()` (or a ref) to check latest ownership before calling `release`.

## Refactoring checklist
- Page contains only UI logic and view state.
- Repeated logic extracted to business hooks/utils/components.
- Files > 500 lines are split by feature.
- Lists handle empty states.

## Canonical reference
- See `skills/frontend-standards/references/frontend-standards.md` for the full policy text and examples.

Files in this skill

  • SKILL.md3.5 KB
  • description_cn.txt227 B
  • description_de.txt287 B
  • description_en.txt229 B
  • description_es.txt292 B
  • description_fr.txt384 B
  • description_ja.txt343 B
  • description_ko.txt291 B
  • description_tw.txt227 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.