본문으로 건너뛰기
cccskills
무료GitHub에 공개

cc-refactor

Run the refactor workflow — mandatory architectural justification, test verification, risk-based implementation, and scope enforcement.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.3 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Refactor Workflow

Refactor description: $ARGUMENTS

Describe what you want to refactor and why. Include:

  • The current structure or pattern being changed
  • The target structure or pattern
  • The motivation (performance, readability, architectural alignment, etc.)
  • Known risk areas or dependencies

Prerequisite — Test coverage check

Before any agent is invoked, verify that the code being refactored has adequate test coverage.

A refactor without tests is not a refactor — it is a rewrite with unknown behavioral consequences.

If coverage is insufficient:

  1. STOP. Report the coverage gap to the human.
  2. Suggest invoking /cc:test-plan first to establish coverage.
  3. Do not proceed with the refactor until coverage is confirmed.

Step 1 — Architectural justification (architect)

Always invoke architect first, regardless of risk level. A refactor without a written justification is scope creep in disguise.

architect must produce a Refactor Plan that includes:

  • Statement of the problem with the current structure
  • Proposed target structure and rationale
  • Affected files and module boundaries
  • Risk level: low, medium, or high
  • Behavioral invariants that must not change
  • Open questions requiring human input

Scope creep warning: If during planning architect identifies unrelated improvements, they must be listed separately as "Out of scope." They are not part of this refactor.

STOP here. Show the Refactor Plan and wait for explicit human approval. Do not proceed without written approval of the plan.


Step 2 — Route by risk

Read the risk field from the Refactor Plan and follow the corresponding route.

Low-risk route

Applies when: the refactor is purely internal, no public interfaces change, full test coverage exists for the affected code, and behavioral impact is isolated to the refactored module.

Route: architect (done) → implementer

Proceed to Step 3a.

Medium or high-risk route

Applies when: module boundaries change, shared interfaces are affected, performance characteristics may change, or the refactor touches more than two files with behavioral impact.

Route: architect (done) → implementer → reviewer

Proceed to Step 3b.


Step 3a — Implementation, low-risk (implementer)

Invoke implementer with the approved Refactor Plan. Implementer creates a Git Worktree before touching any file; all edits happen inside it.

implementer must:

  1. Read the Refactor Plan before opening any file
  2. Apply only the changes specified in the plan
  3. Run the full test suite before and after — both runs must pass
  4. Produce an Implementation Summary: what changed, what did not change, test results before and after

Any deviation from the plan — including "obvious improvements" encountered during implementation — must be flagged and held for a separate task.


Step 3b — Implementation, medium/high-risk (implementer)

Same rules as 3a. Additionally:

  • implementer must document any unexpected complexity discovered during implementation and pause if the complexity changes the risk assessment
  • If new risks are found, STOP and report to the human before continuing

Step 4 — Test suite verification

For all risk levels, confirm:

  • All tests that existed before the refactor still pass
  • No test was deleted or commented out to make the suite pass
  • Behavior documented in the Task Card remains unchanged

If any test fails that was passing before, the refactor has introduced a regression. STOP and report.


Step 5 — Code review (reviewer) — medium/high-risk only

Invoke reviewer with the diff and Refactor Plan.

reviewer must verify:

  • The implementation matches the approved plan
  • No behavior was changed beyond the plan's scope
  • No unrelated files were modified

Review Report must include CRITICAL / WARNING / SUGGESTION findings. CRITICAL findings block completion.


Completion

Report: Refactor Plan (approved), Implementation Summary, test results before and after, Review Report (if applicable).

The refactor is complete only when: all pre-existing tests still pass, the implementation matches the approved plan exactly, and no CRITICAL review findings remain.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Use when adding monitoring, metrics, logging, or tracing to Spring AI or LLM integration code. Covers token tracking, latency measurement, cost estimation, and prompt/response logging. Use when user mentions AI monitoring, token costs, or LLM observability.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

lgzarturo/springboot-course32026년 10월 20일 업데이트

android

무료

Provides expert knowledge for building modern native Android apps using Kotlin, Jetpack Compose, Material Design 3, MVI architecture, Hilt dependency injection, and Media3/ExoPlayer.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

lgzarturo/springboot-course32026년 10월 20일 업데이트

Design, implement, review, and audit Android Jetpack Compose UI/UX for phone interfaces. Use when a request concerns concrete Compose layout, components, interaction, accessibility, or visual behavior. Do not activate for framework or dependency presence alone; non-UI Android work is excluded.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

lgzarturo/springboot-course32026년 10월 20일 업데이트

Provides expert knowledge for designing, implementing, and managing REST API versioning strategies with deprecation workflows.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

lgzarturo/springboot-course32026년 10월 20일 업데이트

astro

무료

Provides expert knowledge for building Astro 5+ sites with Islands Architecture, Content Collections, TypeScript, and performance-first rendering strategies.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

lgzarturo/springboot-course32026년 10월 20일 업데이트

Audits token storage mechanisms to prevent XSS-based JWT theft.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

lgzarturo/springboot-course32026년 10월 20일 업데이트

lgzarturo의 스킬 모두 보기

이 스킬의 문제 신고