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

naming-conventions

ما الذي تفعله

تراجع هذه المهارة أسماء فئات CSS وتقترح نمطًا ثابتًا مثل BEM. وهي موجهة إلى مطوّري الواجهات والفرق التي تريد أنماطًا سهلة الإيجاد والتعديل.

متى تستخدمها

  • ✓عندما تطلب من الوكيل تنظيف أسماء فئات CSS وتوحيدها.
  • ✓عندما يصعب فهم وظيفة الفئة وتتعارض الأنماط بين المكونات.
  • ✓عندما تبدأ مشروعًا جديدًا وتريد اتفاقية تسمية واضحة من البداية.

رابط المهارة

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/naming-conventions/SKILL.md

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

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

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

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

استخدم هذه المهارة لمساعدتي: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/naming-conventions/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

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

“أسماء فئات CSS في مشروعي فوضوية. هل يمكنك إعادة تسميتها وفق نمط ثابت مثل BEM؟”

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

كيف تعمل

يراجع الوكيل أسماء الفئات في ملفات الأنماط ويعيد كتابتها بصيغ الكتلة والعنصر والمعدِّل. ويبقي الأسماء بصيغة kebab-case ويفصل فئات الأدوات عن أنماط المكونات.

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

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

Use consistent CSS naming conventions

Without a naming convention, class names become a guessing game — does .active mean the nav item is active, the button is pressed, or a form field has focus? With BEM or a similar methodology, .button--active is unambiguous. This reduces the time spent searching for existing styles and prevents accidental style conflicts.

Quick Reference

  • BEM (Block__Element--Modifier) is the most widely adopted naming convention
  • Consistent naming lets you understand a class's purpose without reading its styles
  • Namespace utility classes and JS hooks separately from component styles
  • Use kebab-case for class names (not camelCase or snake_case)

Check

Audit the class names in this CSS file. Are they consistently named? Do they follow a clear convention? Are there any ambiguous names that could conflict?

Fix

Rename classes to follow BEM methodology: Block, Block__Element, Block--Modifier pattern.

Explain

Explain BEM naming convention, why naming conventions matter, and how to apply BEM to a real component.

Code Review

Review stylesheets, component styles, and responsive states related to Use consistent CSS naming conventions. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/css/naming-conventions

الأسئلة الشائعة

ما هو BEM؟

BEM اختصار لـ Block وElement وModifier، وهو يمنح أسماء الفئات بنية واضحة مثل button--active.

لماذا نستخدم kebab-case؟

توصي المهارة به بدلًا من camelCase أو snake_case للحفاظ على اتساق أسماء الفئات.

هل يجب أن تكون لخطافات JavaScript أسماء خاصة بها؟

نعم. تقترح المهارة إبقاء خطافات JavaScript في فضاء أسماء منفصل عن أنماط المكونات.

التفاصيل

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

Use when reviewing stylesheets, component styles, and responsive behavior related to Use consistent CSS naming conventions. Check the rendered layout across breakpoints and interaction states before proposing a fix.

repo: thedaviddias/Front-End-Checklist

الشعبية

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

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

0

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

التعليقات

  • …

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

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