qwen_cli_refactor

Extract logical command modules from monolithic Python CLI files.

2|Updated Mar 28, 2025
One-click install
npx skills add https://github.com/FOUNDUPS/Foundups-Agent --skill qwen-cli-refactor-foundups
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: qwen_cli_refactor
Source: https://github.com/FOUNDUPS/Foundups-Agent/tree/main/.claude/skills/qwen_cli_refactor
Command: npx skills add https://github.com/FOUNDUPS/Foundups-Agent --skill qwen-cli-refactor-foundups

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of overly large and complex command-line interface (CLI) files by breaking them down into smaller, manageable, and maintainable modules.

Core Features & Use Cases

  • Monolithic CLI Refactoring: Extracts logical command groups from large main() functions into separate Python files.
  • Automated Module Creation: Generates new command module files and refactors the main CLI entry point to route commands appropriately.
  • Use Case: Refactor a 1,500-line CLI script into a well-structured application with 5 distinct command modules, improving readability and maintainability while ensuring all original functionality is preserved.

Quick Start

Use the qwen_cli_refactor skill to refactor the file '/path/to/cli.py' by extracting command modules.

Frequently Asked Questions about qwen_cli_refactor

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

FAQPage Schema
How do I refactor a monolithic Python CLI into separate modules?

To refactor a monolithic Python CLI, you extract logical command groups from a large main() function into separate files. This Skill automates that code extraction, generating new command module files and updating the entry point to route commands appropriately.

When do I need to break down a large CLI script?

You need to break down a large CLI script when the monolithic file exceeds 1,000 lines, becoming overly complex and difficult to maintain. Extracting logical command groups into separate Python files improves readability and manageability.

Can I preserve original command flags when extracting CLI modules?

Yes, you can preserve original command flags when extracting CLI modules. The refactoring process utilizes Qwen 1.5B for strategic code analysis and Gemma 270M for pattern fidelity validation to ensure all original functionality and flags are maintained post-refactoring.

What's the best way to split a 1,500-line Python CLI file?

The best way to split a 1,500-line Python CLI file is to extract logical command groups into separate files using automated analysis. This creates a well-structured application with distinct command modules while ensuring all original functionality is preserved.

Does this CLI refactoring process support automated module creation?

Yes, this CLI refactoring process supports automated module creation. It generates new command module files and automatically refactors the main CLI entry point to route commands appropriately, eliminating manual file creation and routing updates.

Why use Qwen and Gemma models for Python code extraction?

Qwen and Gemma models are used for Python code extraction to ensure high-quality refactoring. Qwen 1.5B performs strategic analysis and code extraction, while Gemma 270M validates pattern fidelity, ensuring all original functionality and flags are preserved.