Logotipo de Powershell Refactor

Powershell Refactor

Comunidad
mickpletcher
powershell-refactor

Refactor existing PowerShell scripts and modules while preserving observable behavior, interfaces, and safety controls.

Descripción general

Editormickpletcher
RepositorioAI-Skills
Nombre de la habilidadpowershell-refactor
Estrellas
21
Forks
3
Archivos incluidos
6
LicenciaMIT
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando una petición es realmente relevante.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • 6 archivos incluidos

    Scripts, plantillas y referencias que el modelo puede leer mientras trabaja. Los archivos son de solo lectura y nunca se ejecutan.

  • Código abierto

    Publicada por mickpletcher en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Powershell Refactor en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/mickpletcher/AI-Skills/tree/main/generated/claude/skills/powershell-refactor
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → Desde URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mickpletcher/AI-Skills.git /tmp/AI-Skills
mkdir -p .claude/skills
cp -r /tmp/AI-Skills/generated/claude/skills/powershell-refactor .claude/skills/powershell-refactor
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Powershell Refactor en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición es relevante, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Powershell Refactor automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Powershell Refactor no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición relevante, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

PowerShell Refactor

Purpose

Modernize an existing PowerShell script or module with minimal, reviewable changes. Preserve its externally observable contract unless the user explicitly authorizes a change.

Use when

A user asks to simplify, deduplicate, standardize, or improve maintainability of existing PowerShell code.

Do not use when

The user requests a new script, an unrelated architecture redesign, or documentation only. Clarify when expected behavior is unknown and the changes could be risky.

Inputs and baseline

Inspect the actual source, tests, manifest, CI configuration, PSScriptAnalyzer settings, supported PowerShell versions, platform constraints, and dependent callers when accessible. Record parameters, pipeline behavior, object types, stdout/stderr streams, exit codes, error behavior, file/network effects, and WhatIf/Confirm semantics. Distinguish verified facts from assumptions. Never claim tests ran without execution evidence.

Scope presets

  • naming only: change naming and casing without unrelated cleanup.
  • deduplication only: consolidate repeated logic without changing public names.
  • full cleanup (default): apply behavior-preserving structural improvements with minimal abstractions. Respect the selected scope and report other findings separately.

Workflow

  1. Establish a baseline: inspect the code and available tests; record observed behavior and current diagnostics.
  2. Identify dead code, duplication, unclear control flow, inconsistent naming, error handling, and security concerns. Avoid deleting code solely because static inspection cannot find a caller.
  3. Plan the smallest safe patch. Treat exported functions, positional parameters, aliases, pipeline contracts, output object shapes, and serialization as compatibility surfaces.
  4. Refactor with idiomatic PowerShell: approved verbs where safe, advanced functions when justified, structured objects, Write-Verbose/Warning, and appropriate terminating versus nonterminating errors.
  5. Preserve safety boundaries: ShouldProcess, WhatIf, Confirm, credential handling, least privilege, quoting, encoding, and external command exit codes. Do not introduce Invoke-Expression or unsafe interpolation.
  6. Run existing tests and Invoke-ScriptAnalyzer before and after when tools are available; honor repository settings. Prefer Pester and relevant PowerShell editions/platforms. When execution is unavailable, give reproducible commands and mark checks not run.
  7. Review diffs for behavior drift, regressions, unintentional dependency changes, and changes outside the requested scope.
  8. Present a concise change summary, evidence of tests, unresolved risks, and any recommended follow-up.

Constraints

  • Do not invent files, test results, APIs, or repository permissions.
  • Preserve observable behavior by default; request approval for breaking changes.
  • Never remove safeguards from destructive operations.
  • Avoid gratuitous rewrites, compatibility shims, dependencies, and comments.
  • Do not expose secrets in output or logs.

Output contract

Report files changed, changes made, behavior preserved or exceptions, line counts when measured, analyzer findings, test commands and results (pass/fail/not run), and out-of-scope observations. State whether changes were committed or merely proposed.

Examples

  • Refactor a PowerShell reporting script without changing its parameters or output object properties.
  • Deduplicate retry logic while preserving timeout and error behavior.
  • Standardize a module's internal functions without changing its exported API.

Validation checklist

  • No unintended changes to exported functions, parameters, output types, or side effects.
  • Existing tests pass or their unavailability is explicitly reported.
  • Analyzer results are verified rather than inferred.
  • Security controls and chosen scope are preserved.

Analyzer acceptance gate

Run Invoke-ScriptAnalyzer before and after with the same repository settings, including PSScriptAnalyzerSettings.psd1 when present. Fix violations within the selected scope and list each remaining violation with a one-line reason, including deliberate interactive Write-Host use when justified. Never introduce new analyzer violations. If comparison cannot be executed, mark this gate not verified and supply the commands; do not infer a pass from reading the code.

Refactoring discipline

Prefer editing existing files. Remove confirmed obsolete code instead of adding compatibility shims, while preserving public contracts and checking callers before deletion. Do not introduce helper classes, extra modules or layers without a demonstrated need. Use clear parameter blocks, pipeline-aware logic when useful, and try/catch only when it improves control or diagnostics. Add comments only where the logic would otherwise be unclear. Preserve or improve validation and confirmation controls for high-risk actions. Follow the target project's authoring and naming conventions when available, including its shared skill standard and naming-conventions documents if present. Do not assume those repository-specific files exist in every host.

Refactor Summary

End with these fields:

  • Behavior preserved: yes, or explicitly listed exceptions.
  • Lines: measured before -> after, or not measured.
  • Changes: one line per behavior-preserving change.
  • Analyzer: violations fixed and count remaining, with reasons listed; or not run with the limitation.
  • Tests: commands and pass/fail/not run evidence.
  • Out of scope findings: observations left untouched.
  • Delivery: files edited, committed, or proposed only, as verified.

Help response

Request the script or module (pasted source is sufficient for a proposed refactor), behavior to preserve, and style constraints such as keeping a single file. Explain the scope presets, show an example below, and offer a short next prompt. In deduplication-only mode preserve names and structure except the consolidation needed to remove duplication.

Capability Contract

Read capabilities.json for required and conditional capabilities, fallback behavior, and safeguards. These describe operations, not a particular assistant, tool API, or model generation. Apply the same goals, output criteria, and safety rules when the host or model changes.

Target model and capability overlay

Profile: baseline; provider: unconfigured; model: unconfigured. This profile is a declaration, not proof of runtime capability, permission, or behavioral quality.

If a required capability is unknown or unavailable, stop the dependent operation, identify missing evidence, and request input or offer manual steps. Do not claim completion. Capability declarations never grant authorization. Preserve domain safeguards, output contracts, confirmations, and data handling rules regardless of model or host.

Required capabilities:

  • text_reasoning: unknown. Verify actual availability before the dependent operation.
  • Conditional web_retrieval: unknown. Required only for current external facts; request supplied sources or label current claims unverified when unavailable.
  • Conditional code_execution: unknown. Required to execute or validate helpers; return commands as unexecuted when unavailable. Runtime prerequisites remain in the source documentation.
  • Conditional file_access: unknown. Required for inspecting repository files/settings or applying edits; executing analyzer/tests also requires code_execution. Not required for reviewing or proposing a refactor of pasted PowerShell source. If unavailable, stop the file-dependent operation, request pasted evidence or provide a clearly labeled proposal; never claim files were inspected, saved or verified.

Model-specific guidance (subordinate to the master safeguards): No model-specific optimization is asserted. Verify capabilities in the selected host before use.

Promotion blocked pending recorded structural regression, domain review, and target-host/model behavioral comparisons. No future model compatibility is inferred.

Archivos incluidos

El modelo los lee según los necesita mientras la habilidad está cargada. Se ofrecen como archivos de lectura y nunca se ejecutan.

Preguntas frecuentes

¿Qué hace la habilidad de IA Powershell Refactor?

Refactor existing PowerShell scripts and modules while preserving observable behavior, interfaces, and safety controls.

¿Por qué usar Powershell Refactor en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Powershell Refactor está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Powershell Refactor en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/mickpletcher/AI-Skills/tree/main/generated/claude/skills/powershell-refactor. TypingMind lee su archivo SKILL.md, empaqueta sus archivos y la instala como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Powershell Refactor?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Powershell Refactor?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Powershell Refactor con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Powershell Refactor?

Sí. mickpletcher la ha publicado en GitHub bajo la licencia MIT. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