react-hooks-state
React Hooks 與狀態管理模式。用於自訂 Hooks 設計、useReducer 複雜狀態、Context 架構、Server State 整合、表單狀態處理。
Skill by vincent119
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/vincent119-react-hooks-state
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: frontend, backend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/react-hooks-state
What's inside
- Skill name
react-hooks-state- Description
- React Hooks 與狀態管理模式。用於自訂 Hooks 設計、useReducer 複雜狀態、Context 架構、Server State 整合、表單狀態處理。
- License
- MIT
- Instructions
- 326 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Files (1)
- SKILL.md
SKILL.md (first lines)
# React Hooks 與狀態管理
## 自訂 Hook 設計
封裝可重用邏輯,回傳值與操作函式:
```tsx
import { useState, useEffect, useCallback } from 'react';
interface UseAsyncResult<T> {
data: T | null;
error: Error | null;
loading: boolean;
execute: () => Promise<void>;
}
export function useAsync<T>(asyncFn: () => Promise<T>): UseAsyncResult<T> {
const [data, setData] = useState<T | null>(null);
const [error, setError] = useState<Error | null>(null);
const [loading, setLoading] = useState(false);
const execute = useCallback(async () => {
setLoading(true);
setError(null);
try {
const result = await asyncFn();
setData(result);
} catch (err) {
setError(err instanceof Error ? err : new Error(String(err)));
} finally {
setLoading(false);
}
}, [asyncFn]);
return { data, error, loading, execute };
}
```
## useReducer 管理複雜狀態
多個相關狀態變更用 reducer 集中管理:
```tsx
import { useReducer } from 'react';
interface FormState {
values: Record<string, string>;
errors: Record<string, string>;
isSubmitting: boolean;
}
type FormAction =
| { type: 'SET_FIELD'; field: string; value: string }
| { type: 'SET_ERROR'; field: string; error: string }
| { type: 'CLEAR_ERRORS' }
| { type: 'SUBMIT_START' }
| { type: 'SUBMIT_END' };
function formReducer(state: FormState, action: FormAction): FormState {
switch (action.type) {
case 'SET_FIELD':
return {
...state,
values: { ...state.values, [action.field]: action.value },
errors: { ...state.errors, [action.field]: '' },
};
case 'SET_ERROR':
return {
...state,
errors: { ...state.errors, [action.field]: action.error },
};
case 'CLEAR_ERRORS':
return { ...state, errors: {} };
case 'SUBMIT_START':
return { ...state, isSubmitting: true };
case 'SUBMIT_END':
return { ...state, isSubmitting: false };
}
}
export function useForm(initialValues: Record<string, string>) {
const [state, dispatch] = useReducer(formReducer, {
values: initialValues,
errors: {},
isSubmitting: false,
});
const setField = (field: string, value: string) =>
dispatch({ type: 'SET_FIELD', field, value });
const setError = (field: string, error: string) =>
dispatch({ type: 'SET_ERROR', field, error });
return { ...state, setField, setError, dispatch };
}
```
## Context + Provider 架構
避免 prop drilling,提供型別安全的 Context:
```tsx
import { createContext, useContext, useReducer, type ReactNode } from 'react';
// 1. 定義型別
interface AuthState {
user: User | null;
token: string | null;
}
type AuthAction =
| { type: 'LOGIN'; user: User; token: string }
| { type: 'LOGOUT' };
interface AuthContextValue {
state: AuthState;
login: (user: User, token: string) => void;
logout: () => void;
}From vincent119/ai-rules-kit, MIT.
More from vincent119/ai-rules-kit
- 0.526score
financial-health-risk
vincent119
財務健康風險分析完整流程。讀入財務報表(PDF 或數字),分析流動性、獲利能力、槓桿、現金流、Altman Z-Score、成長性,產出多維度風險評估報告與改善建議。適用於「財務健康檢查」、「分析這份財報」、「financial risk…
SkillBFreshness: BClaude Code +9 - 0.526score
sdd-skill
vincent119
SDD(Spec Driven Development)工作流程。用於在實作前建立 .specs 下的 requirements.md、design.md、tasks.md,規劃功能邊界、驗收條件、技術設計與實作任務,並在實作過程中依 tasks 追蹤進度。
SkillBFreshness: BClaude Code +9 - 0.524score
skill-creator
vincent119
Guide for creating effective skills.
SkillBFreshness: BClaude Code +9 - 0.523score
technical-writing
vincent119
建立、改善或稽核 README 以外的技術文件,例如架構文件、操作手冊、教學、ADR 與概念說明。僅在使用者明確要求此類文件時使用;README 需求應使用 readme skill。
SkillBFreshness: BClaude Code +9 - 0.523score
readme
vincent119
建立、改善或稽核 GitHub 專案的 README。僅在使用者明確要求 README、README 正確性、可讀性、範例或 README 稽核時使用;不處理完整文件站、純 API reference 或廣泛 repository 審查。
SkillBFreshness: BClaude Code +9 - 0.521score
pres-presentation-designer
vincent119
簡報設計完整製作流程。協調 5 個製作階段:故事結構 → 資訊設計 → 視覺設計 → 講者備稿 → 品質審查,最終產出完整的簡報套件。適用於「製作簡報」、「Presentation 規劃」、「PPT 製作」、「Slide Deck…
SkillBFreshness: BClaude Code +9 - 0.521score
pres-slide-layout-patterns
vincent119
投影片版面模式庫。提供 20 種投影片類型的最佳版面配置、格線系統、色彩與字型設計 Token。適用於「投影片版面」、「Slide Layout」、「設計系統」、「格線」、「字型」、「色彩規範」等投影片視覺設計任務。強化 visual-designer 的設計能力。注意:PPT/Keynote…
SkillBFreshness: BClaude Code +9 - 0.521score
dev-refactoring-catalog
vincent119
程式碼重構目錄。提供基於 Martin Fowler 的重構模式、程式碼異味偵測到重構的對應、SOLID 原則違反識別,以及複雜度量測標準。適用於「重構」、「程式碼異味」、「SOLID 違反」、「複雜度」、「設計模式」、「程式碼品質」等程式碼結構改善審查任務。強化 architecture-reviewer 與…
SkillBFreshness: BClaude Code +9 - 0.521score
dev-vulnerability-patterns
vincent119
程式碼漏洞模式資料庫。提供 Python/JS/Java/Go 語言特定的漏洞程式碼模式、CWE 分類、安全替代方案與嚴重度評估標準。適用於「漏洞模式」、「CWE」、「SQL Injection」、「XSS」、「安全漏洞」、「安全編碼」、「漏洞程式碼」等安全性審查任務。強化 security-analyst…
SkillBFreshness: BClaude Code +9 - 0.521score
dev-code-reviewer
vincent119
自動化程式碼審查完整流程。協調 4 個審查領域:風格、安全性、效能、架構,最終產出綜合審查報告。適用於「review this code」、「看一下這段程式碼」、「程式碼審查」、「PR review」、「程式碼品質分析」、「安全性審查」、「效能審查」、「架構審查」、「程式碼風格檢查」等任務。支援指定單一領域審查。注意…
SkillBFreshness: BClaude Code +9 - 0.521score
pres-data-visualization-guide
vincent119
資料視覺化圖表選擇指南與資訊架構設計。提供圖表選擇矩陣、LATCH 資訊組織原則、數字格式化規範與色彩無障礙標準。適用於「圖表選擇」、「資料視覺化」、「資訊設計」、「Chart 類型」、「數據說故事」等視覺化表達任務。強化 info-architect 的設計能力。注意:圖表 BI 工具操作不在此技能範圍內。
SkillBFreshness: BClaude Code +9 - 0.518score
react-component-patterns
vincent119
React 元件設計模式。用於 Compound Components、Render Props、HOC、Polymorphic Components、Slot Pattern、受控/非受控元件設計。
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Sep 8, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/vincent119/ai-rules-kit
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from vincent119
- 0.526score
financial-health-risk
vincent119
財務健康風險分析完整流程。讀入財務報表(PDF 或數字),分析流動性、獲利能力、槓桿、現金流、Altman Z-Score、成長性,產出多維度風險評估報告與改善建議。適用於「財務健康檢查」、「分析這份財報」、「financial risk…
SkillBFreshness: BClaude Code +9 - 0.526score
sdd-skill
vincent119
SDD(Spec Driven Development)工作流程。用於在實作前建立 .specs 下的 requirements.md、design.md、tasks.md,規劃功能邊界、驗收條件、技術設計與實作任務,並在實作過程中依 tasks 追蹤進度。
SkillBFreshness: BClaude Code +9 - 0.524score
skill-creator
vincent119
Guide for creating effective skills.
SkillBFreshness: BClaude Code +9 - 0.523score
readme
vincent119
建立、改善或稽核 GitHub 專案的 README。僅在使用者明確要求 README、README 正確性、可讀性、範例或 README 稽核時使用;不處理完整文件站、純 API reference 或廣泛 repository 審查。
SkillBFreshness: BClaude Code +9 - 0.523score
technical-writing
vincent119
建立、改善或稽核 README 以外的技術文件,例如架構文件、操作手冊、教學、ADR 與概念說明。僅在使用者明確要求此類文件時使用;README 需求應使用 readme skill。
SkillBFreshness: BClaude Code +9 - 0.521score
pres-presentation-designer
vincent119
簡報設計完整製作流程。協調 5 個製作階段:故事結構 → 資訊設計 → 視覺設計 → 講者備稿 → 品質審查,最終產出完整的簡報套件。適用於「製作簡報」、「Presentation 規劃」、「PPT 製作」、「Slide Deck…
SkillBFreshness: BClaude Code +9
Cite this page
react-hooks-state skill. Agent Mart. https://agentmart.dev/skills/vincent119-react-hooks-state (last updated 2026-10-24)