Token导航 LogoToken导航TokenDH.com
前端设计external-servicegithub未标认证来源可访问clear审计异常

refactoring-workflow重构工作流程

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

20,401

周安装

812

GitHub Stars

8

下载量

8,878
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:refactoring-workflow(重构工作流程)
来源仓库:https://github.com/kaakati/rails-enterprise-dev
仓库路径:skills/refactoring-workflow
安装命令:
npx skills add https://github.com/kaakati/rails-enterprise-dev --skill 'Refactoring Workflow'
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/kaakati/rails-enterprise-dev --skill 'Refactoring Workflow'

简介

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。

  • 适用于 React、Next.js、Vue 等项目的前端重构,包括组件拆分、状态管理优化或样式统一。
  • 可生成新组件骨架、审查现有结构并提供 Tailwind/CSS 最佳实践建议。
  • 安装命令:npx skills add https://github.com/kaakati/rails-enterprise-dev --skill 'Refactoring Workflow'。
  • 改动前应在本地预览效果,避免仅凭描述产生视觉偏差。

SKILL.md

Refactoring Workflow Skill

Systematic refactoring with tracking, validation, and completeness verification.

Quick Start

# 1. Record what you're refactoring
record_refactoring "Payment" "Transaction" "class_rename"

# 2. Update files, track progress
update_refactoring_progress "Payment" "app/models/transaction.rb"

# 3. Validate no old references remain
validate_refactoring "Payment" "Transaction"

1. Refactoring Log Functions

record_refactoring()

Start refactoring by recording what's being changed:

