source-command-refactor-all
БесплатноБез исполняемых скриптовНе проверенMigrated source command `refactor-all`
от databayt★ 19 звёзд на GitHubОб этом скилле
source-command-refactor-all
Use this skill when the user asks to run the migrated source command refactor-all.
Command Template
Refactor-All Command - Bulk Code Refactoring
Perform comprehensive refactoring across the entire codebase or specific modules
Usage
/refactor-all [scope] [refactoring-type] [options]
Examples
/refactor-all constants # Extract all magic numbers to constants
/refactor-all naming # Fix naming conventions across codebase
/refactor-all types # Add missing TypeScript types
/refactor-all imports # Organize and optimize imports
/refactor-all components/school-dashboard # Refactor specific directory
Refactoring Types
1. Constants Extraction
// Scan for magic numbers and strings
const patterns = {
magicNumbers: /\b(?<!\.)\d+\b(?!\.)/g,
hardcodedStrings: /'[^']+'|"[^"]+"/g,
repeatedValues: /findRepeatedValues()/,
}
// Before
if (students.length > 30) {
}
if (retries === 3) {
}
if (status === "active") {
}
// After
const MAX_STUDENTS_PER_CLASS = 30
const MAX_RETRY_ATTEMPTS = 3
const ACTIVE_STATUS = "active"
if (students.length > MAX_STUDENTS_PER_CLASS) {
}
if (retries === MAX_RETRY_ATTEMPTS) {
}
if (status === ACTIVE_STATUS) {
}
2. Naming Convention Fixes
// Apply consistent naming patterns
const namingRules = {
variables: "camelCase",
constants: "UPPER_SNAKE_CASE",
functions: "camelCase",
components: "PascalCase",
files: {
components: "PascalCase.tsx",
hooks: "use-kebab-case.ts",
utils: "camelCase.ts",
types: "types.ts",
},
}
// Automated fixes
renameVariable("user_name", "userName")
renameFunction("GetUserData", "getUserData")
renameFile("student-card.tsx", "StudentCard.tsx")
3. Type Safety Enhancement
// Add missing types
// Before
const processData = (data) => {
return data.map((item) => item.value)
}
// After
interface DataItem {
value: string
[key: string]: unknown
}
const processData = (data: DataItem[]): string[] => {
return data.map((item: DataItem) => item.value)
}
4. Import Organization
// Before (messy imports)
import React, { useState } from "react"
// After (organized)
// External packages
import React, { useState } from "react"
// Internal - auth/config
import { auth, auth } from "@/auth"
// Types
import type { User, User } from "@/types"
import { z, z } from "zod"
// Internal - components
import { Button, Button } from "@/components/ui/button"
import { Card, Card } from "@/components/ui/card"
5. Dead Code Removal
// Detect and remove
- Unused variables
- Unused functions
- Unused imports
- Commented-out code
- Unreachable code
- Empty files
- Duplicate code blocks
6. Async/Await Modernization
// Before (callbacks/promises)
function fetchData(callback) {
api
.get("/data")
.then((response) => {
callback(null, response.data)
})
.catch((error) => {
callback(error)
})
}
// After (async/await)
async function fetchData(): Promise<Data> {
try {
const response = await api.get("/data")
return response.data
} catch (error) {
throw new Error(`Failed to fetch data: ${error.message}`)
}
}
7. Component Splitting
// Before (large component)
const StudentDashboard = () => {
// 500 lines of mixed concerns
};
// After (split components)
const StudentDashboard = () => {
return (
<>
<StudentHeader />
<StudentStats />
<StudentCourses />
<StudentActivities />
</>
);
};
8. Extract Utility Functions
// Before (inline utilities)
const Component = () => {
const formatDate = (date) => {
/* ... */
}
const calculateAge = (birthDate) => {
/* ... */
}
const validateEmail = (email) => {
/* ... */
}
}
// After (extracted)
// utils/date.ts
export const formatDate = (date: Date): string => {
/* ... */
}
export const calculateAge = (birthDate: Date): number => {
/* ... */
}
// utils/validation.ts
export const validateEmail = (email: string): boolean => {
/* ... */
}
Scope Definition
Directory Scopes
/refactor-all src/components # All components
/refactor-all src/app # All pages
/refactor-all src/lib # All utilities
/refactor-all . # Entire codebase
Pattern Scopes
/refactor-all **/*.tsx # All React components
/refactor-all **/actions.ts # All server actions
/refactor-all **/*.tests.ts # All tests files
Module Scopes
/refactor-all students # Student module
/refactor-all school-dashboard/finance # Finance module
/refactor-all auth # Auth module
Hogwarts Platform Specific
Multi-Tenant Refactoring
// Ensure all queries include schoolId
const refactorMultiTenant = {
/
Установить source-command-refactor-all в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл source-command-refactor-all?
Migrated source command `refactor-all`
Как установить скилл source-command-refactor-all?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл source-command-refactor-all запускает скрипты?
Нет, скилл состоит только из инструкций (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