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

refactor-code

Refactor Python code to improve quality while keeping functionality intact. Use when cleaning up complexity, removing duplication, or tightening structure.

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

설치 방법 보기

포함된 파일(1)

  • SKILL.md2.1 KB

SKILL.md(원문)

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

Refactor Code

Improve readability, maintainability, and testability without changing behavior.

When to run this skill

  • You’ve been asked to clean up tangled logic or long functions
  • Technical debt (duplication, inconsistent naming) is slowing future work
  • Tests are hard to reason about, or core modules mix responsibilities

Steps

  1. Code quality improvements

    • Break large functions or classes into smaller helpers
    • Extract reusable utilities and keep them pure when possible
    • Rename variables/functions to clearly express intent
    • Replace dict/tuple blobs with Pydantic BaseModels where appropriate
  2. Reduce complexity

    • Flatten deeply nested conditionals (guard clauses, early returns)
    • Replace repetitive code with loops/fixtures/generator helpers
    • Favor composition over inheritance; inject dependencies explicitly
    • Replace boolean flags with clear strategy objects or enums
  3. Enhance maintainability

    • Add or strengthen type hints and docstrings
    • Centralize configuration/timeouts/paths in constants or settings modules
    • Align with SOLID principles when refactoring services or handlers
    • Improve logging and error handling so future debuggers have context
  4. Optimize but stay Pythonic

    • Use list/dict comprehensions when they improve clarity
    • Avoid premature micro-optimizations—profile before optimizing loops
    • Keep dependencies explicit instead of hiding global state

Checklist

  • Extracted reusable functions or helpers
  • Removed duplication and improved naming
  • Simplified nested logic and guard clauses
  • Added or improved type hints/docstrings
  • Tuned logging/error handling to clarify intent
  • Ensured tests cover refactored paths

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

Implement comprehensive error handling for Python code paths to keep services resilient and user-friendly. Use when failures are currently silent or exceptions leak through.

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

Unique-AG/ai52026년 10월 20일 업데이트

Tabular and numerical data analysis with descriptive statistics and insights. Use when the user provides data, tables, CSVs, or numbers and wants analysis.

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

Unique-AG/ai52026년 10월 20일 업데이트

Financial factsheet analysis with key metrics extraction and investment rationale

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

Unique-AG/ai52026년 10월 20일 업데이트

ci-fix

무료

Diagnose and fix CI failures without leaving your editor.

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

Unique-AG/ai52026년 10월 20일 업데이트

Reproduce ai-repo PR checks locally with Poe and CI scripts, including per-package typecheck and coverage behavior. Use when validating changes before push or when user asks which local commands match CI.

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

Unique-AG/ai52026년 10월 20일 업데이트

Ask clarifying questions before implementing to ensure Python requirements are understood. Use when a task lacks detail, dependencies are unclear, or multiple interpretations are possible.

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

Unique-AG/ai52026년 10월 20일 업데이트

Unique-AG의 스킬 모두 보기

이 스킬의 문제 신고