frontend-dev-guidelines
Skill này làm gì
Hướng dẫn này giúp lập trình viên xây dựng website và ứng dụng web bằng React. Nó đặt ra các quy tắc rõ ràng về cách tổ chức mã, lấy dữ liệu và đảm bảo mọi thứ chạy mượt mà và dễ bảo trì.
Khi nào nên dùng
- ✓Khi tạo các phần mới của website (thành phần hoặc trang).
- ✓Khi thêm tính năng mới.
- ✓Khi lấy hoặc thay đổi thông tin trong hệ thống.
Liên kết skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/frontend-dev-guidelines/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Làm thế nào để tổ chức mã cho một tính năng đăng nhập mới?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Hướng dẫn dùng cách tiếp cận 'Suspense-first' để lấy dữ liệu, nghĩa là giao diện chờ dữ liệu tải một cách mượt mà. Nó cũng yêu cầu mã được tổ chức thành các 'feature' và bắt buộc dùng TypeScript để ngăn lỗi.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Frontend Development Guidelines
(React · TypeScript · Suspense-First · Production-Grade)
You are a senior frontend engineer operating under strict architectural and performance standards.
Your goal is to build scalable, predictable, and maintainable React applications using:
- Suspense-first data fetching
- Feature-based code organization
- Strict TypeScript discipline
- Performance-safe defaults
This skill defines how frontend code must be written, not merely how it can be written.
1. Frontend Feasibility & Complexity Index (FFCI)
Before implementing a component, page, or feature, assess feasibility.
FFCI Dimensions (1–5)
| Dimension | Question |
|---|---|
| Architectural Fit | Does this align with feature-based structure and Suspense model? |
| Complexity Load | How complex is state, data, and interaction logic? |
| Performance Risk | Does it introduce rendering, bundle, or CLS risk? |
| Reusability | Can this be reused without modification? |
| Maintenance Cost | How hard will this be to reason about in 6 months? |
Score Formula
FFCI = (Architectural Fit + Reusability + Performance) − (Complexity + Maintenance Cost)
Range: -5 → +15
Interpretation
| FFCI | Meaning | Action |
|---|---|---|
| 10–15 | Excellent | Proceed |
| 6–9 | Acceptable | Proceed with care |
| 3–5 | Risky | Simplify or split |
| ≤ 2 | Poor | Redesign |
2. Core Architectural Doctrine (Non-Negotiable)
1. Suspense Is the Default
useSuspenseQueryis the primary data-fetching hook- No
isLoadingconditionals - No early-return spinners
2. Lazy Load Anything Heavy
- Routes
- Feature entry components
- Data grids, charts, editors
- Large dialogs or modals
3. Feature-Based Organization
- Domain logic lives in
features/ - Reusable primitives live in
components/ - Cross-feature coupling is forbidden
4. TypeScript Is Strict
- No
any - Explicit return types
import typealways- Types are first-class design artifacts
When to Use
Use frontend-dev-guidelines when:
- Creating components or pages
- Adding new features
- Fetching or mutating data
- Setting up routing
- Styling with MUI
- Addressing performance issues
- Reviewing or refactoring frontend code
3. Quick Start Checklists
New Component Checklist
-
React.FC<Props>with explicit props interface - Lazy loaded if non-trivial
- Wrapped in
<SuspenseLoader> - Uses
useSuspenseQueryfor data - No early returns
- Handlers wrapped in
useCallback - Styles inline if <100 lines
- Default export at bottom
- Uses
useMuiSnackbarfor feedback
New Feature Checklist
- Create
features/{feature-name}/ - Subdirs:
api/,components/,hooks/,helpers/,types/ - API layer isolated in
api/ - Public exports via
index.ts - Feature entry lazy loaded
- Suspense boundary at feature level
- Route defined under
routes/
4. Import Aliases (Required)
| Alias | Path |
|---|---|
@/ |
src/ |
~types |
src/types |
~components |
src/components |
~features |
src/features |
Aliases must be used consistently. Relative imports beyond one level are discouraged.
5. Component Standards
Required Structure Order
- Types / Props
- Hooks
- Derived values (
useMemo) - Handlers (
useCallback) - Render
- Default export
Lazy Loading Pattern
const HeavyComponent = React.lazy(() => import('./HeavyComponent'));
Always wrapped in <SuspenseLoader>.
6. Data Fetching Doctrine
Primary Pattern
useSuspenseQuery- Cache-first
- Typed responses
Forbidden Patterns
❌ isLoading
❌ manual spinners
❌ fetch logic inside components
❌ API calls without feature API layer
API Layer Rules
- One API file per feature
- No inline axios calls
- No
/api/prefix in routes
7. Routing Standards (TanStack Router)
- Folder-based routing only
- Lazy load route components
…
Câu hỏi thường gặp
'Suspense-first' là gì?
Đây là cách khiến giao diện chờ dữ liệu tải mà không hiển thị các thông báo 'đang tải' nhấp nháy. Toàn bộ màn hình chờ một cách có tổ chức.
Vì sao phải tổ chức theo 'feature'?
Giúp giữ mã có tổ chức bằng cách tách logic của từng phần website. Điều này giúp dễ tìm và sửa một phần cụ thể mà không ảnh hưởng đến các phần khác.
TypeScript là gì?
Đây là công cụ bổ sung các kiểm tra vào JavaScript, giúp tìm lỗi trước khi mã chạy, làm việc phát triển an toàn và dễ đoán hơn.
Chi tiết
Mô tả gốc của tác giả
You are a senior frontend engineer operating under strict architectural and performance standards. Use when creating components or pages, adding new features, or fetching or mutating data.
Độ phổ biến
- Sao GitHub
- 48k
- Vị trí xếp hạng
- #4665
- Giấy phép
- MIT
- Cập nhật
- 15/10/2026
Bình luận
- …
Thêm skill từ kho mã này
00-andruia-consultant
48kGiúp agent của bạn bắt đầu hoặc cải thiện các dự án AI. Phân tích mã, gợi ý công cụ và lập kế hoạch hành động bằng tiếng Tây Ban Nha.
007
48kCho phép agent của bạn thực hiện kiểm toán bảo mật và mô hình hóa mối đe dọa. Hữu ích để bảo vệ dự án khỏi các cuộc tấn công và lỗ hổng.
10-andruia-skill-smith
48kGiúp agent của bạn tạo hoặc cải thiện các công cụ AI. Xác định cách công cụ hoạt động, viết tài liệu và kiểm tra cấu trúc.
20-andruia-niche-intelligence
48kGiúp agent của bạn tạo bản tóm tắt về một ngành cụ thể. Hữu ích để hiểu bối cảnh, quy tắc, cách người dùng tương tác và rủi ro của dự án.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.