AgentSkillsCN

screen-structure-checker

依据集中式管理架构,对screens目录结构进行深度检查的技能。当您需要:(1) 审核新创建的screen结构;(2) 检查项目中的所有screen;(3) 查找违反命名规范的文件;(4) 发现因文件过大而亟需重构的文件时,可启用此技能。

SKILL.md
--- frontmatter
name: screen-structure-checker
description: Skill kiểm tra cấu trúc thư mục screens theo kiến trúc quản lý tập trung. Sử dụng khi cần (1) audit cấu trúc screen mới tạo, (2) kiểm tra toàn bộ screens trong dự án, (3) tìm các vi phạm naming convention, (4) phát hiện file cần refactor do quá lớn.

Screen Structure Checker

Skill này kiểm tra cấu trúc thư mục của các screen components để đảm bảo tuân thủ kiến trúc quản lý tập trung.

Mục Đích

  • Audit cấu trúc: Quét và đánh giá cấu trúc thư mục screens
  • Phát hiện vi phạm: Tìm các screen không tuân theo kiến trúc chuẩn
  • Đề xuất cải thiện: Gợi ý cách sửa cho từng vi phạm
  • Báo cáo chi tiết: Xuất kết quả dạng dễ đọc

Khi Nào Sử Dụng

Skill này nên được trigger khi:

  • Người dùng hỏi về "kiểm tra cấu trúc screen"
  • Người dùng yêu cầu "audit screens" hoặc "validate structure"
  • Cần review code quality của screens
  • Tạo screen mới và muốn kiểm tra đúng convention

Cách Sử Dụng

1. Kiểm Tra Một Screen Cụ Thể

Chạy script với đường dẫn đến thư mục screen:

bash
python3 scripts/check_structure.py /path/to/screens/ScreenName

Output mẫu:

code
📊 Screen Structure Report: home-screen
========================================

✅ PASSED (4/6 rules)
├─ ✅ Has index.tsx or main component
├─ ✅ Has components/ directory
├─ ✅ Has hooks/ directory
├─ ⚠️ Missing types/ directory
├─ ✅ Correct naming convention
└─ ⚠️ 2 files exceed 200 lines

🔧 Recommendations:
1. Create types/ directory for TypeScript interfaces
2. Refactor index.tsx (476 lines) - consider splitting

2. Kiểm Tra Toàn Bộ Screens

bash
python3 scripts/check_structure.py /path/to/screens --all

3. Xuất Báo Cáo JSON

bash
python3 scripts/check_structure.py /path/to/screens/ScreenName --json

Các Rules Kiểm Tra

RuleMô tảSeverity
has_main_componentindex.tsx hoặc {ScreenName}.tsx❌ Error
has_components_dirCó thư mục components/⚠️ Warning
has_hooks_dirCó thư mục hooks/⚠️ Warning
has_types_dirCó thư mục types/💡 Info
naming_conventionFile/folder đúng convention❌ Error
file_size_limitKhông có file > 200 lines⚠️ Warning
barrel_exportsindex.ts trong sub-dirs💡 Info

Kiến Trúc Chuẩn

Tham khảo chi tiết tại references/architecture-rules.md.

text
{ScreenName}/
├── index.tsx              # Component chính (BẮT BUỘC)
├── components/            # Sub-components
│   ├── cards/
│   ├── sections/
│   └── index.ts           # Barrel export
├── hooks/                 # Custom hooks
│   ├── useScreenData.ts
│   └── index.ts
├── types/                 # TypeScript types
├── utils/                 # Helper functions
├── constants/             # Constants
└── README.md              # Documentation

Tích Hợp Với Workflow

Skill này hoạt động tốt với:

  • /implement-workflow: Verify screen mới tạo đúng cấu trúc
  • /ultra-think: Phân tích chi tiết các vi phạm
  • /ui-ux-pro-max: Đảm bảo components được tổ chức đúng