install
source · Clone the upstream repo
git clone https://github.com/rayk/lucid-toolkit
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/rayk/lucid-toolkit "$T" && mkdir -p ~/.claude/skills && cp -r "$T/plugins/impl-python/skills/python-dev-tools" ~/.claude/skills/rayk-lucid-toolkit-python-dev-tools && rm -rf "$T"
manifest:
plugins/impl-python/skills/python-dev-tools/SKILL.mdsource content
Python Development Tools
Expert guidance for using Python development tools including IDE integration, static analysis, testing, and debugging workflows.
Analysis Tools
Static Analysis
| Tool | MCP Pattern | Purpose |
|---|---|---|
| pyright | | Type checking |
| ruff | | Linting |
| ruff format | | Code formatting |
| mypy | | Alternative type checker |
Code Quality Commands
# Type check entire project pyright # Type check specific file pyright src/module.py # Lint with auto-fix ruff check --fix . # Format code ruff format . # Check if formatting needed ruff format --check .
Testing Tools
pytest Commands
# Run all tests pytest # Run specific test file pytest tests/test_module.py # Run specific test function pytest tests/test_module.py::test_function # Run with coverage pytest --cov=src --cov-report=term-missing # Run async tests pytest -v --asyncio-mode=auto # Run with verbose output pytest -vv # Stop on first failure pytest -x # Run last failed tests pytest --lf # Run tests matching pattern pytest -k "test_user"
Test Output Interpretation
PASSED - Test succeeded FAILED - Test failed (assertion or exception) ERROR - Test setup/teardown failed SKIPPED - Test was skipped (@pytest.mark.skip) XFAIL - Expected failure (@pytest.mark.xfail) XPASS - Expected failure but passed
IDE Tools
Available MCP IDE Tools
| Tool | Purpose |
|---|---|
| Get IDE diagnostics for file |
| Read file content |
| Write/create file |
| Get active editor |
| List open files |
| Project-wide search |
| Get project file tree |
Diagnostic Workflow
<workflow name="diagnostics"> <step>Get diagnostics: mcp__ide__getDiagnostics</step> <step>Parse error messages and locations</step> <step>Read affected files for context</step> <step>Propose fixes based on error type</step> </workflow>
Development Workflows
TDD Workflow
<workflow name="tdd"> <step name="write_test"> Write failing test in tests/ </step> <step name="run_test"> pytest tests/test_file.py::test_function -v Expect: FAILED (RED) </step> <step name="implement"> Write minimal code to pass </step> <step name="verify"> pytest tests/test_file.py::test_function -v Expect: PASSED (GREEN) </step> <step name="refactor"> Improve code while keeping tests passing </step> <step name="type_check"> pyright src/ </step> <step name="lint"> ruff check --fix . ruff format . </step> </workflow>
Debug Workflow
<workflow name="debug"> <step name="gather_info"> Get full traceback and error message </step> <step name="locate"> Find file and line from traceback </step> <step name="read_context"> Read affected file(s) </step> <step name="diagnose"> Form hypothesis from error type: - ImportError: Check imports, PYTHONPATH - TypeError: Check types, function signatures - AttributeError: Check object has attribute - KeyError: Check dict keys exist </step> <step name="fix"> Apply minimal fix </step> <step name="verify"> Run tests or reproduce scenario </step> </workflow>
Code Quality Workflow
<workflow name="quality"> <step name="type_check"> pyright Fix any type errors </step> <step name="lint"> ruff check . Fix or acknowledge warnings </step> <step name="test"> pytest --cov Ensure coverage thresholds met </step> <step name="format"> ruff format . Ensure consistent style </step> </workflow>
Tool Configuration
pyproject.toml Reference
[tool.pyright] include = ["src"] exclude = ["**/__pycache__"] typeCheckingMode = "strict" pythonVersion = "3.12" venvPath = "." venv = ".venv" [tool.ruff] target-version = "py312" line-length = 88 [tool.ruff.lint] select = [ "E", # pycodestyle errors "F", # pyflakes "I", # isort "UP", # pyupgrade "B", # flake8-bugbear "SIM", # flake8-simplify "TCH", # type-checking imports ] [tool.pytest.ini_options] asyncio_mode = "auto" testpaths = ["tests"] addopts = "-ra -q" [tool.coverage.run] source = ["src"] branch = true
Error Resolution Patterns
Common pyright Errors
| Error | Cause | Fix |
|---|---|---|
| Missing stubs or package | Install types-* package or add to exclude |
| Type mismatch | Check types match, use Union if needed |
| Optional not handled | Add None check or use |
| Function path without return | Add return or raise |
Common ruff Errors
| Code | Cause | Fix |
|---|---|---|
| Line too long | Break line or adjust config |
| Unused import | Remove import |
| Unused variable | Remove or prefix with |
| Import order | Run |
| Deprecated syntax | Use modern Python syntax |
Sub-References
- IDE tool usage patternsreferences/ide-patterns.md
- Testing patterns and fixturesreferences/test-patterns.md
- Async/await patternsreferences/async-patterns.md