المهارات python-design-patterns
📦

python-design-patterns

آمن

Python-Entwicklungsmuster anwenden

Schreiben Sie wartbaren Python-Code mit bewährten Entwicklungsmustern wie KISS, Single Responsibility und Komposition vor Vererbung, um Systeme zu erstellen, die einfach zu verstehen, zu testen und zu ändern sind.

يدعم: Claude Codex Code(CC)
🥉 74 برونزي
1

تنزيل ZIP المهارة

2

رفع في Claude

اذهب إلى Settings → Capabilities → Skills → Upload skill

3

فعّل وابدأ الاستخدام

اختبرها

استخدام "python-design-patterns". Show me how to refactor a class that handles user registration, sends emails, logs activity, and saves to database

النتيجة المتوقعة:

A refactored example splitting into UserService (business logic), UserRepository (data access), EmailNotifier (notifications), and ActivityLogger (logging) - each with single responsibility.

استخدام "python-design-patterns". I need to add payment processing to my order system. Should I inherit from a base Order class or use composition?

النتيجة المتوقعة:

Explanation of why composition is preferred - you can swap payment providers, test with fakes, and avoid inheritance hierarchies. Example showing PaymentProcessor injected into OrderService.

استخدام "python-design-patterns". I have three similar functions that process data slightly differently. Should I create an abstraction?

النتيجة المتوقعة:

Apply Rule of Three - wait until you see a clear pattern emerge. Show example of when duplication is better than wrong abstraction, and when to abstract.

التدقيق الأمني

آمن
v1 • 2/15/2026

All 35 static findings are false positives. The skill is a documentation file containing Python code examples for educational purposes. Python dictionary syntax was misidentified as shell backticks, email examples as network calls, and code examples as cryptographic algorithms or reconnaissance. No actual security risks present.

1
الملفات التي تم فحصها
412
الأسطر التي تم تحليلها
0
النتائج
1
إجمالي عمليات التدقيق
لا توجد مشكلات أمنية
تم تدقيقه بواسطة: claude

درجة الجودة

38
الهندسة المعمارية
100
قابلية الصيانة
85
المحتوى
50
المجتمع
100
الأمان
91
الامتثال للمواصفات

ماذا يمكنك بناءه

Architektur neuer Python-Dienste

Verwenden Sie diese Muster beim Start eines neuen Dienstes, um von Anfang an eine saubere, wartbare Architektur zu erstellen.

Umgearbeiteten, verworrenen Code

Wenden Sie SRP und Trennung von Anliegen an, um Abhängigkeiten zu entwirren, wenn Sie mit komplexem, gekoppeltem Code konfrontiert sind.

Abstraktionsentscheidungen bewerten

Verwenden Sie die Drei-Regel, um vorzeitige Generalisierung zu vermeiden, wenn Sie entscheiden, ob Sie eine Abstraktion erstellen sollen.

جرّب هذه الموجهات

KISS auf ein Problem anwenden
Ich muss [Problem beschreiben] lösen. Was ist die einfachste Lösung, die funktioniert? Zeigen Sie mir ein Beispiel.

أفضل الممارسات

  • Start with the simplest solution and add complexity only when justified by concrete requirements
  • Keep functions focused to 20-50 lines with a single purpose
  • Separate I/O operations from business logic into different layers
  • Inject dependencies through constructors for testability

تجنب

  • Creating abstractions too early before understanding the domain
  • Using inheritance for code reuse instead of composition
  • Mixing concerns like HTTP handling, validation, and database access in one class
  • Making code clever instead of readable

الأسئلة المتكررة

What is the Rule of Three in Python?
Wait until you have three similar instances before creating an abstraction. Two similar pieces of code may not actually share a pattern - wait for the third to confirm.
When should I use composition over inheritance?
Always prefer composition unless you need true polymorphism. Inheritance creates tight coupling and makes testing harder.
How big should a function be?
Keep functions to 20-50 lines depending on complexity. Extract when it serves multiple purposes or has deeply nested logic (3+ levels).
What is Separation of Concerns?
Organize code into distinct layers (API, Service, Repository) where each layer has a clear responsibility and only depends on layers below it.
What is Dependency Injection?
Pass dependencies through constructors rather than creating them inside the class. This makes code testable by allowing fake implementations.
When should I apply the KISS principle?
Always start with the simplest solution that works. Only add complexity when concrete requirements justify it. Simple code is easier to maintain.

تفاصيل المطور

بنية الملفات

📄 SKILL.md