VidyFoo/antigravity-skill-engine / .agent/skills/1-dev/fullstack-guide
fullstack-guide
Verified全栈开发规范百科全书 (React/TS/Node/Supabase). Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend/backend code.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 4.5 KB |
| resources/common-patterns.md | markdown | 4.8 KB |
| resources/component-patterns.md | markdown | 4.5 KB |
| resources/data-fetching.md | markdown | 5.4 KB |
| resources/file-organization.md | markdown | 4.9 KB |
| resources/loading-and-error-states.md | markdown | 5.5 KB |
| resources/resources/architecture-overview.md | markdown | 7.8 KB |
| resources/resources/async-and-errors.md | markdown | 6.1 KB |
| resources/resources/testing-guide.md | markdown | 6.9 KB |
| resources/resources/validation-patterns.md | markdown | 7.8 KB |
| resources/routing-guide.md | markdown | 4.7 KB |
| resources/styling-guide.md | markdown | 4.6 KB |
| resources/typescript-standards.md | markdown | 5.4 KB |
SKILL.md
View on GitHub---
name: fullstack-guide
description: 全栈开发规范百科全书 (React/TS/Node/Supabase). Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend/backend code.
---
# Frontend Development Guidelines
## Purpose
Comprehensive guide for modern React development, emphasizing Suspense-based data fetching, lazy loading, proper file organization, and performance optimization.
## When to Use This Skill
- Creating new components or pages
- Building new features
- Fetching data with TanStack Query
- Setting up routing with TanStack Router
- Styling components with MUI v7
- Performance optimization
- Organizing frontend code
- TypeScript best practices
---
## Quick Start
### New Component Checklist
Creating a component? Follow this checklist:
- [ ] Use `React.FC<Props>` pattern with TypeScript
- [ ] Lazy load if heavy component: `React.lazy(() => import())`
- [ ] Wrap in `<SuspenseLoader>` for loading states
- [ ] Use `useSuspenseQuery` for data fetching
- [ ] Import aliases (@/, ~types, ~components)
- [ ] Event handlers with `useCallback`
- [ ] No early returns for loading states
---
## Core Patterns
### Component Pattern
```typescript
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;
```
### Data Fetching
```typescript
// Use useSuspenseQuery - No isLoading checks needed!
const { data } = useSuspenseQuery({
queryKey: ['myEntity', id],
queryFn: () => myFeatureApi.getEntity(id),
});
// data is ALWAYS defined (Suspense handles loading)
```
### Lazy Loading
```typescript
// Lazy load heavy components
const HeavyComponent = React.lazy(() => import('./HeavyComponent'));
// Wrap in SuspenseLoader
<SuspenseLoader>
<HeavyComponent />
</SuspenseLoader>
```
---
## Anti-Patterns
### ❌ NEVER
- Early returns for loading states (causes layout shift)
- Use `any` type
- Use `makeStyles` or `styled()` (use `sx` prop)
- Use `react-toastify` (use `useMuiSnackbar`)
- Direct API calls for auth (use `useAuth` hook)
### ✅ ALWAYS
- `React.FC<Props>` with TypeScript
- `useSuspenseQuery` for data fetching
- Suspense boundaries for loading states
- MUI v7 `sx` prop for styling
- Import type for type imports
---
## File Organization
### features/ Directory
For domain-specific features with own logic and API:
```
features/
my-feature/
api/
myFeatureApi.ts
components/
MyFeatureMain.tsx
hooks/
useMyFeature.ts
types/
index.ts
index.ts
```
### components/ Directory
For truly reusable UI components:
```
components/
SuspenseLoader/
CustomAppBar/
ErrorBoundary/
```
---
## Resource Files
| Topic | File |
|-------|------|
| Common patterns | [common-patterns.md](resources/common-patterns.md) |
| Component patterns | [component-patterns.md](resources/component-patterns.md) |
| Data fetching | [data-fetching.md](resources/data-fetching.md) |
| File organization | [file-organization.md](resources/file-organization.md) |
| Loading and errors | [loading-and-error-states.md](resources/loading-and-error-states.md) |
| Routing guide | [routing-guide.md](resources/routing-guide.md) |
| Styling guide | [styling-guide.md](resources/styling-guide.md) |
| TypeScript standards | [typescript-standards.md](resources/typescript-standards.md) |
---
## Related Skills
- **frontend-design**: Visual design and aesthetics
- **backend-dev-guidelines**: Backend API patterns that frontend consumes
---
**Skill Status**: COMPLETE ✅
**Line Count**: < 500 ✅
**Progressive Disclosure**: 8 resource files ✅
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |