Coding.Factor Common Code
БесплатноБез исполняемых скриптовНе проверенIdentify and refactor duplicated code into shared functions across Python files
от gpsaggese★ 158 звёзд на GitHubОб этом скилле
Role
- Senior Python engineer, experienced in refactoring and codebase hygiene
Goal
I will give references to one or more Python source files
Your task is to:
- Read and analyze the code across these files
- Identify meaningful duplicated or near-duplicated code blocks that can be safely refactored into shared functions
- Report these changes
- Ask the user
You must not change the behavior of the code
Plan Only (--only_plan)
- With
--only_plan, follow.claude/skills/skill.rules.mdsection "Create Only a Plan with--only_plan" - Write the plan to
coding.factor_common_code.<INPUT_REF>.md, then stop without executing the skill--dry_runis different: it only reports the duplicated code and writes its cfile
Workflow
Objectives
- Detect common logic that appears in multiple places (exact or structurally similar)
- Propose reusable functions that improve maintainability and readability
Guidelines
- Skip trivial functions (fewer than 2-3 meaningful lines)
- Avoid trivial abstractions. Prefer logic that:
- Is likely to change in one place in the future
- Encapsulates a clear responsibility
- If similar blocks are not identical, briefly explain why they can still be unified
- Do not rewrite the full implementation unless explicitly asked. Only identify and describe refactor opportunities
Output Format
- If the user uses the option
--dry_run, report the output as below instead of executing the refactorings - For each proposed refactoring, produce:
- Proposed function interface
- Function name
- Parameters (with brief explanation if non-obvious)
- Return value (if any)
- Summary of the locations of duplicated code
- Use the following format:
file1.py: l1-l2, l3-l4, ... file2.py: l5-l8, ...
- Use the following format:
- Create a vim quickfix cfile
coding.factor_common_code.<INPUT_REF>.cfilein the current dir for the locations, using the convention in.claude/skills/cfile.rules.md<INPUT_REF>comes from<FILE>, as in.claude/skills/skill.rules.md### Name the Output File
- Proposed function interface
Make Changes
- Make the changes to remove repeated code
Conventions
- Follow the rules in
.claude/skills/coding.rules.md
Verification
-
--only_plan(check only this item): the plan is incoding.factor_common_code.<INPUT_REF>.mdin the current dir, has theGenerated byline, and nothing was executed - The output file is
coding.factor_common_code.<INPUT_REF>.cfilein the current dir - Confirm proposed functions are non-trivial and each encapsulates a clear responsibility
- Confirm the code behavior is unchanged after refactoring
- Confirm the cfile locations point to the correct duplicated blocks
Установить Coding.Factor Common Code в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Coding.Factor Common Code?
Identify and refactor duplicated code into shared functions across Python files
Как установить скилл Coding.Factor Common Code?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Coding.Factor Common Code запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic