muxt-refactoring

Coordinates Go code, template and metadata edits for safe automated refactoring.

6|1|Updated Aug 5, 2024
One-click install
npx skills add https://github.com/typelate/muxt --skill muxt-refactoring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: muxt-refactoring
Source: https://github.com/typelate/muxt/tree/main/docs/skills/refactoring
Command: npx skills add https://github.com/typelate/muxt --skill muxt-refactoring

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill helps developers safely refactor Go web applications built with Muxt, preventing runtime errors caused by mismatches between route definitions, template names, and Go methods.

Core Features & Use Cases

  • Guided Refactoring: Provides step-by-step instructions for common refactoring tasks like renaming methods, changing route patterns, or moving templates.
  • Coupling Chain Validation: Emphasizes the critical loop of regenerating code and running checks (go generate, muxt check, go test) to maintain integrity.
  • Use Case: When you need to rename a GetUser handler method to FetchUser in your Muxt application, this skill guides you through updating the template definitions, regenerating handlers, and safely renaming the Go method using gopls.

Quick Start

Use the muxt-refactoring skill to safely rename a receiver method in your Muxt codebase.

Frequently Asked Questions about muxt-refactoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely rename a Go receiver method in a Muxt web application?

To safely rename a Go receiver method in a Muxt web application, you must update the template definitions, regenerate the handlers using go generate, and use gopls to rename the method to ensure code integrity.

What is the best way to change route patterns in a Go web project using Muxt?

Changing route patterns in Muxt requires a validation loop to prevent runtime errors. You must update the route definitions, run muxt check, and execute go generate to synchronize the route patterns with the generated Go code.

Why do I get runtime errors after moving template files in my Muxt codebase?

Runtime errors after moving template files occur due to mismatches between template locations and generated code. You must run go generate and go test to validate the coupling chain and sync the template paths with Go methods.

Can I refactor Muxt-generated Go code without running go generate and go test?

Refactoring Muxt-generated Go code without running go generate and go test is unsafe. Skipping this validation loop breaks the coupling chain between route definitions, template names, and Go methods, causing runtime errors.

What steps are required to update template locations in a Muxt project?

Updating template locations in a Muxt project involves moving the template files, updating the corresponding template definitions, and running the go generate and muxt check commands to validate the changes and prevent mismatches.

Does muxt refactoring support changing route paths and template names simultaneously?

Yes, Muxt refactoring supports changing route paths and template names simultaneously by guiding you through updating definitions, regenerating handlers with go generate, and validating the coupling chain using muxt check and go test.