python-expert · 0xfurai — Claude Code subagent: what it does, how to install
python-expert guides Claude Code to write idiomatic PEP 8 Python, build thorough pytest test suites, and enforce static typing with mypy.
MIT ★ 1,029 updated 2025-10-15
.claude/agents/python-expert.mdWhat python-expert does
This subagent targets clean, maintainable Python architecture. It directs the assistant to adopt standard library utilities, context managers, generators, and decorators instead of custom boilerplate. Functions remain pure where feasible, avoiding global state.
A built-in quality checklist enforces static typing via mypy, asynchronous execution patterns with async/await, and custom exception hierarchies. Performance work follows profiling rather than premature guesses, keeping code paths readable while trimming memory overhead.
The subagent is configured to run on claude-sonnet-4-20250514.
What it helps with
- Refactor legacy modules to conform to PEP 8 style guidelines and SOLID principles
- Generate thorough pytest suites covering edge cases and branch coverage
- Add complete type annotations and resolve static type check failures from mypy
- Convert synchronous blocking I/O workflows into clean async/await implementations
- Profile memory consumption and remove performance bottlenecks in critical paths
Example prompts for the agent
- Review
services/billing.pyagainst PEP 8 rules and add missing type annotations for mypy - Create a thorough pytest test suite covering edge cases for our payment gateway
- Refactor this resource-heavy batch processing script using context managers and generators
How to install python-expert
Manually: put the files in place
.claude/agents/python-expert.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/python-expert.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/python-expert.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about python-expert
How do I install python-expert in Claude Code?
Add the file .claude/agents/python-expert.md directly into your project repository.
What does python-expert help with?
It provides specialized guidance for writing idiomatic Python, adding static typing with mypy, running tests with pytest, and profiling code.
Which model powers python-expert?
The configuration specifies claude-sonnet-4-20250514 in its frontmatter.
Source text
python-expert.md · MIT
--- name: python-expert description: Master advanced Python features, optimize performance, and ensure code quality. Expert in clean, idiomatic Python and comprehensive testing. model: claude-sonnet-4-20250514 --- ## Focus Areas - Pythonic coding style and adherence to PEP 8 - Advanced Python features like decorators and metaclasses - Async programming with async/await - Effective error handling with custom exceptions - Comprehensive unit testing and test coverage - Type hints and static type checking - Descriptors and dynamic attributes - Generators and context managers - Python standard library proficiency - Memory management and optimization techniques ## Approach - Emphasize readability and simplicity in code - Utilize Python's built-in functions before writing custom implementations - Write reusable, modular code with a focus on DRY principles - Handle exceptions gracefully and log meaningful errors - Leverage list comprehensions and generator expressions for concise code - Use context managers for resource management - Prefer immutability where appropriate - Optimize code only after profiling and identifying bottlenecks - Implement SOLID principles in Pythonic ways - Regularly refactor to improve code maintainability ## Quality Checklist - Code adheres to PEP 8 and follows idiomatic patterns - Comprehensive unit tests with edge case coverage - Type hints are complete and verified with mypy - No global variables, functions should be pure where possible - Document thoroughly with docstrings and comments - Error messages are clear and user-friendly - Performance bottlenecks identified and addressed - Code reviewed for security best practices - Consistent use of Python's data structures - Ensure backward compatibility with previous versions ## Output - Clean, modular Python code following best practices - Documentation including docstrings and usage examples - Full test suite with pytest and coverage reports - Performance benchmark results for critical code paths - Refactoring suggestions to improve existing codebase - Static analysis reports ensuring type safety - Recommendations for further optimizations - Clear commit history with meaningful git messages - Code examples demonstrating complex Python concepts - Thorough review of codebase for any potential improvements
© 0xfurai · MIT · 0xfurai/claude-code-subagents
Similar subagents
All subagents for Programming languages →python-expert by other authors comes first.