Automatically apply quality improvements to a Claude Code component based on analysis
Applies systematic quality improvements to Claude Code components based on analysis.
/plugin marketplace add C0ntr0lledCha0s/claude-code-plugin-automations/plugin install self-improvement@claude-code-plugin-automations<component-path>claude-sonnet-4-5You are improving the quality of a Claude Code component by applying systematic enhancements based on quality analysis.
Improve the component at path: $1
First, analyze the component to identify improvement opportunities:
/analyze-component $1
Or directly invoke the analyzing-component-quality skill to get quality scores and improvement suggestions.
Based on the quality analysis, create an improvement plan:
## Improvement Plan for [Component Name]
**Current Quality**: X.X/5
**Target Quality**: X.X/5
### Priority 1: Critical Issues
- [ ] [Issue 1]
- [ ] [Issue 2]
### Priority 2: Important Issues
- [ ] [Issue 3]
- [ ] [Issue 4]
### Priority 3: Nice to Have
- [ ] [Issue 5]
Invoke the improving-components skill and apply improvements systematically:
If description is vague or missing triggers:
# Before
description: Helps with testing
# After (use Edit tool)
description: Expert at writing Jest unit tests for JavaScript/TypeScript. Auto-invokes when user writes new functions or asks "test this code". Generates comprehensive test suites with mocks, assertions, and edge cases following AAA pattern.
Apply using Edit tool:
Edit $1:
old_string: "description: [old vague description]"
new_string: "description: [specific detailed description]"
If tools are excessive or unjustified:
# Before
allowed-tools: Read, Write, Edit, Bash, Grep, Glob, Task
# After (for research skill)
allowed-tools: Read, Grep, Glob, WebSearch, WebFetch
Apply using Edit tool:
Edit $1:
old_string: "allowed-tools: [old excessive list]"
new_string: "allowed-tools: [minimal necessary list]"
If missing examples or structure:
Add sections like:
## Capabilities
- [Specific capability 1]
- [Specific capability 2]
## Examples
### Example 1: [Scenario]
User: "How does X work?" Skill: [Action] Result: [Outcome]
### Example 2: [Scenario]
[Another example]
Apply using Edit tool to insert at appropriate location.
If security concerns exist:
After applying changes:
# Re-run quality analysis
python self-improvement/skills/analyzing-component-quality/scripts/quality-scorer.py "$1"
Verify:
Show a comprehensive before/after report:
# Component Improvement Report
**Component**: [name]
**Type**: [type]
**Location**: `$1`
## Changes Applied
### 1. Description Enhanced
**Before**:
```yaml
description: Helps with code
After:
description: Expert at analyzing code quality using ESLint, Prettier, and static analysis. Auto-invokes when user finishes writing code or asks "is this code good?". Provides actionable improvement suggestions with severity levels.
Impact: Description Clarity improved from 2/5 to 5/5 (+3 points)
Before: Read, Write, Edit, Bash, Grep, Glob, Task
After: Read, Bash
Removed:
Kept:
Impact:
Added:
Impact: Usability improved from 3/5 to 5/5 (+2 points)
| Dimension | Before | After | Change |
|---|---|---|---|
| Description Clarity | 2/5 | 5/5 | +3 |
| Tool Permissions | 2/5 | 4/5 | +2 |
| Auto-Invoke Triggers | 2/5 | 5/5 | +3 |
| Security | 3/5 | 4/5 | +1 |
| Usability | 3/5 | 5/5 | +2 |
| Overall | 2.4/5 | 4.6/5 | +2.2 |
Quality Level: Poor → Excellent ✅
[Any suggestions not automatically applied, if any]
$1 - Component improvedReview changes: Examine the diff to ensure all changes are appropriate
Test component: Verify it still works as intended
Commit changes:
git add $1
git commit -m "feat(self-improvement): enhance [component-name] quality
- Improved description clarity and specificity
- Optimized tool permissions for security
- Added comprehensive documentation and examples
Quality score: 2.4/5 → 4.6/5 (+2.2 points)"
Validate with agent-builder (optional):
python agent-builder/skills/building-[type]s/scripts/validate-[type].py "$1"
## Improvement Guidelines
### What to Improve
**Always improve**:
- Vague descriptions → Specific descriptions
- Excessive tools → Minimal necessary tools
- Security vulnerabilities → Secure patterns
- Missing documentation → Comprehensive docs
**Carefully improve**:
- Existing functionality (preserve behavior)
- Working auto-invoke triggers (ensure backward compatible)
- Tool lists (verify each change necessary)
**Never change**:
- Component name (breaking change)
- Core functionality (preserve intent)
- Version number (user manages this)
### Safety Checks
Before applying each improvement:
- [ ] Preserves component functionality
- [ ] Doesn't break existing usage
- [ ] Improves quality score
- [ ] No new issues introduced
- [ ] Changes are justified
### When to Ask User
Ask user confirmation before:
- Removing tools that might be needed
- Making changes that could affect existing usage
- Large-scale restructuring
- Uncertain about intent
**Example**:
I've identified that the Task tool may be unnecessary for this skill. Removing it would improve security score from 3/5 to 5/5.
Current: allowed-tools: Read, Grep, Glob, Task Proposed: allowed-tools: Read, Grep, Glob
Should I remove the Task tool? (y/n)
## Advanced Improvements
### Pattern-Based Improvements
Apply common improvement patterns:
**Pattern 1**: Research Skill Optimization
IF component_type == 'skill' AND 'research' in description: KEEP: Read, Grep, Glob, WebSearch, WebFetch REMOVE: Write, Edit, Bash, Task
**Pattern 2**: Code Generation Skill Optimization
IF component_type == 'skill' AND 'generate' in description: KEEP: Read, Write, Grep, Glob REMOVE: Bash (unless running tests), Task
**Pattern 3**: Agent Tool Optimization
IF component_type == 'agent': REMOVE: Task (agents shouldn't delegate to agents)
### Bulk Improvements
If multiple components need similar improvements:
```markdown
Detected pattern: 5 skills have Task tool but don't delegate to agents
Apply bulk improvement?
- research-skill: Remove Task tool
- analysis-skill: Remove Task tool
- pattern-skill: Remove Task tool
- best-practices-skill: Remove Task tool
- investigation-skill: Remove Task tool
Total impact: +10 security points across 5 components
Apply to all? (y/n)
Provide a comprehensive improvement report that:
Your improvements make components more effective, secure, and maintainable for the entire Claude Code ecosystem.