home / skills / codyswanngt / lisa / plan-reduce-max-lines

plan-reduce-max-lines skill

/.claude/skills/plan-reduce-max-lines

This skill reduces the maximum lines per file by updating eslint thresholds, identifying oversized files, and generating a refactoring plan with split tasks.

npx playbooks add skill codyswanngt/lisa --skill plan-reduce-max-lines

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.4 KB
---
name: plan-reduce-max-lines
description: This skill should be used when reducing the maximum file lines threshold and fixing all violations. It updates the eslint threshold configuration, identifies files exceeding the new limit, generates a brief with refactoring strategies, and creates a plan with tasks to split oversized files.
allowed-tools: ["Read", "Bash", "Glob", "Grep"]

---

# Reduce Max Lines

Target threshold: $ARGUMENTS lines per file

If no argument provided, prompt the user for a target.

## Step 1: Gather Requirements

1. **Read current config** from eslint thresholds (eslint.thresholds.json or similar)
2. **Run lint** with the new threshold to find violations:
   ```bash
   bun run lint 2>&1 | grep "max-lines"
   ```
3. **Note for each violation**:
   - File path
   - Current line count

If no violations at $ARGUMENTS, report success and exit.

## Step 2: Compile Brief and Delegate

Compile the gathered information into a structured brief:

```
Reduce max file lines threshold to $ARGUMENTS.

Files exceeding threshold (ordered by line count):
1. [file] - [current] lines (target: $ARGUMENTS)
2. ...

Configuration change: eslint.thresholds.json, maxLines to $ARGUMENTS

Refactoring strategies: extract modules, remove duplication, delete dead code, simplify logic

Verification: `bun run lint 2>&1 | grep "max-lines" | wc -l` → Expected: 0
```

Invoke `/plan-execute` with this brief to create the implementation plan.

Overview

This skill reduces the maximum allowed lines per file and produces a concrete plan to fix any violations. It updates the ESLint threshold, finds files that exceed the new limit, and generates a brief and task list to split oversized files and verify compliance.

How this skill works

The skill reads the current ESLint thresholds configuration and applies the requested max-lines value. It runs the linter to detect files violating the new limit, collects file paths and current line counts, and compiles a short brief listing offending files and suggested refactor strategies. Finally, it produces a step-by-step plan with split/refactor tasks and verification commands.

When to use it

  • You want to enforce a lower max-lines limit across the TypeScript codebase.
  • Before merging a policy change that tightens file size standards.
  • When preparing for a large reorganization or modularization effort.
  • If automated checks report growing file sizes and you need a remediation plan.

Best practices

  • Confirm the desired numeric threshold before running the change to avoid unnecessary churn.
  • Run lint locally or in CI with the new threshold to reproduce violations reliably.
  • Order files by descending line count so highest-impact splits are prioritized.
  • Prefer extracting cohesive modules, not arbitrary line cuts—preserve behavior and tests.
  • Add targeted unit tests or integration checks when extracting logic to prevent regressions.

Example use cases

  • Lower max-lines from 1000 to 500 to improve code readability and reviewability.
  • Enforce a stricter limit as part of a campaign to modularize legacy services.
  • Create a task plan for an engineering team to split the top 20 largest files.
  • Automate verification in CI by changing eslint.thresholds.json and failing builds until violations are fixed.

FAQ

What if no target is provided?

The skill prompts for the desired numeric max-lines threshold before making changes.

How are refactoring strategies suggested?

It recommends practical approaches: extract modules, remove duplication, delete dead code, and simplify logic, tailored to each offending file.