|
| 1 | +# Tool Usage Learnings |
| 2 | + |
| 3 | +This file is intended to be used by an LLM such as Claude. |
| 4 | + |
| 5 | +## UV Package Manager |
| 6 | + |
| 7 | +- Use `uv run` to run Python tools without activating virtual environments |
| 8 | +- For formatting: `uv run ruff format .` |
| 9 | +- For type checking: `uv run pyright` |
| 10 | +- For upgrading packages: |
| 11 | + - `uv add --dev package --upgrade-package package` to upgrade a specific package |
| 12 | + - Don't use `@latest` syntax - it doesn't work |
| 13 | + - Be careful with `uv pip install` as it may downgrade packages |
| 14 | + |
| 15 | +## Git and GitHub CLI |
| 16 | + |
| 17 | +- When using gh CLI for PRs, always quote title and body: |
| 18 | + ```bash |
| 19 | + gh pr create --title "\"my title\"" --body "\"my body\"" |
| 20 | + ``` |
| 21 | +- For git commits, use double quotes and escape inner quotes: |
| 22 | + ```bash |
| 23 | + git commit -am "\"fix: my commit message\"" |
| 24 | + ``` |
| 25 | + |
| 26 | +## Python Tools |
| 27 | + |
| 28 | +### Ruff |
| 29 | +- Handles both formatting and linting |
| 30 | +- For formatting: `uv run ruff format .` |
| 31 | +- For checking: `uv run ruff check .` |
| 32 | +- Common issues: |
| 33 | + - Line length (default 88 chars) |
| 34 | + - Import sorting |
| 35 | + - Unused imports |
| 36 | + |
| 37 | +### Pyright |
| 38 | +- Type checker |
| 39 | +- Run with: `uv run pyright` |
| 40 | +- Version warnings can be ignored if type checking passes |
| 41 | +- Common issues: |
| 42 | + - Optional types need explicit None checks |
| 43 | + - String operations need type narrowing |
| 44 | + |
| 45 | +## Best Practices |
| 46 | + |
| 47 | +1. Always check git status and diff before committing |
| 48 | +2. Run formatters before type checkers |
| 49 | +3. When fixing CI: |
| 50 | + - Start with formatting issues |
| 51 | + - Then fix type errors |
| 52 | + - Then address any remaining linting issues |
| 53 | +4. For type errors: |
| 54 | + - Get full context around error lines |
| 55 | + - Consider optional types |
| 56 | + - Add type narrowing checks when needed |
0 commit comments