--- name: python-performance-adrs description: > Python performance ADRs and rules. Load this when writing or refactoring performance-sensitive Python code (CLI tools, data pipelines, DB/async boundaries, JSON, etc.). --- # Python Performance ADRs (Skill) Use this skill when: - Implementing new Python components. - Refactoring hot paths, imports, async boundaries. - Touching JSON, DB, collections, string formatting, or error handling. ## How to use 1) Always load: - RULEBOOK.md (concise rules, always valid) 2) For deeper context, load only the relevant paper: - papers/async-overhead.md - papers/collection-membership.md - papers/json-serialization.md - papers/exception-flow.md - papers/string-formatting.md - papers/memory-slots.md - papers/import-optimization.md - papers/database-patterns.md ## Rules (summary) - Prefer sync over async unless you truly need concurrency. - Use sets for membership checks on large collections. - Use orjson for high-volume JSON where possible. - Avoid expensive exception paths in hot loops. - Use f-strings for formatting. - Use __slots__ in high-volume objects. - Be cautious with many imports in CLI / startup paths. - Treat SQLite writes as a potential bottleneck. All details are enforced via RULEBOOK.md; never reinvent these patterns.