Skip to content
Back to skills

Code Refactoring 2

ASecurity

Expert refactoring orchestrator for large-scale code changes with change tracking. Use when (1) renaming/moving files or directories, (2) restructuring database schemas, (3) refactoring APIs or Edge Functions, (4) splitting/merging components, (5) querying what changed in a system ("what critical changes were made to subscription system?"). Maintains changelog for docs-updater sync.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
documentationgoreactrefactoringapidatabasefrontendbackenddocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill code-refactoring-2 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Refactoring 2?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Refactoring 2
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-code-refactoring-2/badge)](https://www.skillsdirectory.com/skills/david-li0406-code-refactoring-2)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: code-refactoring
description: Expert refactoring orchestrator for large-scale code changes with change tracking. Use when (1) renaming/moving files or directories, (2) restructuring database schemas, (3) refactoring APIs or Edge Functions, (4) splitting/merging components, (5) querying what changed in a system ("what critical changes were made to subscription system?"). Maintains changelog for docs-updater sync.
---

# Code Refactoring Wizard

Orchestrate large-scale refactoring with change tracking. Uses `code-wizard` for discovery.

## Context Files

For structure and conventions, read from `Docs/context/`:
- `Docs/context/conventions.md` - Architecture rules, refactor guidelines
- `Docs/context/repo-structure.md` - Where to place files
- `Docs/context/packages-map.md` - Package boundaries

## Changelog Location

**All significant changes logged to:** `Docs/ai/CHANGELOG.md`

This file is monitored by `docs-updater` skill for documentation sync.

## Change Categories

| Category | Tag | Example |
|----------|-----|---------|
| Schema | `[SCHEMA]` | New table, column rename, migration |
| Structure | `[STRUCTURE]` | File/folder move, directory reorganization |
| API | `[API]` | RPC signature change, Edge Function update |
| Breaking | `[BREAKING]` | Removed feature, renamed export |
| Component | `[COMPONENT]` | React component split/merge |
| Dependency | `[DEPS]` | Package upgrade, new import |

## Workflow

### 1. Discover (use code-wizard)

```
/code-wizard "find all usages of ai_plan_quotas table"
/code-wizard "where is subscription logic implemented"
```

### 2. Plan

- Current state → Target state
- Migration path
- Rollback strategy
- Affected files list

### 3. Execute

Order: Database → Backend → Frontend → Tests

### 4. Log to CHANGELOG.md

```markdown
## 2026-01-08 - Subscription System Refactor

### [SCHEMA] Replace per-feature quotas with token pools

**Before:**
- `ai_plan_quotas` table (40+ rows)
- Per-feature token limits

**After:**
- `subscription_plans` table
- `token_pools` table
- `ai_operations` table

**Impact:**
- Files: 15 | Migration: Yes | Breaking: Yes

**Related:** #20260108_token_pool_system
```

### 5. Sync Docs

```
/docs-updater "sync changelog to API docs"
```

## Query Changes

To answer "what changed in X system":

1. Read `Docs/ai/CHANGELOG.md`
2. Filter by date/category/system
3. Summarize

Example response:
```
## Subscription System Changes (Jan 2026)

1. [SCHEMA] Token pool migration (Jan 8)
   - Replaced ai_plan_quotas → unified token system
   - 15 files, breaking

2. [API] New check_token_balance RPC (Jan 8)
   - User token balance endpoint
   - Non-breaking
```

## Related Skills

| Skill | Use For |
|-------|---------|
| `code-wizard` | Find code before refactoring |
| `docs-updater` | Sync docs after changelog |
| `supabase-migration-writer` | Database migrations |
| `admin-panel-builder` | Admin page refactoring |

## References

- **Refactoring patterns**: See [references/patterns.md](references/patterns.md)
- **Changelog examples**: See [references/changelog-examples.md](references/changelog-examples.md)

Files in this skill

  • SKILL.md3.1 KB
  • references/changelog-examples.md4.2 KB
  • references/patterns.md4.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…