AgentSkillsCN

python-patterns

运用cProfile、内存分析器,以及性能优化最佳实践,对Python代码进行性能剖析与优化。在调试慢速Python代码、优化性能瓶颈,或提升应用整体性能时,可主动选用此技能。

SKILL.md
--- frontmatter
name: python-patterns
description: Python development principles and decision-making.
category: development
version: 4.1.0-fractal
layer: master-skill

Python Patterns

Python development principles and decision-making for 2025. Learn to THINK, not memorize patterns.


⚠️ How to Use This Skill

This skill teaches decision-making principles, not fixed code to copy.

  • ASK user for framework preference when unclear
  • Choose async vs sync based on CONTEXT
  • Don't default to same framework every time

1. Framework Selection (2025)

🧠 Knowledge Modules (Fractal Skills)

1. Decision Tree

2. Comparison Principles

3. Selection Questions to Ask:

4. When to Use Async

5. The Golden Rule

6. Async Library Selection

7. When to Type

8. Common Type Patterns

9. Pydantic for Validation

10. Structure Selection

11. FastAPI Structure Principles

12. Django Async (Django 5.0+)

13. Django Best Practices

14. async def vs def in FastAPI

15. Dependency Injection

16. Pydantic v2 Integration

17. Selection Guide

18. When to Use Each

19. Exception Strategy

20. Error Response Philosophy

21. Testing Strategy

22. Async Testing

23. Fixtures Strategy

24. ❌ DON'T:

25. ✅ DO: