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.
تنزيل ZIP المهارة
رفع في Claude
اذهب إلى Settings → Capabilities → Skills → Upload skill
فعّل وابدأ الاستخدام
اختبرها
استخدام "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.
التدقيق الأمني
آمن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.
درجة الجودة
ماذا يمكنك بناءه
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.
جرّب هذه الموجهات
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