refactor

Detect systemic architectural issues across plugins, scripts, and vault organization.

16|9|Updated Apr 4, 2026
One-click install
npx skills add https://github.com/sonthanh/brain-os-plugin --skill refactor-sonthanh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: refactor
Source: https://github.com/sonthanh/brain-os-plugin/tree/main/skills/refactor
Command: npx skills add https://github.com/sonthanh/brain-os-plugin --skill refactor-sonthanh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

System-level reorganization scan across the brain-os plugin + vault scripts + vault organization (and any additional repos the user lists in their personal scope file). Detects shallow modules, cross-skill duplication, unused code, conflicting patterns, and vault organizational drift. Runs weekly via cron (Sunday 02:00 ICT) — produces a report with proposed refactor issues. Use when user wants a system-level refactor scan, architecture review, codebase audit, or says 'reorganize', 'refactor', 'shallow modules', 'is this codebase still in shape', 'improve architecture', audit our architecture', or invokes /refactor. Different from /improve (per-skill, eval-gated) and /vault-lint (mechanical hygiene) — this is structural critique across artifacts.

Core Features & Use Cases

  • System-wide structural critique across artifacts
  • Generates a report with proposed refactor issues and cross-skill consolidation suggestions
  • Supports integration with /slice for downstream task slicing and action planning

Quick Start

Run the /refactor skill to perform a weekly system-wide refactor scan and review the generated report.

Frequently Asked Questions about refactor

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

FAQPage Schema
How do I perform a system-wide codebase refactor scan across multiple repositories?

A system-wide codebase refactor scan performs per-file structural analysis across plugins, scripts, and vault organization to detect shallow modules, cross-skill duplication, unused code, and conflicting patterns. It uses five detectors to surface actionable architectural issues in a standardized markdown report.

How does architectural drift detection work in a vault organization?

Architectural drift detection works by running structural critique detectors across vault scripts and organization artifacts on a scheduled cadence. It identifies conflicting patterns and organizational drift, then generates proposed refactor issues and cross-skill consolidation suggestions in a standardized report.

What is the best way to audit codebase architecture for shallow modules and unused code?

The best way to audit codebase architecture is running a structural refactor scan that applies five per-file detectors to identify shallow modules, unused code, and cross-skill duplication. It supports dry-run modes with checkpointing and honors architecture-exempt frontmatter to skip specific files.

Can I schedule an automated codebase architecture review to run weekly?

Yes, you can schedule an automated codebase architecture review to run weekly via cron. The scan operates on a weekly cadence, supporting both interactive and cron modes with checkpointing, and outputs a markdown report containing proposed refactor issues at a daily report path.

What is the difference between a structural refactor audit and mechanical code hygiene?

A structural refactor audit performs system-wide architectural critique across artifacts to find shallow modules and conflicting patterns, while mechanical code hygiene focuses on surface-level linting. The refactor scan generates proposed consolidation issues and can chain downstream for task slicing.

What should I do after identifying architectural issues and conflicting patterns in my codebase?

After identifying architectural issues, you should chain the generated refactor report to a task slicing workflow. This converts the proposed refactor issues and cross-skill consolidation suggestions into actionable GitHub issues for downstream execution and action planning.