Back to skills
SKILL.md
1698 Refactor 158a2c64
ASecurityAutomated code improvement and cleanup.
- 9 stars
- 0 votes
- 0 copies
- 1 view
- Added June 1, 2026
Works with
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add tools-only/X-Skills --skill 1698-refactor_158a2c64 --agent claude-codeAre you the author of 1698 Refactor 158a2c64?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/tools-only-1698-refactor-158a2c64)# ZERG Refactor
Automated code improvement and cleanup.
## Usage
```bash
/zerg:refactor [--transforms dead-code,simplify,types,patterns,naming]
[--dry-run]
[--interactive]
```
## Transforms
### dead-code
Remove unused imports, variables, and functions.
### simplify
Simplify complex expressions:
- `if x == True:` → `if x:`
- `if x == None:` → `if x is None:`
- Redundant parentheses
- Unnecessary else after return
### types
Strengthen type annotations:
- Add missing type hints
- Replace `Any` with specific types
- Add return type annotations
### patterns
Apply common design patterns:
- Extract repeated code
- Apply guard clauses
- Use early returns
### naming
Improve variable and function names:
- Replace single-letter names
- Fix casing conventions
- Make names more descriptive
## Examples
```bash
# Run all transforms (dry-run)
/zerg:refactor --transforms dead-code,simplify --dry-run
# Interactive mode
/zerg:refactor --interactive
# Specific transforms
/zerg:refactor --transforms types,naming
```
## Output
```
Refactor Results
========================================
Files Analyzed: 15
Suggestions: 23
Applied: 0
Suggestions:
simplify:
auth.py:42
- if authenticated == True:
+ if authenticated:
```
## Task Tracking
On invocation, create a Claude Code Task to track this command:
Call TaskCreate:
- subject: "[Refactor] Apply {transforms}"
- description: "Applying refactoring transforms: {transforms}. Dry-run: {dry_run}."
- activeForm: "Refactoring code"
Immediately call TaskUpdate:
- taskId: (the Claude Task ID)
- status: "in_progress"
On completion, call TaskUpdate:
- taskId: (the Claude Task ID)
- status: "completed"
## Help
When `--help` is passed in `$ARGUMENTS`, display usage and exit:
```
/zerg:refactor — Automated code improvement and cleanup.
Flags:
--transforms LIST Comma-separated transforms: dead-code,simplify,types,patterns,naming
--dry-run Preview changes without applying
--interactive Approve changes one by one
--help Show this help message
```
## Exit Codes
- 0: No issues (or all applied)
- 1: Suggestions available
- 2: Error during analysis
Files in this skill
- README.md
- skill.md
Attribution
Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.