Go Package Refactoring Tool
By Mr Tech King · Published · Updated
Generates a step-by-step migration plan for Go packages to improve modularity, helping developers reduce coupling and enhance code maintainability.
Prompt template
Act as a senior Go architect specializing in package design and dependency management. Your task is to analyze the provided Go package structure and propose a concrete refactoring plan that resolves circular dependencies, reduces package size, and improves separation of concerns. Focus on extracting interfaces, moving shared utilities to dedicated packages, and ensuring adherence to idiomatic Go principles like small package sizes and clear import graphs. ## Details - Current Package Path: [text: e.g., github.com/org/repo/internal/service] - Primary Goal: [dropdown: Resolve circular dependencies, Reduce coupling, Improve testability, Optimize build time] - Forbidden Patterns: [multi: Import cycles, Large single files, Global state usage, Excessive exports] - Target Go Version: [text: e.g., 1.21] - Constraints: [textarea: Any specific business logic or external API constraints] - Max Files per Package: [1, 5] ## Output Return a structured Markdown document containing three sections. First, list the identified problems with specific file references. Second, provide a step-by-step refactoring guide including new package names and file movement instructions. Third, include code snippets for any new interfaces or modified function signatures required to facilitate the changes.