Systematic refactoring workflow - use coverage/complexity tools to identify targets, plan issues, execute with tests
/plugin marketplace add bryonjacob/aug/plugin install aug-dev@augThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Systematically improve code maintainability using just coverage and just complexity to identify targets, then /plan and /work to execute refactoring safely.
Core principle: Never refactor without high test coverage. Tests prove behavior is preserved.
Apply these principles during refactoring:
Standard Interface: aug-just/justfile-interface (Level 0+1)
just coverage # Find low-coverage areas (blocks if <96%)
just complexity # Find high-complexity targets
just test # Verify after each change
just check-all # Quality gate before merge
Two approaches:
/refactor
# AI analyzes codebase
# Finds opportunities automatically
# Creates detailed GitHub issues
Then execute: /work <issue-number>
Use justfile commands to identify targets yourself.
Coverage gaps:
just coverage
# Fails if <96% - write tests before refactoring
Complexity hotspots:
just complexity
# Python: radon cc - look for C grade or complexity >10
# JavaScript: complexity report - functions >10
# Java: PMD report - methods >10
Create issues for each refactoring target:
/plan Refactor user validation module - current complexity 15, target <10
This creates issues with:
/work 99 # Sequential execution with test verification
RED-GREEN-REFACTOR cycle per issue:
just test → Ensure green ✅just test → Ensure still green ✅just check-all before mergejust complexity # Confirm reduction
just coverage # Confirm maintained
Good refactoring commits:
refactor: extract validation from process_data
refactor: extract transformation from process_data
refactor: simplify conditionals with guard clauses
Never commit broken tests.
Required before refactoring: 96% (aug-just baseline threshold)
If below threshold: Write tests first, then refactor
Extract Function - Break large functions into single-purpose units Guard Clauses - Replace nested conditionals with early returns Extract Constants - Replace magic numbers with named constants Simplify Conditionals - Reduce boolean complexity
This skill works with:
aug-just plugin - Provides coverage/complexity/test commands/refactor - Autonomous analysis, creates refactoring issues (recommended)/plan - Manual planning for custom refactorings/work - Executes refactoring with test verification gatesTypical flow:
/refactor # Find opportunities, create issues
/work 101 # Execute using this skill's guidance
/work 102 # Continue with next refactoring
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.