| name | check |
| user_invocable | true |
| description | Code quality checker skill. This skill should be used when the user wants to: (1) Run static analysis tools (mypy, pyright, ruff) on the codebase - triggered by "/check", "/check q", or "/check quality" (2) Find dead/unused code (functions, imports, variables, unreachable code) - triggered by "/check d" or "/check dead" |
Code Quality Checker
This skill provides two main functions for maintaining code quality in this project.
Commands
| Command | Aliases | Description |
|---|---|---|
/check quality |
/check, /check q |
Run all static analysis tools |
/check dead |
/check d |
Find dead/unused code |
Quality Check (/check, /check q, /check quality)
Run all three static analysis tools on src/cube/ in parallel:
# Run these 3 commands in parallel using the Bash tool
.venv/Scripts/python.exe -m ruff check src/cube
.venv/Scripts/python.exe -m mypy -p cube
.venv/Scripts/python.exe -m pyright src/cube
Output Format
After running all checkers, provide a summary:
- Summary table showing pass/fail status for each tool
- Grouped issues by severity (errors first, then warnings)
- Actionable suggestions for fixing the issues
Offering to Fix
At the end, if there are fixable issues:
- For ruff issues: Offer to run
.venv/Scripts/python.exe -m ruff check --fix src/cubeto auto-fix - For mypy/pyright issues: Group by category and offer to fix them one by one or in batches
Example conclusion:
## Summary
| Tool | Status | Issues |
|---------|--------|--------|
| ruff | FAIL | 5 |
| mypy | PASS | 0 |
| pyright | FAIL | 3 |
Would you like me to:
1. Auto-fix the 5 ruff issues with `ruff check --fix`?
2. Address the 3 pyright type errors?
Dead Code Detection (/check d, /check dead)
Find unused code across the entire codebase using comprehensive analysis.
Analysis Strategy
Use the Task tool with subagent_type=Explore to perform thorough dead code analysis:
- Unused imports - Imports that are never used in the file
- Unused functions/methods - Functions defined but never called
- Unused variables - Variables assigned but never read
- Unused classes - Classes defined but never instantiated or subclassed
- Unreachable code - Code after return/raise/break/continue statements
Execution Steps
Launch an Explore agent with thoroughness="very thorough" to analyze:
- Search for all function/method definitions
- Cross-reference with all call sites
- Check
__all__exports in__init__.pyfiles - Consider dynamic usage patterns (e.g.,
getattr, reflection)
For each category, report:
- File path and line number
- The unused element name
- Confidence level (high/medium/low)
- Reason why it appears unused
Output Format
## Dead Code Analysis Results
### Unused Functions (High Confidence)
- `src/cube/module.py:42` - `_old_helper()` - No callers found
- `src/cube/other.py:15` - `deprecated_func()` - No callers found
### Unused Imports (High Confidence)
- `src/cube/file.py:3` - `from typing import Optional` - Never used
### Potentially Unused (Medium Confidence)
- `src/cube/utils.py:88` - `helper_func()` - Only called via getattr
Would you like me to remove any of these?
Caveats to Consider
- Functions referenced in
__all__are public API (not dead) - Methods may be called via inheritance or protocols
- Some code may be used dynamically (plugin systems, etc.)
- Test files may reference code that appears "unused" in src/