python-refactoring

Perform behavior-preserving refactors on pyarnes-based Python projects with pre-flight checks and committed workflows.

Updated Apr 17, 2026
One-click install
npx skills add https://github.com/Cognitivemesh/pyarnes --skill python-refactoring-cognitivemesh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-refactoring
Source: https://github.com/Cognitivemesh/pyarnes/tree/main/template/.claude/skills/python-refactoring
Command: npx skills add https://github.com/Cognitivemesh/pyarnes --skill python-refactoring-cognitivemesh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Behavior-preserving Python refactoring for pyarnes-based projects, enabling developers to move, extract, inline, or rename code without altering observable behavior.

Core Features & Use Cases

  • Safety-first refactoring: Enforces tests stay green and guards against behavior changes.
  • Domain-aware moves: Supports moving code into domain folders and applying hexagonal (ports & adapters) principles.
  • Structured workflow: Provides pre-flight checks, a fixed commit discipline, and a catalog of move types (extract atom/molecule, extract port, extract adapter, inline, rename-to-domain).

Quick Start

Run the refactor workflow on a green baseline to safely move, extract, inline, or rename code without changing behavior.

Frequently Asked Questions about python-refactoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor Python code without changing its behavior?

To refactor Python code without changing behavior, you run a structured workflow that enforces pre-flight checks, requires existing tests to stay green, and applies a fixed catalog of move, extract, inline, and rename operations with disciplined commits.

How do I move code into domain folders using hexagonal architecture in Python?

Moving code into domain folders using hexagonal architecture requires domain-aware refactoring that applies ports and adapters principles, extracting atoms, molecules, ports, and adapters while ensuring tests remain green throughout the process.

Do I need existing tests before starting a Python refactoring workflow?

Yes, existing tests are required before starting a Python refactoring workflow. The safety-first approach enforces pre-flight checks that demand a green test baseline, ensuring all refactors preserve observable behavior without regressions.

What's the best way to extract a port or adapter during Python refactoring?

The best way to extract a port or adapter during Python refactoring is to use a structured refactor catalog that supports extract port and extract adapter operations, enforcing disciplined commits and verifying tests stay green after each move.

Can I rename code to match domain language safely in Python projects?

Yes, you can rename code to match domain language safely in Python projects by using the rename-to-domain refactor operation, which enforces test verification and disciplined commits to preserve observable behavior throughout the change.

Why should I use pre-flight checks before refactoring Python code?

Pre-flight checks are necessary before refactoring Python code to verify a green test baseline exists, ensuring the safety-first workflow can detect behavior changes and prevent regressions during move, extract, inline, or rename operations.