<< All versions
Skill v1.0.0
currentAutomated scan100/100eduardbar/migestion/migestion-web
──Details
PublishedNovember 17, 2026 at 01:44 PM
Content Hashsha256:7ecc50c814c09c58...
Git SHA616bfc96df82
──Files
Files (1 file, 5.8 KB)
SKILL.md5.8 KBactive
SKILL.md · 258 lines · 5.8 KB
name: migestion-web description: > Frontend patterns for MiGestion Web - React, Vite, Zustand, design system. Trigger: When working on Web code (components, pages, stores, services). license: MIT metadata: author: migestion version: '1.0' scope: [web] auto_invoke: 'Creating new React components/pages' allowed-tools: Read, Edit, Write, Glob, Grep, Bash, WebFetch, WebSearch, Task
File Structure
src/├── components/│ └── ui/ # Reusable UI components (Button, Input, etc.)├── pages/ # Feature pages (ClientsPage, DashboardPage, etc.)│ └── example/│ ├── ExamplePage.tsx│ └── index.ts # Barrel export├── services/ # API service functions├── stores/ # Zustand state stores├── contexts/ # React contexts (Socket, etc.)├── hooks/ # Custom hooks (useAuth, etc.)├── lib/ # Utilities (cn, constants)└── types/ # Shared TypeScript types
Component Pattern
typescript
// ✅ ALWAYS: Named exportsexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(({ variant = 'primary', size = 'md', children, ...props }, ref) => {return (<buttonref={ref}className={cn(baseStyles, variantStyles[variant], sizeStyles[size])}{...props}>{children}</button>);});Button.displayName = 'Button';// ❌ NEVER: Default export (except pages)export default function Page() { } // OK for pages only
Page Pattern
Pages are default exports in feature folders.
typescript
// pages/example/ExamplePage.tsxexport default function ExamplePage() {return <div>Example Page</div>;}// pages/example/index.tsexport { default } from './ExamplePage';
Zustand Store Pattern
typescript
import { create } from 'zustand';interface ExampleState {// Stateitems: Item[];isLoading: boolean;error: string | null;// ActionsfetchItems: () => Promise<void>;addItem: (item: Item) => Promise<void>;}export const useExampleStore = create<ExampleState>((set, get) => ({// Initial stateitems: [],isLoading: false,error: null,// ActionsfetchItems: async () => {try {set({ isLoading: true, error: null });const items = await exampleService.getItems();set({ items, isLoading: false });} catch (error) {set({ error: error.message, isLoading: false });}},addItem: async item => {const newItem = await exampleService.createItem(item);set(state => ({ items: [...state.items, newItem] }));},}));
Service Pattern
Services handle API calls using TanStack Query pattern (or direct fetch).
typescript
import api from './api';export const exampleService = {async getItems(): Promise<Item[]> {const response = await api.get('/examples');return response.data;},async getItem(id: string): Promise<Item> {const response = await api.get(`/examples/${id}`);return response.data;},async createItem(data: CreateItemInput): Promise<Item> {const response = await api.post('/examples', data);return response.data;},};
Design System
Color Palette: Neutral scale (white, black, grays)
typescript
// ✅ ALWAYS: Use neutral colorsclassName = 'bg-neutral-900 text-white'; // PrimaryclassName = 'bg-white border-neutral-300'; // SecondaryclassName = 'bg-error-600 text-white'; // Danger// ❌ NEVER: No gradients in UIclassName = 'bg-gradient-to-r from-blue-500 to-purple-500'; // NO!
Typography: Clean, readable, enterprise-focused
Border-based: No heavy shadows
typescript
// ✅ ALWAYS: Border-based designclassName = 'border border-neutral-200 rounded';// ❌ NEVER: Heavy shadowsclassName = 'shadow-lg shadow-xl'; // NO!
Import Pattern
Use absolute imports with @/ alias.
typescript
// ✅ ALWAYS: Absolute importsimport { Button } from '@/components/ui/Button';import { useExampleStore } from '@/stores/example.store';import * as exampleService from '@/services/example.service';// ❌ NEVER: Relative imports (except within same folder)import { Button } from '../../../components/ui/Button';
Loading States
typescript
const { isLoading, items, fetchItems } = useExampleStore();useEffect(() => {fetchItems();}, []);if (isLoading) {return <Spinner />;}
Error Handling
typescript
const { error, clearError } = useExampleStore();if (error) {return (<Alert variant="error">{error}<button onClick={clearError}>Dismiss</button></Alert>);}
Hooks Pattern
typescript
export function useAuth() {const { user, token } = useAuthStore();return {isAuthenticated: !!token,user,logout: useAuthStore.getState().logout,};}
Context Pattern (Socket.IO)
typescript
const SocketContext = createContext<Socket | null>(null);export function SocketProvider({ children }: { children: ReactNode }) {const [socket, setSocket] = useState<Socket | null>(null);useEffect(() => {const newSocket = io(SOCKET_URL);setSocket(newSocket);return () => {newSocket.disconnect();};}, []);return <SocketContext.Provider value={socket}>{children}</SocketContext.Provider>;}
Commands
bash
npm run dev:web # Start dev servernpm run build:web # Buildnpm run test:web # Run testsnpm run test:e2e # Run E2E testsnpm run lint --workspace=@migestion/web # Lintnpm run typecheck # Type check
Related Skills
react-18- React component patternszustand-4- Zustand store patternstailwind- Tailwind CSS utilitiesvite- Vite build patternsmigestion-test-web- E2E testing patterns