first commit

This commit is contained in:
2026-04-06 15:28:27 -05:00
commit 026419736d
4 changed files with 678 additions and 0 deletions

76
python-cleanup/SKILL.md Normal file
View File

@@ -0,0 +1,76 @@
# Python Cleanup Skill
Clean up Python code by formatting, fixing lint issues, removing unused imports, and identifying dead code.
## Usage
Invoke with `/python-cleanup` followed by an optional path or scope:
- `/python-cleanup` - Clean up changed files (git diff)
- `/python-cleanup src/` - Clean up a specific directory
- `/python-cleanup src/main.py` - Clean up a specific file
## Workflow
### Step 1: Identify Target Files
If no path specified, find Python files with uncommitted changes:
```bash
git diff --name-only --diff-filter=ACMR HEAD | grep '\.py$'
```
If a path is specified, use that path directly.
### Step 2: Format Code
Run ruff formatter to fix code style:
```bash
ruff format <target>
```
### Step 3: Fix Lint Issues
Auto-fix all fixable lint issues including unused imports:
```bash
ruff check --fix --unsafe-fixes <target>
```
Key rules this fixes:
- `F401` - Unused imports (removes them)
- `F841` - Unused variables
- `I001` - Import sorting
- `UP` - Python upgrade suggestions
- `B` - Bugbear issues
### Step 4: Report Remaining Issues
Show any issues that couldn't be auto-fixed:
```bash
ruff check <target>
```
### Step 5: Identify Dead Code (Optional)
Use vulture to find potentially unused code:
```bash
vulture <target> --min-confidence 80
```
If vulture is not installed, skip this step and note it in the summary.
### Step 6: Summary
Provide a summary of:
- Files processed
- Issues auto-fixed (count by category)
- Remaining issues that need manual review
- Potential dead code identified (if vulture available)
## Configuration
This skill respects project-level `pyproject.toml` or `ruff.toml` configuration if present.
## Dependencies
- `ruff` (required) - Install with `uv add ruff` or `pip install ruff`
- `vulture` (optional) - Install with `uv add vulture` or `pip install vulture`