Skillpedia
المواقع والواجهات (frontend)48k · #4224

composition-patterns

ما الذي تفعله

تساعد هذه المهارة على تنظيم مكونات البرمجيات وبنائها بكفاءة أكبر وبشكل أوضح. تقترح طرقًا لذلك تجعل الكود أبسط في الإدارة، خاصة مع نمو المشروع.

متى تستخدمها

  • ✓عندما يكون لدي مكوّن يحتوي على خيارات كثيرة من نوع «نعم/لا» لتغيير سلوكه.
  • ✓عندما أنشئ مجموعة من المكونات لاستخدامها في أماكن متعددة.
  • ✓عندما أفكر في كيفية تفاعل أجزاء برنامجي المختلفة.

رابط المهارة

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/composition-patterns/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/composition-patterns/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“كيف يمكنني تنظيم مكونات الواجهة بشكل أفضل، لتكون سهلة إعادة الاستخدام والفهم؟”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

تحلل المهارة طريقة بناء مكوناتك، وتقترح أنماطًا مثل تجميع المكونات المرتبطة ببعضها، أو نقل المعلومات المهمة إلى مكان مركزي. وهذا يتجنب الحاجة إلى إعدادات كثيرة لكل مكون.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

React Composition Patterns

Composition patterns for building flexible, maintainable React components. Avoid boolean prop proliferation by using compound components, lifting state, and composing internals. These patterns make codebases easier for both humans and AI agents to work with as they scale.

When to Use

Reference these guidelines when:

  • Refactoring components with many boolean props
  • Building reusable component libraries
  • Designing flexible component APIs
  • Reviewing component architecture
  • Working with compound components or context providers

Rule Categories by Priority

Priority Category Impact Prefix
1 Component Architecture HIGH architecture-
2 State Management MEDIUM state-
3 Implementation Patterns MEDIUM patterns-
4 React 19 APIs MEDIUM react19-

Quick Reference

1. Component Architecture (HIGH)

  • architecture-avoid-boolean-props - Don't add boolean props to customize behavior; use composition
  • architecture-compound-components - Structure complex components with shared context

2. State Management (MEDIUM)

  • state-decouple-implementation - Provider is the only place that knows how state is managed
  • state-context-interface - Define generic interface with state, actions, meta for dependency injection
  • state-lift-state - Move state into provider components for sibling access

3. Implementation Patterns (MEDIUM)

  • patterns-explicit-variants - Create explicit variant components instead of boolean modes
  • patterns-children-over-render-props - Use children for composition instead of renderX props

4. React 19 APIs (MEDIUM)

⚠️ React 19+ only. Skip this section if using React 18 or earlier.

  • react19-no-forwardref - Don't use forwardRef; use use() instead of useContext()

How to Use

Read individual rule files for detailed explanations and code examples:

rules/architecture-avoid-boolean-props.md
rules/state-context-interface.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
الأسئلة الشائعة

ما هو «تضخم خصائص boolean»؟

يحدث عندما يملك المكوّن خيارات «نعم» أو «لا» كثيرة لتغيير طريقة عمله، مما يجعله معقدًا في الاستخدام.

ما هي «المكونات المركّبة» (compound components)؟

هي مكونات تعمل معًا كفريق، وتتشارك المعلومات والسياق، مثل نموذج يضم حقولًا متعددة تتواصل فيما بينها.

لماذا تنظيم المكونات مهم؟

المكونات المنظمة جيدًا أسهل في الفهم والاستخدام والتعديل، وهي توفر الوقت وتمنع الأخطاء، خاصة في المشاريع الكبيرة.

التفاصيل

الوصف الأصلي من المؤلف

Use when working with composition-patterns tasks or workflows

repo: sickn33/agentic-awesome-skills

الشعبية

نجوم GitHub
48k
الترتيب
#4224
الترخيص
MIT
آخر تحديث
15‏/10‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة