.agent/skills/skills/frontend-dev-guidelines/SKILL.md
Frontend development guidelines for React/TypeScript applications. Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, MUI v7 styling, TanStack Router, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend code.
npx skillsauth add admin-baked/bakedbot-for-brands frontend-dev-guidelinesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive guide for modern React development, emphasizing Suspense-based data fetching, lazy loading, proper file organization, and performance optimization.
Creating a component? Follow this checklist:
React.FC<Props> pattern with TypeScriptReact.lazy(() => import())<SuspenseLoader> for loading statesuseSuspenseQuery for data fetching@/, ~types, ~components, ~featuresuseCallback for event handlers passed to childrenuseMuiSnackbar for user notificationsCreating a feature? Set up this structure:
features/{feature-name}/ directoryapi/, components/, hooks/, helpers/, types/api/{feature}Api.tstypes/routes/{feature-name}/index.tsxindex.ts| Alias | Resolves To | Example |
|-------|-------------|---------|
| @/ | src/ | import { apiClient } from '@/lib/apiClient' |
| ~types | src/types | import type { User } from '~types/user' |
| ~components | src/components | import { SuspenseLoader } from '~components/SuspenseLoader' |
| ~features | src/features | import { authApi } from '~features/auth' |
Defined in: vite.config.ts lines 180-185
// React & Lazy Loading
import React, { useState, useCallback, useMemo } from 'react';
const Heavy = React.lazy(() => import('./Heavy'));
// MUI Components
import { Box, Paper, Typography, Button, Grid } from '@mui/material';
import type { SxProps, Theme } from '@mui/material';
// TanStack Query (Suspense)
import { useSuspenseQuery, useQueryClient } from '@tanstack/react-query';
// TanStack Router
import { createFileRoute } from '@tanstack/react-router';
// Project Components
import { SuspenseLoader } from '~components/SuspenseLoader';
// Hooks
import { useAuth } from '@/hooks/useAuth';
import { useMuiSnackbar } from '@/hooks/useMuiSnackbar';
// Types
import type { Post } from '~types/post';
Modern React components use:
React.FC<Props> for type safetyReact.lazy() for code splittingSuspenseLoader for loading statesKey Concepts:
📖 Complete Guide: resources/component-patterns.md
PRIMARY PATTERN: useSuspenseQuery
isLoading checksAPI Service Layer:
features/{feature}/api/{feature}Api.tsapiClient axios instance/form/route (NOT /api/form/route)📖 Complete Guide: resources/data-fetching.md
features/ vs components/:
features/: Domain-specific (posts, comments, auth)components/: Truly reusable (SuspenseLoader, CustomAppBar)Feature Subdirectories:
features/
my-feature/
api/ # API service layer
components/ # Feature components
hooks/ # Custom hooks
helpers/ # Utility functions
types/ # TypeScript types
📖 Complete Guide: resources/file-organization.md
Inline vs Separate:
const styles: Record<string, SxProps<Theme>>100 lines: Separate
.styles.tsfile
Primary Method:
sx prop for MUI componentsSxProps<Theme>(theme) => theme.palette.primary.mainMUI v7 Grid:
<Grid size={{ xs: 12, md: 6 }}> // ✅ v7 syntax
<Grid xs={12} md={6}> // ❌ Old syntax
📖 Complete Guide: resources/styling-guide.md
TanStack Router - Folder-Based:
routes/my-route/index.tsxcreateFileRouteExample:
import { createFileRoute } from '@tanstack/react-router';
import { lazy } from 'react';
const MyPage = lazy(() => import('@/features/my-feature/components/MyPage'));
export const Route = createFileRoute('/my-route/')({
component: MyPage,
loader: () => ({ crumb: 'My Route' }),
});
📖 Complete Guide: resources/routing-guide.md
CRITICAL RULE: No Early Returns
// ❌ NEVER - Causes layout shift
if (isLoading) {
return <LoadingSpinner />;
}
// ✅ ALWAYS - Consistent layout
<SuspenseLoader>
<Content />
</SuspenseLoader>
Why: Prevents Cumulative Layout Shift (CLS), better UX
Error Handling:
useMuiSnackbar for user feedbackreact-toastifyonError callbacks📖 Complete Guide: resources/loading-and-error-states.md
Optimization Patterns:
useMemo: Expensive computations (filter, sort, map)useCallback: Event handlers passed to childrenReact.memo: Expensive components📖 Complete Guide: resources/performance.md
Standards:
any typeimport type { User } from '~types/user'📖 Complete Guide: resources/typescript-standards.md
Covered Topics:
useAuth hook for current user📖 Complete Guide: resources/common-patterns.md
Full working examples:
📖 Complete Guide: resources/complete-examples.md
| Need to... | Read this resource | |------------|-------------------| | Create a component | component-patterns.md | | Fetch data | data-fetching.md | | Organize files/folders | file-organization.md | | Style components | styling-guide.md | | Set up routing | routing-guide.md | | Handle loading/errors | loading-and-error-states.md | | Optimize performance | performance.md | | TypeScript types | typescript-standards.md | | Forms/Auth/DataGrid | common-patterns.md | | See full examples | complete-examples.md |
src/
features/
my-feature/
api/
myFeatureApi.ts # API service
components/
MyFeature.tsx # Main component
SubComponent.tsx # Related components
hooks/
useMyFeature.ts # Custom hooks
useSuspenseMyFeature.ts # Suspense hooks
helpers/
myFeatureHelpers.ts # Utilities
types/
index.ts # TypeScript types
index.ts # Public exports
components/
SuspenseLoader/
SuspenseLoader.tsx # Reusable loader
CustomAppBar/
CustomAppBar.tsx # Reusable app bar
routes/
my-route/
index.tsx # Route component
create/
index.tsx # Nested route
import React, { useState, useCallback } from 'react';
import { Box, Paper } from '@mui/material';
import { useSuspenseQuery } from '@tanstack/react-query';
import { featureApi } from '../api/featureApi';
import type { FeatureData } from '~types/feature';
interface MyComponentProps {
id: number;
onAction?: () => void;
}
export const MyComponent: React.FC<MyComponentProps> = ({ id, onAction }) => {
const [state, setState] = useState<string>('');
const { data } = useSuspenseQuery({
queryKey: ['feature', id],
queryFn: () => featureApi.getFeature(id),
});
const handleAction = useCallback(() => {
setState('updated');
onAction?.();
}, [onAction]);
return (
<Box sx={{ p: 2 }}>
<Paper sx={{ p: 3 }}>
{/* Content */}
</Paper>
</Box>
);
};
export default MyComponent;
For complete examples, see resources/complete-examples.md
Skill Status: Modular structure with progressive loading for optimal context management
testing
--- name: executive-brief description: Produce a concise executive brief or portfolio digest for a super user or operator — use when summarizing multi-account performance, cross-org anomalies, top actions needed, or weekly business status for leadership review. Trigger phrases: "executive summary", "weekly brief", "portfolio digest", "top actions this week", "what needs my attention", "board update", "cross-account summary". version: 0.1.0 owner: platform agent_owner: pops allowed_roles: - sup
development
--- name: anomaly-to-action-memo description: Interpret a detected anomaly or signal and produce a decision-ready action memo — use when an alert, metric deviation, or operational signal needs to be turned into a prioritized recommendation with evidence, owner, and next step. Trigger phrases: "what does this anomaly mean", "something looks off", "explain this alert", "revenue is down", "traffic dropped", "flag this for review", "what should we do about this". version: 0.1.0 owner: ops-intelligen
testing
--- name: brand-voice description: Apply BakedBot brand voice standards to any customer-facing content — use when generating or reviewing copy that must match a dispensary or brand's approved tone, language patterns, and messaging constraints. Trigger phrases: "does this match our voice", "write in our brand voice", "on-brand copy", "brand guidelines", "tone check". version: 0.1.0 owner: platform agent_owner: craig allowed_roles: - super_user - dispensary_operator - brand_operator outputs:
testing
--- name: sell-through-partner-analysis description: Analyze which retail dispensary partners are selling through a grower's products effectively, identify top performers and laggards, and produce a prioritized partner action plan. Use when a grower wants to know where their products move fastest, which partners need attention, and where to focus wholesale sales effort. Trigger phrases: "which partners are selling our product", "sell-through analysis", "partner performance", "where is inventory