Agent SkillsAgent Skills
Spectaculous-Code

code-refactoring

@Spectaculous-Code/code-refactoring
Spectaculous-Code
0
0 forks
Updated 4/12/2026
View on GitHub

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, (6) migrating IdeaMachina evolution store from Zustand to Supabase, (7) refactoring IdeaMachina components or data layer. Maintains changelog for docs-updater sync.

Installation

$npx agent-skills-cli install @Spectaculous-Code/code-refactoring
Claude Code
Cursor
Copilot
Codex
Antigravity

Details

Path.claude/skills/code-refactoring/SKILL.md
Branchmain
Scoped Name@Spectaculous-Code/code-refactoring

Usage

After installing, this skill will be available to your AI coding assistant.

Verify installation:

npx agent-skills-cli list

Skill Instructions


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, (6) migrating IdeaMachina evolution store from Zustand to Supabase, (7) refactoring IdeaMachina components or data layer. 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

CategoryTagExample
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

## 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

IdeaMachina Refactoring

For migrating IdeaMachina's evolution store from Zustand (client-side JSON blob) to Supabase relational tables, see the comprehensive guide:

references/idea-machina-evolution.md

Quick summary:

  • Current state: projectEvolutionStore (Zustand) persists evolution data as a JSON blob to store_sync table. 30 files depend on it. 10 store versions (9 migrations).
  • Target state: Relational tables in ai_prompt schema (pm_evolutions, pm_sparks, pm_cores, pm_directions, pm_customer_personas, pm_force_modules) with RLS, queried via React Query.
  • Migration strategy: 3 phases — (1) schema + dual-write, (2) switch reads to DB, (3) remove Zustand store.

Use Pattern 7 in references/patterns.md for the general Zustand→DB migration pattern.

Related Skills

SkillUse For
code-wizardFind code before refactoring
docs-updaterSync docs after changelog
supabase-migration-writerDatabase migrations
admin-panel-builderAdmin page refactoring
idea-machinaIdeaMachina feature context and evolution pipeline

References

More by Spectaculous-Code

View all
core-ux-detective
0

Discover, define and canonicalize the core user tasks and user paths of the application. Use when (1) mapping what users can actually do in the app, (2) defining canonical user journeys/flows, (3) creating the AI-readable user model (core-user-model.json), (4) reviewing whether a new feature introduces a new core path, (5) other skills (help, marketing, onboarding) need authoritative task/path definitions to consume. Triggers: "core tasks", "user paths", "user journeys", "UX model", "what can users do", "core flows", "user model", "canonical tasks", file types: core-user-model.json.

landing-page-architect
0

Product marketing and landing page architect for Raamattu Nyt. Generates landing page copy, feature page copy, and CTA suggestions based on the canonical user model. Translates user paths into benefit narratives and core tasks into user value propositions. Use when (1) creating or updating the main landing page, (2) writing feature page copy, (3) generating marketing messaging for app features, (4) crafting CTAs, (5) translating technical features into user benefits, (6) planning marketing page structure. Triggers: "landing page", "marketing copy", "feature page", "CTA", "value proposition", "markkinointi", "laskeutumissivu", "ominaisuussivu", "benefits copy", "marketing messaging".

code-wizard
0

Codebase exploration and location finder for the Raamattu Nyt monorepo. Use when finding where specific functionality is implemented, locating constants/tokens/config values, discovering file patterns, or answering "where is X coded?" questions. Helps other skills and agents locate code quickly.

seo-ptimizer
0

Search Engine Optimization and AI Search Optimization (GEO) specialist. Use when: (1) optimizing for traditional search (Google, Bing), (2) optimizing for AI search engines (ChatGPT, Perplexity, Google AI Overviews, Claude), (3) implementing schema markup for AI citation, (4) improving Core Web Vitals (LCP, INP, CLS), (5) creating citation-worthy content structure, (6) zero-click optimization, (7) E-E-A-T signal implementation. Expert in GEO (Generative Engine Optimization), structured data, and AI-readable content.