south-admin-react
CLAUDE.md582 starsChanged 17 days agoMITView on GitHub
This is a monorepo-based React admin application using pnpm workspaces, built with Vite, TypeScript, React 19, Ant Design, and Zustand. When installing new dependencies, use pnpm i <package> -w to install at the workspace root. Route rules: - File path src/pages/dashboard/index.tsx → route /dashboard - File path src/pages/dashboard/index.tsx → route / - Dynamic routes use [param] syntax: src/pages/user/[id].tsx → route /user/:id - All index.tsx files have /index removed from the route path Route configuration is in src/router/components/Router.tsx using handleRoutes() helper.
- Installs packages
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- demo-createSkill
- init-projectSkill
- demo-createSkill
- init-projectSkill
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 45
When installing new dependencies, use pnpm i <package> -w to install at the workspace root.
- Very specific: line 73
Important: Use useCommonStore() hook from src/hooks/useCommonStore.ts which combines all stores with useShallow for optimized re-renders:
- Very specific: line 88
If no rule is returned, menu always shows
- Very specific: line 109
All common components are in src/components/:
- Very specific: line 177
Create folder in src/pages/ (e.g., src/pages/log/)
- Very specific: line 178
Create model.ts - enter demoModel snippet
- Very specific: line 179
Create API in src/servers/log.ts - enter demoApi snippet
- Very specific: line 206
If commits fail, run npx husky install and retry.
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Commands
Development
pnpm dev # Start dev server (Vite with host flag)
pnpm build # Production build (TypeScript + Vite)
pnpm build:dev # Development build
pnpm build:test # Test environment buildCode Quality
pnpm lint # ESLint with auto-fix
pnpm lint:stylelint # Stylelint for CSS/Less
pnpm prettier # Format code with PrettierPackage Management
pnpm install -w # Install dependencies (use -w for monorepo root)
pnpm i <package> -w # Install new dependencies at workspace rootGit
npx husky install # Reinstall husky hooks if commit failsProject Architecture
This is a monorepo-based React admin application using pnpm workspaces, built with Vite, TypeScript, React 19, Ant Design, and Zustand.
Monorepo Structure
- Root: Main application in
src/ - packages/: Shared workspace packages
@south/request: HTTP request wrapper@south/message: Global messaging component@south/utils: Shared utilities@south/stylelint: Stylelint configuration
When installing new dependencies, use pnpm i <package> -w to install at the workspace root.
Automatic Route Generation
Routes are automatically generated from the src/pages/ directory structure using vite glob:
// src/router/utils/config.ts
export const ROUTER_EXCLUDE = [
'login', 'forget', 'components', 'utils', 'lib', 'hooks',
'model.tsx', '404.tsx'
];Route rules:
- File path
src/pages/dashboard/index.tsx→ route/dashboard - File path
src/pages/dashboard/index.tsx→ route/ - Dynamic routes use
[param]syntax:src/pages/user/[id].tsx→ route/user/:id - All
index.tsxfiles have/indexremoved from the route path
Route configuration is in src/router/components/Router.tsx using handleRoutes() helper.
State Management (Zustand)
Stores are in src/stores/:
useUserStore: User info, permissions, authenticationuseMenuStore: Menu state, collapse state, open keysuseTabsStore: Tab navigation, active tabsusePublicStore: Global app state (theme, fullscreen, refresh)
Important: Use useCommonStore() hook from src/hooks/useCommonStore.ts which combines all stores with useShallow for optimized re-renders:
const { permissions, theme, menuList, tabs } = useCommonStore();Permission System
Two-level permission system:
- Page-level permissions (from
/user/loginor/user/refresh-permissions):- Stored in
useUserStoreaspermissionsarray - Controls if user can access a page
- Stored in
- Menu-level permissions (from
/menu/list):rulefield in menu data controls menu visibility- If no
ruleis returned, menu always shows
Usage in pages:
const pagePermission: PagePermission = {
page: checkPermission('/xxx', permissions),
create: checkPermission('/xxx/create', permissions),
update: checkPermission('/xxx/update', permissions),
delete: checkPermission('/xxx/delete', permissions),
};See src/pages/system/menu/index.tsx for reference.
Menu Configuration
Two menu modes available (configured in src/hooks/useCommonStore.ts):
- Dynamic menu (default): From
/menu/listAPI - Static menu: Set
menuList = defaultMenususingimport { defaultMenus } from '@/menus'
Component Architecture
All common components are in src/components/:
Naming convention: Public/secondary wrappers use Base prefix (e.g., BaseTable, BaseForm, BaseModal).
Key components:
BaseTable: Enhanced table with virtual scrolling, column filtering, resizable columns, zebra stripingBaseForm: Form builder with component mappingBaseModal: Modal wrapper with loading statesBaseCard,BaseContent: Layout containers
Form Component System
Forms use a declarative BaseFormList schema:
const createList: BaseFormList[] = [
{
label: 'Name',
name: 'name',
rules: FORM_REQUIRED,
component: 'Input', // Mapped in components/Form/utils/componentMap.tsx
}
];Supported components are mapped in src/components/Form/utils/componentMap.tsx.
API Structure
APIs are in src/servers/ organized by feature:
import { request } from '@/utils/request';
enum API {
URL = '/xxx',
}
export function getXXXPage(data: PaginationData) {
return request.get<PageServerResult<T>>(`${API.URL}/page`, { params: data });
}Build Configuration
- Vite plugins in
build/plugins/index.ts - React SWC for fast compilation
- UnoCSS for atomic CSS
- Legacy plugin for browser compatibility (production only)
- Auto-import plugin configured in
build/plugins/autoImport.ts
Code Snippets
VS Code snippets are in .vscode/south.code-snippets:
demoPage: Complete page with table, pagination, CRUDdemoModel: Model file with search/form/table columnsdemoApi: API file with CRUD functionsdemoOptionPage: Single-page edit/create formloadHook,fetchhook,pagehook,apiFn: Utility snippets
KeepAlive
The app uses keepalive-for-react for tab caching. Key hooks:
useEffectOnActive(): Trigger when tab becomes activeuseSingleTab(): Configure single-page tabs
Internationalization
Uses react-i18next with i18next-browser-languagedetector and i18next-http-backend.
Translations in src/locales/{zh,en}/ by feature.
Important Patterns
Creating a New Page
- Create folder in
src/pages/(e.g.,src/pages/log/) - Create
model.ts- enterdemoModelsnippet - Create API in
src/servers/log.ts- enterdemoApisnippet - Create
index.tsx- enterdemoPagesnippet
Component Re-rendering
The project uses useShallow from Zustand to prevent unnecessary re-renders. Always prefer useCommonStore() over direct store access in components.
Virtual Scrolling Tables
Enable with isVirtual prop on BaseTable. Automatically calculates height and uses react-window for performance.
Icon System
Uses Iconify with @iconify/react. Browse icons at https://icon-sets.iconify.design/
Install "Iconify IntelliSense" extension for inline preview and autocomplete.
Git Commit Convention
Commits must follow conventional format enforced by husky:
feat: New featurefix: Bug fixperf: Performance optimizationrefactor: Code refactoringstyle: Code styledocs: Documentationchore: Dependency/config changestest: Teststypes: TypeScript types
Example: git commit -m "feat: add user management"
If commits fail, run npx husky install and retry.
TypeScript Configuration
@/*→src/*#/*→types/*- Strict mode enabled with unused locals/variables checking
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

