anhpht06/frontend-skill-pack/09-folder-structure

Claude Code and agent skill by anhpht06/frontend-skill-pack

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Cấu trúc thư mục tiêu chuẩn của dự án Next.js (my-nextjs-starter).

Install

npx vskill@latest install anhpht06/frontend-skill-pack/09-folder-structure

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as anhpht06/frontend-skill-pack/09-folder-structure.

Cấu Trúc Thư Mục (Folder Structure)

Dự án này áp dụng nguyên tắc Clean Architecture và Separation of Concerns để tách biệt rõ ràng giữa UI Logic và Pure Logic. Tất cả mã nguồn nằm trong thư mục src/.

1. Phân Rã Thư Mục Cơ Bản

  • src/app/: Next.js App Router. Chứa cấu trúc định tuyến (routes), layout, page, loading, error.
  • src/components/: Giao diện (UI Components).
  • ui/: Các component dùng chung (Button, Input) không chứa logic nghiệp vụ.
  • errors/: Các component xử lý lỗi màn hình (AppError, ErrorBoundary).
  • [feature]/: Các component đặc thù của từng tính năng.
  • src/config/: Cấu hình. Các file cấu hình biến môi trường, thiết lập thư viện bên ngoài.
  • src/constants/: Hằng số. Chứa các giá trị cố định, ví dụ routes.ts để định nghĩa URL. Tuyệt đối không hardcode string ở các nơi khác.
  • src/helpers/: Hàm tiện ích (Helpers/Utils). Các hàm thuần túy (pure functions) xử lý logic nhỏ, ví dụ: format ngày tháng, chuỗi, storage.
  • src/lib/: Wrappers cho thư viện ngoài. Nơi khởi tạo hoặc cấu hình các thư viện (ví dụ: utils cho Tailwind/clsx).
  • src/store/: Global State. Quản lý trạng thái UI toàn cục bằng Zustand. (Không dùng cho Server State).

2. Service Layer (Kiến trúc API & Server State)

Được chia làm 2 tầng rõ rệt: Tầng thuần Logic (không có React) và Tầng UI (chứa React Hooks).

Tầng 1: src/services/ (Tầng Pure Logic - Không dùng React Hook)

Nơi đây nghiêm cấm gọi các hook của React.

  • axios/: Nơi cấu hình Axios instance, interceptors, xử lý Refresh Token.
  • api/: Các hàm gọi API (Fetcher) và Mapper (Anti-Corruption Layer). Mọi dữ liệu BE trả về phải được làm sạch ở đây.
  • query/: Cấu hình của TanStack Query.
  • queries/: Chứa các hàm cấu hình trả về đối tượng queryOptions.
  • mutations/: Chứa các hàm cấu hình trả về đối tượng cài đặt cho mutation.
  • query-keys/: Nơi quản lý query keys tập trung (sử dụng thư viện query-key-factory).
Tầng 2: src/hooks/ (Tầng UI Logic - Kết nối React)

Chuyên dùng để gọi Hooks và xử lý tương tác trực tiếp với giao diện.

  • queries/: Các Custom Hooks bọc useQuery, lấy cấu hình từ tầng services/query/queries để hiển thị data ra UI.
  • mutations/: Các Custom Hooks bọc useMutation, lấy cấu hình từ services/query/mutations. Nơi đây xử lý các Side-effects như (Bắn Toast báo lỗi/thành công, Redirect chuyển trang...).
  • Chứa các custom hooks chung khác của React (useWindowSize, useDebounce, useAuth...).

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/anhpht06/frontend-skill-pack/09-folder-structure/badge)](https://verified-skill.com/skills/anhpht06/frontend-skill-pack/09-folder-structure)

Something wrong with this skill or its page? Tell us.