Engineering
refactoring avatar

refactoring

Linter-driven refactoring agent that resolves complexity issues like cyclomatic depth, primitive obsession, and long functions using automated pattern extraction.

Introduction

The refactoring skill acts as an autonomous engineering assistant designed to maintain high code quality standards. It is specifically triggered by linter failures related to cyclomatic complexity, cognitive load, and maintainability indices. By acting as a bridge between static analysis tools and clean code principles, the agent systematically processes monolithic functions or tangled logic to ensure the codebase remains readable, scalable, and idiomatic.

  • Automated identification of code smells such as functions exceeding 50 lines, nesting levels beyond 2, and mixed levels of abstraction.

  • Implementation of standard refactoring patterns including storifying (extracting logic to clarify narrative flow), type extraction (curing primitive obsession), function extraction, and early return implementation to reduce branching complexity.

  • Integration with linter workflows such as task lintwithfix to provide iterative, verified code improvements.

  • Context-aware logic that analyzes whether a segment of code is suffering from poor structural design or simply requires better naming and modularization.

  • Use this skill when linter reports high cyclomatic or cognitive complexity scores to avoid technical debt accumulation.

  • The agent is designed to be proactive; it should be invoked during routine maintenance or when legacy code becomes difficult to extend.

  • Provide context via linter error logs; the agent expects input in the form of specific file paths and line numbers, followed by an analysis of the root cause.

  • While the tool performs automated refactoring, it is constrained to maintain test passing; users should ensure that the repository has adequate test coverage before triggering the agent. Avoid over-refactoring; the agent uses heuristics to prevent excessive abstraction and maintains a balance between design patterns and code simplicity.

Repository Stats

Stars
1
Forks
0
Open Issues
1
Language
Shell
Default Branch
main
Sync Status
Idle
Last Synced
May 3, 2026, 06:08 PM
View on GitHub
refactoring | Skills Hub