refactor — community refactor, claude-skills-demo, kis9a, community, ai agent skill, ide skills, agent automation, AI agent skills, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Perfect for Code Optimization Agents needing automated bug-fixing and refactoring capabilities in Go codebases. Demonstration of automated bug-fixing pipeline using Claude Code Agent Skills with GitHub Actions

kis9a kis9a
[0]
[0]
Updated: 10/23/2025

Quality Score

Top 5%
30
Excellent
Based on code quality & docs
Installation
SYS Universal Install (Auto-Detect)
> npx killer-skills add kis9a/claude-skills-demo/refactor
Supports 19+ Platforms
Cursor
Windsurf
VS Code
Trae
Claude
OpenClaw
+12 more

Agent Capability Analysis

The refactor skill by kis9a is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance.

Ideal Agent Persona

Perfect for Code Optimization Agents needing automated bug-fixing and refactoring capabilities in Go codebases.

Core Value

Empowers agents to streamline code improvement using Claude Code Agent Skills with GitHub Actions, identifying and fixing issues through automated testing with 'go test' and code quality checks with 'go fmt' and 'go vet'.

Capabilities Granted for refactor

Automating bug-fixing pipelines for Go projects
Refactoring large functions into smaller, more manageable pieces
Improving code readability through variable and function name clarification

! Prerequisites & Limits

  • Requires GitHub Actions setup
  • Limited to Go codebases
  • Needs corresponding '_test.go' files for testing
Project
SKILL.md
3.2 KB
.cursorrules
1.2 KB
package.json
240 B
Ready
UTF-8

# Tags

[No tags]
SKILL.md
Readonly

手順

  1. 対象の特定: リファクタリング対象のファイル/関数を特定
  2. 既存テストの確認:
    • 対応する *_test.go を確認
    • go test ./... を実行してベースライン確立(全テストがパスすることを確認)
  3. リファクタリング計画: 以下の観点で改善機会を特定
    • 命名改善(変数名、関数名の明確化)
    • 関数分割(長すぎる関数、複数の責任を持つ関数)
    • 重複コード削除(DRY原則)
    • 複雑な条件式の簡素化
    • マジックナンバーの定数化
    • エラーハンドリングの改善
  4. リファクタリング実施: 小さなステップで段階的に変更
  5. テスト実行: 各ステップ後に go test ./... で機能不変を確認
  6. コード品質確認:
    • go fmt ./... でフォーマット
    • go vet ./... で静的解析
  7. コミット: 変更が成功したら、適切なメッセージでコミット(refactor: ...形式)

リファクタリングパターン

1. 命名改善

go
1// Before 2func f(n []int) int { ... } 3 4// After 5func Sum(numbers []int) int { ... }

2. 関数分割

go
1// Before: 1つの関数が複数の責任 2func ProcessData(data []byte) error { 3 // バリデーション 4 // パース 5 // 変換 6 // 保存 7} 8 9// After: 単一責任に分割 10func ValidateData(data []byte) error { ... } 11func ParseData(data []byte) (*Data, error) { ... } 12func TransformData(data *Data) *Result { ... } 13func SaveResult(result *Result) error { ... }

3. 重複削除

go
1// Before: 重複コード 2func AddUser(u User) { db.Insert("users", u) } 3func AddPost(p Post) { db.Insert("posts", p) } 4 5// After: 汎用化 6func Add[T any](table string, entity T) { db.Insert(table, entity) }

4. マジックナンバーの定数化

go
1// Before 2if len(items) > 100 { ... } 3 4// After 5const MaxItems = 100 6if len(items) > MaxItems { ... }

重要な原則

  • 機能不変: 外部から見た動作は一切変更しない
  • テストファースト: リファクタ前に必ずテストを実行
  • 小さなステップ: 一度に多くを変更しない
  • 継続的な検証: 各ステップ後にテスト実行
  • 新機能追加: リファクタリングと機能追加は分離

リファクタリング対象の優先順位

  1. High: 複雑度が高く、バグを生みやすい箇所
  2. Medium: 頻繁に変更される箇所
  3. Low: 安定していて変更頻度が低い箇所

出力例

markdown
1# Refactoring Report 2 3## Target 4- File: `pkg/calc/sum.go` 5 6## Changes Applied 71. ✅ Improved function naming clarity 82. ✅ Added nil check for defensive programming 93. ✅ Simplified loop condition 10 11## Test Results 12✅ All tests pass (before and after) 13- Tests run: 5 14- Coverage: 85% (unchanged) 15 16## Performance Impact 17No performance regression detected

ベストプラクティス

  • リファクタリング前後でベンチマークを取る(パフォーマンス改善の場合)
  • コミットメッセージに「何を」「なぜ」を明記
  • レビューしやすいように、変更を論理的に分割

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is refactor?

Perfect for Code Optimization Agents needing automated bug-fixing and refactoring capabilities in Go codebases. Demonstration of automated bug-fixing pipeline using Claude Code Agent Skills with GitHub Actions

How do I install refactor?

Run the command: npx killer-skills add kis9a/claude-skills-demo/refactor. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for refactor?

Key use cases include: Automating bug-fixing pipelines for Go projects, Refactoring large functions into smaller, more manageable pieces, Improving code readability through variable and function name clarification.

Which IDEs are compatible with refactor?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for refactor?

Requires GitHub Actions setup. Limited to Go codebases. Needs corresponding '_test.go' files for testing.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add kis9a/claude-skills-demo/refactor. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use refactor immediately in the current project.

Related Skills

Looking for an alternative to refactor or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

Generate customizable widget plugins for the prompts.chat feed system

149.6k
0
Design

linear

Logo of lobehub
lobehub

Linear issue management. MUST USE when: (1) user mentions LOBE-xxx issue IDs (e.g. LOBE-4540), (2) user says linear, linear issue, link linear, (3) creating PRs that reference Linear issues. Provides

73.4k
0
Communication

testing

Logo of lobehub
lobehub

Testing guide using Vitest. Use when writing tests (.test.ts, .test.tsx), fixing failing tests, improving test coverage, or debugging test issues. Triggers on test creation, test debugging, mock setup

73.3k
0
Communication

zustand

Logo of lobehub
lobehub

Zustand state management guide. Use when working with store code (src/store/**), implementing actions, managing state, or creating slices. Triggers on Zustand store development, state management questions, or action implementation.

72.8k
0
Communication