record_refactoring() {
  local old_name=$1
  local new_name=$2
  local refactor_type=$3  # class_rename, attribute_rename, method_rename, table_rename

  if [ -n "$TASK_ID" ] && command -v bd &> /dev/null; then
    bd comment $TASK_ID "🔄 Refactoring Log: $old_name → $new_name

**Type**: $refactor_type
**Started**: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
**Status**: ⏳ In Progress

### Changes Planned

1. **$(echo $refactor_type | sed 's/_/ /g')**: \`$old_name\` → \`$new_name\`

### Affected Files (Auto-detected)

\`\`\`bash
# Ruby files referencing old name
$(rg --files-with-matches \"\\b$old_name\\b\" --type ruby 2>/dev/null | head -20 || echo "None detected")
\`\`\`

### Validation Checklist

- [ ] No references to \`$old_name\` in Ruby files
- [ ] No references in view templates
- [ ] No references in routes
- [ ] No references in specs
- [ ] No references in factories
- [ ] Migration files checked (if applicable)"
  fi
}

# Examples:
# record_refactoring "Payment" "Transaction" "class_rename"
# record_refactoring "user_id" "account_id" "attribute_rename"
# record_refactoring "payments" "transactions" "table_rename"

update_refactoring_progress()

Track progress as files are updated:

update_refactoring_progress() {
  local old_name=$1
  local file_updated=$2

  if [ -n "$TASK_ID" ] && command -v bd &> /dev/null; then
    bd comment $TASK_ID "✅ Refactoring Progress: Updated \`$file_updated\`

Old references to \`$old_name\` in this file have been updated.

Remaining files: $(rg --files-with-matches \"\\b$old_name\\b\" --type ruby 2>/dev/null | wc -l || echo "?")"
  fi
}

validate_refactoring()

Validate all references have been updated:

validate_refactoring() {
  local old_name=$1
  local new_name=$2

  echo "🔍 Validating refactoring: $old_name → $new_name"

  # Check for remaining references
  local remaining=$(rg --count "\\b$old_name\\b" --type ruby --type erb 2>/dev/null | wc -l)

  if [ "$remaining" -gt 0 ]; then
    echo "❌ Refactoring validation failed"
    echo "Found $remaining files still referencing '$old_name':"
    rg --files-with-matches "\\b$old_name\\b" --type ruby --type erb 2>/dev/null

    if [ -n "$TASK_ID" ] && command -v bd &> /dev/null; then
      bd update $TASK_ID --status blocked
    fi

    return 1
  else
    echo "✅ Refactoring validation passed"
    echo "All references to '$old_name' successfully updated."
    return 0
  fi
}

2. Complete Refactoring Workflow

Workflow Steps

  1. Start: Record refactoring with record_refactoring()
  2. Update: Update files incrementally, track with update_refactoring_progress()
  3. Validate: Before phase completion, run validate_refactoring()
  4. Fix: If validation fails, update remaining references
  5. Re-validate: Run validation again until it passes
  6. Complete: Only close task after validation passes

Example: Class Rename Workflow

# Phase starts: Renaming Payment to Transaction

# Step 1: Record refactoring
record_refactoring "Payment" "Transaction" "class_rename"

# Step 2: Update model file
mv app/models/payment.rb app/models/transaction.rb
# Update class name in file
sed -i 's/class Payment/class Transaction/g' app/models/transaction.rb
update_refactoring_progress "Payment" "app/models/transaction.rb"

# Step 3: Update associations in other models
# ... update files ...
update_refactoring_progress "Payment" "app/models/account.rb"

# Step 4: Update controller
mv app/controllers/payments_controller.rb app/controllers/transactions_controller.rb
# ... update class name and references ...
update_refactoring_progress "Payment" "app/controllers/transactions_controller.rb"

# Step 5: Update views, specs, factories, routes
# ... update all remaining files ...

# Step 6: Validate completeness
validate_refactoring "Payment" "Transaction"

if [ $? -eq 0 ]; then
  echo "✅ Refactoring complete"
else
  echo "❌ Refactoring incomplete, fix remaining references"
fi

3. Cross-Layer Impact Checklists

Class Rename Checklist

When renaming PaymentTransaction:

Ruby Layer:

  • Model class definition
  • Associations in other models (has_many:payments)
  • Controller class name
  • Controller instance variables (@payment)
  • Service class references
  • Job class references
  • Serializer references
  • String references (polymorphic: "Payment")

View Layer:

  • View template paths (app/views/payments/)
  • View helpers and form objects
  • Partials and layouts

Routes:

  • Route resources (resources:payments)
  • Named routes and path helpers

Tests:

  • Spec describe blocks
  • Factory definitions (:payment, :payments)
  • Fixtures (if used)

JavaScript/Frontend:

  • Stimulus controllers (payment_controller.js)
  • Stimulus class names (PaymentController)
  • data-controller attributes (data-controller="payment")
  • data-action attributes (data-action="payment#submit")
  • JavaScript imports and references
  • Event names (payment:updated)
  • Turbo frame IDs (#payment-form)
  • Importmap pins

I18n:

  • Locale keys (activerecord.models.payment)

Configuration:

  • Initializer references
  • Environment configs

Attribute Rename Checklist

When renaming user_idaccount_id:

Database:

  • Migration (column rename)
  • Run migration: rails db:migrate
  • Verify in schema.rb

Model:

  • Attribute references
  • Validations
  • Associations (:foreign_key option)
  • Scopes and queries

Controller:

  • Strong params

Views:

  • Form fields
  • Display references

Tests:

  • Spec let statements
  • Factory attributes

API:

  • Serializer attributes
  • API documentation

JavaScript:

  • data-{controller}-{attr}-value attributes
  • Stimulus value definitions

I18n:

  • Attribute keys (activerecord.attributes.model.user_id)

Table Rename Checklist

When renaming paymentstransactions:

  • Migration (table rename)
  • Run migration: rails db:migrate
  • Verify in schema.rb
  • Model table_name declaration (if explicit)
  • Foreign key constraints
  • Indexes
  • Raw SQL queries
  • Database views (if any)

JavaScript/Stimulus Refactoring Checklist

When renaming paymenttransaction in frontend:

  • Controller file rename (payment_controller.jstransaction_controller.js)
  • Controller class name (PaymentControllerTransactionController)
  • data-controller attributes in views
  • data-{controller}-target attributes
  • data-action attributes
  • JavaScript imports
  • Event names and dispatching
  • CSS class names that reference the controller
  • Turbo frame IDs
  • Importmap pins

Namespace/Module Move Checklist

When moving Services::PaymentBilling::Transaction:

  • File path (app/services/payment.rbapp/billing/transaction.rb)
  • Module/namespace declaration
  • All references to the old namespace
  • Autoload paths (if custom)
  • Spec file path
  • Factory namespace
  • Route namespace (if applicable)

4. Intentional Legacy References

Create .refactorignore to exclude files from validation:

# .refactorignore - Files to exclude from refactoring validation

# Legacy compatibility layer
lib/legacy_api_adapter.rb

# Historical documentation
CHANGELOG.md
docs/migration_guide.md

# Rename migrations (reference old names by design)
db/migrate/*_rename_*.rb

# External API contracts (can't change)
app/serializers/api/v1/*_serializer.rb

5. Integration with Beads

Refactoring workflow integrates with beads for:

  1. Task Tracking: Creates comments for start, progress, completion
  2. Status Updates: Sets task to blocked if validation fails
  3. Audit Trail: Full history of what was changed and when
# Set TASK_ID before starting refactoring
export TASK_ID="PROJ-123"

# All functions will automatically log to beads
record_refactoring "Payment" "Transaction" "class_rename"
update_refactoring_progress "Payment" "app/models/transaction.rb"
validate_refactoring "Payment" "Transaction"

6. Quick Reference

FunctionPurposeExample
record_refactoringStart trackingrecord_refactoring "Old" "New" "class_rename"
update_refactoring_progressTrack file updateupdate_refactoring_progress "Old" "path/file.rb"
validate_refactoringCheck completenessvalidate_refactoring "Old" "New"
Refactor TypeKey Layers to Check
class_renameModel, Controller, Views, Routes, Specs, JS
attribute_renameModel, Controller params, Views, Specs, JS values
table_renameMigration, Schema, Raw SQL
method_renameAll call sites, Specs
namespace_moveFile paths, Autoloading, All references

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

27.37%
按下载量换算2,430

windsurf

23.25%
按下载量换算2,064

OpenCode

17.42%
按下载量换算1,547

Codex

10.79%
按下载量换算958

Antigravity

6.65%
按下载量换算590

Gemini CLI

2.98%
按下载量换算265

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。来源字段存在多来源差异,先按来源优先级自动处理,无法消解时进入异常复核队列。

来源信息

继续浏览同类 Skills