| name | lint |
| description | Run formatters and linters, then fix reported issues |
| triggers | ["lint","format","format and lint","check style","fix style","code style","fix formatting","fix linting"] |
Lint and Format
Use this skill to run code formatters and linters, then interactively fix any issues found.
Workflow
Step 1: Ask User What to Run
Use AskUserQuestion to determine scope:
Question: "What would you like to do?"
Header: "Action"
Options:
- Format & Lint all - "Run all formatters then all linters (recommended before commits)"
- Format only - "Run formatters to auto-fix style issues"
- Lint only - "Run linters to check for issues without auto-fixing"
- Specific check - "Choose a specific linter or formatter"
Step 2A: Format & Lint All
Run formatters first (they auto-fix), then linters (they report issues):
make format
make lint
Step 2B: Format Only
make format
This runs all formatters:
isort - Python import ordering
autoflake - Remove unused Python imports
black - Python code style
Step 2C: Lint Only
make lint
This runs all linters:
isort --check - Python import order check
black --check - Python style check
autoflake --check - Unused Python imports check
codespell - Spelling check
pyright - Python type checking
Step 2D: Specific Check
Use AskUserQuestion:
Question: "Which specific checks would you like to run?"
Header: "Check Type"
multiSelect: true
Options:
- Python formatting - "black, isort, autoflake"
- Python type checking - "pyright"
- Spelling - "codespell"
Run selected checks:
make format/isort && make format/autoflake && make format/black
make lint/pyright
make lint/codespell
Step 3: Analyze Results
Parse the output and categorize issues:
## Results Summary
| Check | Status | Issues |
|-------|--------|--------|
| black | [Pass/Fail] | N files reformatted |
| isort | [Pass/Fail] | N import issues |
| autoflake | [Pass/Fail] | N unused imports |
| codespell | [Pass/Fail] | N spelling errors |
| pyright | [Pass/Fail] | N type errors |
Step 4: Fix Issues Interactively
If linting found issues that can't be auto-fixed:
For Pyright Type Errors
Group by error type and present:
## Type Errors (pyright)
### Missing Type Annotations (5 issues)
| File | Line | Issue |
|------|------|-------|
| veeksha/core/engine.py | 45 | Parameter "config" has no type annotation |
Would you like me to fix these by adding type annotations?
Use AskUserQuestion:
- "Fix all type annotations" - Add missing type hints
- "Fix one by one" - Review each individually
- "Skip" - Move to next category
For Spelling Errors (codespell)
## Spelling Errors
| File | Line | Found | Suggested |
|------|------|-------|-----------|
| veeksha/utils/helpers.py | 12 | "recieve" | "receive" |
Would you like me to fix these spelling errors?
Step 5: Apply Fixes
When fixing issues:
- Read each file
- Apply the fix
- Show before/after for each change
- Re-run the specific linter to verify fix
make lint/pyright
Step 6: Final Verification
After all fixes:
make lint
Report final status.
Quick Commands
/lint --format-only
/lint --check-only
/lint --pre-commit
Pre-Commit Workflow
When user specifies --pre-commit or asks to prepare for commit:
make format
make lint
git status
If lint fails, offer to fix issues before proceeding.