frontend-patterns

frontend-patterns is a skill for Claude Code, Codex from tranhieutt/software_development_department. It costs 63 tokens per session (1,406 once invoked), scanned A, original, MIT.

A set of general patterns for building React and Vue interfaces, including component composition, hooks, data fetching, memoization, and error boundaries. React and Vue are tools for creating interactive web screens.

In plain words
What is it for?
Use it for framework-agnostic React or Vue work in projects such as Vite, Create React App, or Storybook, including reusable components and server-data loading.
Why use it?
It helps avoid common interface bugs such as stale values, incorrect effect dependencies, unstable list keys, unnecessary rendering, and mishandled asynchronous work.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tranhieutt/software_development_department/frontend-patterns
Any agent
npx skills add tranhieutt/software_development_department --skill frontend-patterns
Clone the repo
git clone --depth 1 https://github.com/tranhieutt/software_development_department

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for frontend-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/tranhieutt/software_development_department/frontend-patterns.svg)](https://agentmods.dev/skills/tranhieutt/software_development_department/frontend-patterns)
Your own site
<a href="https://agentmods.dev/skills/tranhieutt/software_development_department/frontend-patterns"><img src="https://agentmods.dev/badge/skills/tranhieutt/software_development_department/frontend-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,406 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00063 $0.01406
Opus 5 $0.00032 $0.00703
Sonnet 5 $0.00013 $0.00281
Haiku 4.5 $0.00006 $0.00141

Measured yesterday against content hash 1339e0c8fe41, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

frontend-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/frontend-patterns/SKILL.md · 155 lines

How it starts

The opening of the file, as written. The whole thing — 155 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Frontend Patterns

Critical rules (non-obvious)

  • Stale closure in useEffect: always list all dependencies; use useRef for values that shouldn't trigger re-run
  • useEffect with async: never make the callback async directly — create inner async fn and call it
  • Object/array as dependency: memoize with useMemo/useCallback or use primitive values; otherwise infinite loop
  • Key prop on lists: use stable IDs, never index when list can reorder or items get deleted
  • React.memo is not free: only wrap components with expensive renders and stable prop references

Component composition patterns

// Compound component with Context
const TabsContext = createContext<{ active: string; setActive: (v: string) => void } | null>(null);

function Tabs({ children, defaultValue }: { children: React.ReactNode; defaultValue: string }) {
  const [active, setActive] = useState(defaultValue);
  return <TabsContext.Provider value={{ active, setActive }}>{children}</TabsContext.Provider>;
}
Tabs.Trigger = function TabsTrigger({ value, children }: { value: string; children: React.ReactNode }) {
  const ctx = useContext(TabsContext)!;
  return <button onClick={() => ctx.setActive(value)} aria-selected={ctx.active === value}>{children}</button>;
};
Tabs.Content = function TabsContent({ value, children }: { value: string; children: React.ReactNode }) {
  const { active } = useContext(TabsContext)!;
  return active === value ? <>{children}</> : null;
};

State management decision

Scope Solution
Single component useState, useReducer
Subtree Context + useContext
Client global (UI) Zustand / Jotai
Server state (API) TanStack Query
Form state React Hook Form
URL state useSearchParams (Next.js)

Data fetching with TanStack Query

// Fetch
const { data, isLoading, error } = useQuery({
  queryKey: ["products", filters],   // filters in key → auto-refetch on change
  queryFn: () => api.getProducts(filters),
  staleTime: 5 * 60 * 1000,          // don't refetch for 5 min
});

// Mutate with optimistic update
const mutation = useMutation({
  mutationFn: api.updateProduct,
  onMutate: async (newProduct) => {
    await queryClient.cancelQueries({ queryKey: ["products"] });
    const prev = queryClient.getQueryData(["products"]);
    queryClient.setQueryData(["products"], (old) => old.map(p => p.id === newProduct.id ? newProduct : p));
    return { prev };
  },
  onError: (_, __, ctx) => queryClient.setQueryData(["products"], ctx?.prev),
  onSettled: () => queryClient.invalidateQueries({ queryKey: ["products"] }),
});

Read the full file on GitHub · 155 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 155 lines · 63 tokens per session scan A 1339e0c8fe41

Subscribe to this mod's changes

frontend-patterns is a skill published in the GitHub repository tranhieutt/software_development_department (71 stars, last pushed 3mo ago), licensed MIT. It adds 63 tokens to every session and 1,406 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

chrome-extension-wxt

Build Chrome extensions using WXT framework with TypeScript, React, Vue, or Svelte. Use when creating browser extensions, developing cross-browser add-ons, or working with Chrome Web Store projects. Triggers on phrases like "chrome extension", "browser extension", "WXT framework", "manifest v3", or file patterns like…

tenequm/skills · 76 tokens

astro-integrations

Use when adding React, Vue, Svelte, Solid, Preact, or another UI framework to an Astro project via @astrojs/ integrations.

fusengine/agents · 34 tokens

nextjs

Skill "nextjs" from DongDuong2001/pudo-code-system, covering next.js 15 (app router) pudo checklist, 1. plan (architecture & strategy), 2. understand (context & auditing), 3. develop (implementation) and 4. optimize (performance & review).

DongDuong2001/pudo-code-system · 0 tokens

btc-connect

专业的比特币钱包连接技能,支持btc-connect core、react、vue包在React、Vue、Next.js、Nuxt 3项目中的完整集成,包含UniSat和OKX钱包适配、网络切换功能、SSR环境配置、统一Hook API和v0.5.0最新特性.

Microck/ordinary-claude-skills · 71 tokens

data-vis-coding-v2

建立「互動式資料視覺化應用」的完整工作流程 skill。從一份資料(CSV/JSON/GeoJSON)與需求出發, 走完 規格釐清 → 資料處理 → 圖表選型 → 元件實作 → 多層次驗證,產出「可運作、能互動、數值正確、 風格一致」的 React + Tailwind + Chart.js/D3 前端。核心是「內容與樣式分離」兩階段設計,並以實際 執行 + 數值校驗取代臆測,避免資料錯置與視覺幻覺。 Use whenever the user wants to build or scaffold an interactive data-visualization app / dashboard / chart /…

hsuan1012/Dataviz-Coding-Agent · 327 tokens

ui-ux-pro-max

UI/UX design intelligence. 67 styles, 96 palettes, 57 font pairings, 25 charts, 13 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing…

the-hugin/RSIm · 221 tokens