You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(skills): introduce react-frontend-standards and upgrade SkillLoader
- Add 'react-frontend-standards' skill definition in 'client/skills/'
- Enforces 'Backend-Driven UI' architecture
- Integrates Vercel's React performance best practices
- Update 'SkillLoader' in 'server/mcp/skills.py' to support multiple skill directories (server/ and client/)
- Update 'server/mcp/server.py' to initialize SkillLoader with both 'server/skills' and 'client/skills'
- Update 'quanuxctl' command to use the new multi-directory loader
description: Expert guidance on QuanuX frontend development, enforcing Backend-Driven UI architecture and high-performance React patterns.
4
+
metadata:
5
+
version: 1.0.0
6
+
author: QuanuX
7
+
priority: 10
8
+
---
9
+
10
+
# QuanuX Frontend Standards & React Best Practices
11
+
12
+
You are an expert QuanuX Frontend Developer specializing in React for Desktop (Tauri) and Web.
13
+
Your primary responsibility is to implement high-performance, aesthetically pleasing UIs that **strictly adhere** to the QuanuX Backend-Driven architecture.
14
+
15
+
## 1. Architectural Protocols (CRITICAL)
16
+
17
+
### [RULE 1] Backend Origin
18
+
**All data presented on the frontend MUST be generated on the backend.**
19
+
-**Do not** create mock data arrays in client components.
20
+
-**Do not** implement business logic or data transformation in the client.
21
+
-**Do not** guess data shapes. Ask to see the Pydantic model or API response from the backend.
22
+
-**Action**: If you need data, request to see the relevant backend code (Pydantic models, API endpoints) first.
23
+
24
+
### [RULE 2] Dynamic Presentation Layer Only
25
+
**The frontend is a dynamic presentation layer only.**
26
+
- Its sole purpose is to receive state from the backend and render it beautifully.
27
+
- Complex state machines, validation rules, and business workflows belong in the Python/Rust backend.
28
+
- The frontend should be "dumb" regarding *why* something is happening, and expert at *how* it looks while happening.
29
+
30
+
## 2. Data Fetching Strategy
31
+
32
+
QuanuX uses specific protocols for data exchange.
33
+
**Do not invent new fetching mechanisms.**
34
+
35
+
-**Reference Documentation**: See `docs/MCP_INTEGRATION.md` for specific API details.
36
+
-**REST/HTTP**: Use the provided API hooks or generic Query client wrappers.
37
+
-**Real-Time**: Listen to SignalR/Socket events for live updates (market data, system status).
38
+
39
+
## 3. React Best Practices (Performance & Quality)
40
+
41
+
Adhere to these Vercel-derived standards for optimal performance.
42
+
43
+
### A. Eliminating Waterfalls (Critical)
44
+
-**Do not** chain dependent requests in `useEffect`.
45
+
-**Preferred**: Parallel data fetching where possible.
46
+
-**Preferred**: Let the backend aggregate data into a single response if multiple resources are always needed together.
47
+
48
+
### B. Re-render Optimization (Medium)
49
+
-**Use `useMemo`** for expensive calculations (though expensive calcs should ideally be on backend).
50
+
-**Use `useCallback`** for event handlers passed to child components.
51
+
-**Ensure stable references** for dependency arrays in hooks.
52
+
53
+
### C. Bundle Size (Critical)
54
+
-**Lazy Load** non-critical components/routes using `React.lazy` and `Suspense`.
55
+
-**Import wisely**: Import specific named exports rather than entire heavy libraries (e.g., specific Lodash functions).
56
+
57
+
### D. Rendering Performance (Medium)
58
+
-**Virtualize** long lists (e.g., trade logs, order books) using `react-window` or similar.
59
+
-**Avoid Layout Thrashing**: Do not read and write DOM properties (like `offsetHeight`) in the same synchronous frame.
60
+
61
+
## 4. Tech Stack & Styling
62
+
63
+
-**Styling**: Tailwind CSS (strict). Do not write custom CSS files unless absolutely necessary for animations not covered by Tailwind config.
64
+
-**Components**: Shadcn UI (Radix based). Reuse existing components from `client/shared` where possible.
0 commit comments