Agent skill
web-frontend
(ePost) Use when working with .tsx/.jsx files, React components, hooks, state management, or frontend UI
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/web-frontend
Metadata
Additional technical details for this skill
- keywords
-
react frontend ui hooks components state typescript redux
- triggers
-
[ ".tsx", ".jsx", "react", "frontend", "ui component", "redux", "hook" ] - platforms
-
[ "web" ] - agent affinity
-
[ "epost-fullstack-developer", "epost-tester", "epost-debugger", "epost-code-reviewer" ]
SKILL.md
Frontend Development — React/Redux Patterns
Purpose
React 18 + TypeScript frontend patterns. Covers Redux Toolkit (dual-store), session management, component composition, hooks, and render optimization.
State Management — Redux Toolkit
Uses two Redux stores:
Global Store (persisted, app-wide)
Location: libs/utils/src/redux/store.ts
import { configureStore } from '@reduxjs/toolkit';
import { persistReducer, persistStore } from 'redux-persist';
const rootReducer = combineReducers({
selectedItemReducer: itemSlice,
fileReducer: uploadSlice,
userPreferencesReducer: userPreferencesSlice,
// Add your app-wide reducers here
});
export const store = configureStore({
reducer: persistReducer(persistConfig, rootReducer),
middleware: getDefaultMiddleware =>
getDefaultMiddleware({ serializableCheck: false }),
});
export type RootState = ReturnType<typeof store.getState>;
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;
Mounted via ReduxProvider (with PersistGate) in root locale layout.
Feature Store (scoped, RTK Query)
Location: app/[locale]/(auth)/feature-name/_stores/feature-store.tsx
Own configureStore + Provider, scoped to the feature layout:
export const store = configureStore({
reducer: {
listReducer, filterReducer, selectionReducer,
[featureApi.reducerPath]: featureApi.reducer,
},
middleware: getDefaultMiddleware =>
getDefaultMiddleware({ serializableCheck: false })
.concat(featureApi.middleware),
});
Slice Template
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
const initialState = { selectedItem: { id: '', name: '' } };
export const selectedItem = createSlice({
name: 'selectedItem',
initialState,
reducers: {
removeItem: () => initialState,
setItem: (state, action: PayloadAction<{ id: string; name: string }>) => ({
selectedItem: action.payload,
}),
},
});
export const { removeItem, setItem } = selectedItem.actions;
export default selectedItem.reducer;
Selector Best Practices
See references/render-optimization.md for selector patterns and memoization.
Provider Nesting Order
See web-auth skill for provider nesting order.
Component Patterns
forwardRef + displayName
'use client';
import { forwardRef, Ref, useImperativeHandle } from 'react';
const SearchField = forwardRef((props: ISearchFieldProps, ref: Ref<ICustomSearchFieldRef>) => {
useImperativeHandle(ref, () => ({
setValue: setSearchValue,
focus: () => inputRef.current?.focus(),
}));
return <TextField {...textFieldProps} />;
});
SearchField.displayName = 'SearchField'; // Always set for DevTools
Compound Components (klara-theme pattern)
See references/composition.md for compound component patterns.
Explicit Variants (not boolean props)
See references/composition.md for explicit variant patterns.
Hook Patterns
Utility Hook (no React state)
export const useSessionData = () => {
const getSessionFields = (session: ExtendedSession | null) => ({
isAuthenticated: !!session?.accessToken,
organizationId: session?.organizationId ?? '',
roles: session?.roles ?? [],
});
return { getSessionFields };
};
Hook with Effect + Cleanup
export const useWebSocketMembers = (socket: WebSocket, channelId: string) => {
const [members, setMembers] = useState<Member[]>([]);
useEffect(() => {
const handleMessage = (event: MessageEvent) => { /* update members */ };
socket.addEventListener('message', handleMessage);
return () => socket.removeEventListener('message', handleMessage);
}, [socket, channelId]);
return { members };
};
Context Hook with Guard
const SelectedRoom = createContext<Room | null>(null);
export const SelectedRoomProvider = SelectedRoom.Provider;
export function useSelectedRoom(): Room {
const room = useContext(SelectedRoom);
if (!room) throw new Error('Room not found!');
return room;
}
Build Commands
npm run dev # Development server
npm run build # Production build
npm run lint # ESLint
npx tsc --noEmit # Type check
npm test # Unit tests (Jest + RTL)
npx playwright test # E2E tests
Reference Files
| File | Purpose |
|---|---|
references/composition.md |
Compound components, state decoupling, children composition |
references/render-optimization.md |
React.memo, derived state, transitions, lazy init |
Sub-Skill Routing
When this skill is active and user intent matches a sub-skill, delegate:
| Intent | Sub-Skill | When |
|---|---|---|
| Next.js patterns | web-nextjs |
App Router, Server Components, RSC |
| API routes | web-api-routes |
API endpoints, server actions |
| Module integration | web-modules |
B2B module patterns |
| Prototyping | web-prototype |
/convert, rapid prototype |
| RAG search | web-rag |
Vector search web codebase |
| i18n | web-i18n |
Translations, locale routing |
| Auth | web-auth |
Session, OAuth, feature flags |
| Testing | web-testing |
Jest, Playwright, coverage |
Rules
- Use Redux Toolkit for state — NOT Zustand, NOT React Query
- Use
useAppSelectorwith narrow selectors — subscribe to booleans, not objects - Always set
displayNameonforwardRefcomponents - Use explicit variant props (via
cva()), not boolean props - Keep components under 200 lines
- Mobile-first responsive design with Tailwind
- WCAG AA accessibility
- React 18 only — do NOT use React 19 features (
use(),<Activity>, no-forwardRef)
Dependencies
- React 18+
- TypeScript
- Redux Toolkit + redux-persist
- React Testing Library
- Tailwind CSS (styling)
- klara-theme (UI components)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?