Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)40k · #7382

react-container-presentation-component

Skill này làm gì

Công cụ này tạo các component mã cho website hoặc ứng dụng viết bằng React. Nó giúp sắp xếp mã theo một mô hình cụ thể gọi là “Container/Presentation”.

Khi nào nên dùng

  • ✓Khi bạn muốn tạo một component mã mới cho dự án React.
  • ✓Khi bạn cần sắp xếp mã dự án tốt hơn theo mô hình này.
  • ✓Khi bạn muốn đảm bảo mã tuân theo các quy tắc tổ chức và kiểu dáng đã đặt ra.

Liên kết skill

https://github.com/github/awesome-copilot/blob/main/skills/react-container-presentation-component/SKILL.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/github/awesome-copilot/blob/main/skills/react-container-presentation-component/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tạo một component React tên “UserProfile” theo mô hình Container/Presentation, phân loại là “ui”.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Bạn cung cấp tên component và cho biết nó thuộc loại “ui” (giao diện) hay “features” (chức năng). Sau đó công cụ tạo các tệp cần thiết, tuân theo cách tổ chức và quy tắc kiểu dáng của dự án.

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.

Container/Presentation Component

Use this skill to create a React component under src/components that follows the Container/Presentation pattern.

Refer to this skill's bundled references for detailed rules.

  • references/component-architecture.md
  • references/typescript-and-scss-rules.md

If the /react-container-presentation-component input is incomplete, ask questions first before creating files.

When To Use

  • When the user runs /react-container-presentation-component
  • When the user explicitly asks for a React component that follows the Container/Presentation pattern
  • When the user wants help deciding or implementing ui vs features classification within the Container/Presentation pattern

Required Questions

If any of the following information is missing, ask the user using ask_user.

  1. Component name
  2. Type (ui or features)
  3. Whether to replace existing components (only when creating ui)

Question requirements:

  • Provide the type as options (ui, features)
  • Require the component name to be in PascalCase
  • For ui, ask whether direct usage of Mantine or other UI libraries in existing features should be replaced with the new component

Procedure

  1. Check existing components
  • Check whether src/components/ui/<ComponentName> or src/components/features/<ComponentName> already exists.
  • If it exists, do not overwrite; confirm the preferred approach with the user.
  1. Decide target directory
  • ui: src/components/ui/<ComponentName>
  • features: src/components/features/<ComponentName>
  1. Re-check classification (only when ui is specified)
  • Even when ui is specified, before creating files, review Reclassification Rule in references/component-architecture.md.
  • If the implementation includes state management, side effects, async processing, context/store updates, or business logic, treat it as features.
  • If the result is closer to features, do not proceed as ui; use ask_user and confirm one of the following before continuing.
    • Create as features
    • Keep ui and move state/logic to parent or features
  1. Create required files
  • ui: index.tsx, index.module.scss, index.stories.tsx
  • features: index.tsx, use<ComponentName>.tsx, presentation.tsx, types.ts, presentation.module.scss, presentation.stories.tsx
  1. Replace existing usages (only when creating ui)
  • Only when the user approves, replace equivalent direct implementations using Mantine or other UI libraries in existing features with the new ui component.
  1. Validate
  • Run build and lint commands, and ensure both pass; if issues are introduced by newly added or updated files, fix them.
  • Follow Storybook Minimum in references/component-architecture.md for story state decisions.
  • Ask the user via ask_user whether to run a Storybook check (for example: "Run" / "Skip for now").
  • Run npm run storybook only if the user selects "Run".
  • If the user selects "Skip for now", explicitly mention in the final report that Storybook execution was skipped.

Output Contract

  • Report the list of files created.
  • If replacements were performed, report the list of changed files and replacement details.
  • Provide one usage example of the created component.
  • Report whether Storybook verification was executed (run/skip), and if run, include the command used.
  • Explain why the component was classified as ui or features.
  • Summarize where state, side effects, and rendering responsibilities were placed.
  • Confirm whether there were any dependency direction violations.
  • Clearly state any unresolved items.
Câu hỏi thường gặp

Mô hình Container/Presentation là gì?

Đây là cách sắp xếp mã trong đó một component (“container”) xử lý logic và dữ liệu, còn component khác (“presentation”) chỉ lo cách hiển thị lên màn hình.

“ui” và “features” là gì?

Component “ui” chỉ phục vụ giao diện, như nút bấm hoặc ô nhập văn bản. Component “features” có logic, chẳng hạn lấy dữ liệu hoặc quản lý một biểu mẫu.

Điều gì xảy ra nếu đã có component cùng tên?

Công cụ sẽ không ghi đè tự động. Nó sẽ hỏi bạn muốn làm gì, chẳng hạn đổi tên hoặc không tạo component đó.

Chi tiết

Mô tả gốc của tác giả

Create a React component using the Container/Presentation pattern in src/components by asking for the component name and type (ui or features), then scaffold files that follow this repository's TypeScript, Storybook, and SCSS conventions. Use when the user explicitly asks for a Container/Presentation-based component or runs /react-container-presentation-component.

repo: github/awesome-copilot

Độ phổ biến

Sao GitHub
40k
Vị trí xếp hạng
#7382
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự