analysis-refactor

Refactor sequential analysis scripts into a five-layer modular architecture with run_one orchestration.

1|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/bcmcpher/my-skills --skill analysis-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: analysis-refactor
Source: https://github.com/bcmcpher/my-skills/tree/main/plugins/modular-analysis/skills/analysis-refactor
Command: npx skills add https://github.com/bcmcpher/my-skills --skill analysis-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured blueprint to transform a sprawling, ad-hoc data analysis script into a stable, five-layer modular architecture (constants → data loading → atomic functions → output functions → orchestrator run_one) to improve maintainability, reuse, and robustness.

Core Features & Use Cases

  • Phase-driven refactoring to isolate constants, data loading, and computation, enabling predictable, auditable workflows.
  • Pure, well-scoped functions with clear inputs and outputs; easier testing and reuse.
  • Central orchestration via run_one that handles per-pair iteration, error handling, and consistent outputs.
  • Clear separation of concerns (loading, processing, output) and deterministic results suitable for extension and testing.
  • Guidance for retrofit-testing with /retrofit-tests to validate extracted components.

Quick Start

Begin by mapping your target script to the five-layer structure and use run_one to orchestrate per-pair computations.

Frequently Asked Questions about analysis-refactor

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

FAQPage Schema
How do I refactor a messy analysis script into modular code?

Refactoring a messy analysis script involves transforming it into a five-layer modular architecture: constants, data loading, atomic functions, output functions, and an orchestrator. This isolates computation and I/O to improve maintainability and robustness.

What is the best way to structure a data analysis workflow for testing?

The best way to structure a data analysis workflow for testing is separating concerns into pure, well-scoped functions with clear inputs and outputs. Extracting constants and isolating data loading creates deterministic, auditable workflows that are easy to validate.

Can I use this modular architecture approach for scripts in any programming language?

Yes, this modular architecture approach applies across scripting languages. It provides a language-agnostic blueprint to isolate constants, data loading, and computation, enabling predictable and testable workflows regardless of the specific language used.

How do you handle errors when iterating over dimensional combinations in a script?

Handling errors when iterating over dimensional combinations requires a central orchestrator, like a run_one function. It manages per-pair iteration and consistent outputs while gracefully catching errors to prevent total workflow failure.

How do I add tests to an existing sequential script after refactoring?

Adding tests to an existing sequential script after refactoring uses a retrofit-testing approach. This validates the extracted atomic components and isolated functions to ensure the newly structured modular workflow behaves correctly.