tcl-refactor

Apply mechanical refactorings to Tcl code using the Tcl LSP engine.

59|6|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/bitwisecook/tcl-lsp --skill tcl-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tcl-refactor
Source: https://github.com/bitwisecook/tcl-lsp/tree/main/ai/claude/skills/tcl-refactor
Command: npx skills add https://github.com/bitwisecook/tcl-lsp --skill tcl-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill automates the process of improving Tcl code quality and maintainability through safe, mechanical refactorings, reducing the risk of introducing bugs during code updates.

Core Features & Use Cases

  • Automated Refactoring: Applies common Tcl code transformations like variable extraction/inlining, converting conditional chains to switches, and improving expression bracing.
  • LSP Integration: Leverages the Tcl Language Server Protocol's refactoring engine for reliable and precise code modifications.
  • Use Case: Refactor a complex if/elseif structure in a Tcl script into a more readable switch statement to improve clarity and reduce potential errors.

Quick Start

Use the tcl-refactor skill to convert if/elseif chains to switch statements in the file main.tcl.

Frequently Asked Questions about tcl-refactor

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

FAQPage Schema
How do I convert if/elseif chains to switch statements in Tcl code?

To convert if/elseif chains to switch statements in Tcl, apply a mechanical refactoring that transforms conditional structures into switch statements. This improves code readability and reduces potential errors.

What is a safe way to extract or inline variables in Tcl scripts?

Safe variable extraction and inlining in Tcl scripts is achieved through mechanical code transformations. This refactoring improves code structure while minimizing the risk of introducing bugs during updates.

Does Tcl refactoring work with the Language Server Protocol?

Tcl refactoring works with the Language Server Protocol by leveraging the Tcl LSP refactoring engine. This integration ensures reliable and precise code modifications during structural transformations.

Can I optimize switch statements to use dictionaries in Tcl?

You can optimize switch statements to use dictionaries in Tcl through safe, mechanical refactoring. This transformation improves code structure and readability by leveraging dictionary-based logic.

What is the best way to improve expression bracing in Tcl code?

The best way to improve expression bracing in Tcl code is through automated mechanical refactoring. This applies safe transformations to ensure expressions are properly braced, improving code clarity and maintainability.

Are there limitations to automated Tcl code refactoring?

Automated Tcl code refactoring is limited to safe, mechanical transformations like variable extraction, conditional chain conversion, and expression bracing. It focuses on structural improvements without altering complex logic.