Skip to content

aiskillstore/marketplace / skills/89jobrien/ai-code-cleanup

ai-code-cleanup

Verified

Remove AI-generated code slop from branches. Use after AI-assisted coding sessions to clean up defensive bloat, unnecessary comments, type casts, and style inconsistencies. Focuses on identifying and removing AI artifacts that degrade code quality.

FileKindSize
SKILL.mdskill md7.0 KB
references/refactoring-plan.template.mdmarkdown2.5 KB
skill-report.jsonconfig35.8 KB

references/refactoring-plan.template.md

View on GitHub
---
author: Joseph OBrien
status: unpublished
updated: '2025-12-23'
version: 1.0.1
tag: skill
type: reference
parent: ai-code-cleanup
---

# Refactoring Plan: {{COMPONENT_NAME}}

**Date:** {{YYYY-MM-DD}}
**Author:** {{NAME}}
**Status:** {{PROPOSED|APPROVED|IN_PROGRESS|COMPLETED}}

---

## Overview

**What:** {{BRIEF_DESCRIPTION}}

**Why:** {{MOTIVATION}}

**Scope:** {{FILES_OR_MODULES_AFFECTED}}

---

## Current State

### Code Smells Identified

| Smell | Location | Severity |
|-------|----------|----------|
| {{SMELL_TYPE}} | `{{FILE}}:{{LINE}}` | {{HIGH/MED/LOW}} |

### Metrics Before

| Metric | Current | Target |
|--------|---------|--------|
| Cyclomatic Complexity | {{N}} | <{{N}} |
| Lines of Code | {{N}} | {{N}} |
| Test Coverage | {{N}}% | >{{N}}% |
| Duplication | {{N}}% | <{{N}}% |

### Problem Areas

```{{LANGUAGE}}
{{PROBLEMATIC_CODE_SAMPLE}}
```

**Issues:**

- {{ISSUE_1}}
- {{ISSUE_2}}

---

## Target State

### Design Goals

- {{GOAL_1}}
- {{GOAL_2}}
- {{GOAL_3}}

### Proposed Structure

```
{{DIRECTORY_OR_CLASS_STRUCTURE}}
```

### Target Code

```{{LANGUAGE}}
{{REFACTORED_CODE_SAMPLE}}
```

---

## Refactoring Steps

### Phase 1: Preparation

- [ ] Add characterization tests for current behavior
- [ ] Document current API contracts
- [ ] Create feature flag for rollback

### Phase 2: Extract

- [ ] {{EXTRACT_STEP_1}}
- [ ] {{EXTRACT_STEP_2}}

### Phase 3: Restructure

- [ ] {{RESTRUCTURE_STEP_1}}
- [ ] {{RESTRUCTURE_STEP_2}}

### Phase 4: Clean Up

- [ ] Remove dead code
- [ ] Update documentation
- [ ] Remove feature flag

---

## Risk Assessment

| Risk | Likelihood | Impact | Mitigation |
|------|------------|--------|------------|
| {{RISK_1}} | {{H/M/L}} | {{H/M/L}} | {{STRATEGY}} |
| {{RISK_2}} | {{H/M/L}} | {{H/M/L}} | {{STRATEGY}} |

### Rollback Plan

1. {{ROLLBACK_STEP_1}}
2. {{ROLLBACK_STEP_2}}

---

## Testing Strategy

### Existing Tests

| Test Suite | Status | Coverage |
|------------|--------|----------|
| {{SUITE}} | {{PASS/FAIL}} | {{N}}% |

### New Tests Required

- [ ] {{TEST_1}}
- [ ] {{TEST_2}}

### Verification

```bash
{{TEST_COMMANDS}}
```

---

## Dependencies

### Blocked By

- {{BLOCKER_1}}

### Blocks

- {{DEPENDENT_WORK_1}}

---

## Effort Estimate

| Phase | Estimate |
|-------|----------|
| Preparation | {{TIME}} |
| Extract | {{TIME}} |
| Restructure | {{TIME}} |
| Clean Up | {{TIME}} |
| **Total** | {{TIME}} |

---

## Quality Checklist

- [ ] Tests pass before and after each step
- [ ] No behavior changes (unless intentional)
- [ ] Code review completed
- [ ] Documentation updated
- [ ] Metrics improved
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall