home / skills / codyswanngt / lisa / plan-reduce-max-lines-per-function
This skill reduces function line limits in TypeScript projects by updating eslint thresholds, identifying violators, and delivering a concrete refactor plan.
npx playbooks add skill codyswanngt/lisa --skill plan-reduce-max-lines-per-functionReview the files below or copy the command above to add this skill to your agents.
---
name: plan-reduce-max-lines-per-function
description: This skill should be used when reducing the maximum lines per function threshold and fixing all violations. It updates the eslint threshold configuration, identifies functions exceeding the new limit, generates a brief with refactoring strategies, and creates a plan with tasks to split oversized functions.
allowed-tools: ["Read", "Bash", "Glob", "Grep"]
---
# Reduce Max Lines Per Function
Target threshold: $ARGUMENTS lines per function
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-per-function"
```
3. **Note for each violation**:
- File path and line number
- Function name
- 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 lines per function threshold to $ARGUMENTS.
Functions exceeding threshold (ordered by line count):
1. [file:function] (lines: X, target: $ARGUMENTS) - Line Y
2. ...
Configuration change: eslint.thresholds.json, maxLinesPerFunction to $ARGUMENTS
Refactoring strategies: extract functions, early returns, extract conditions, use lookup tables, consolidate logic
Verification: `bun run lint 2>&1 | grep "max-lines-per-function" | wc -l` → Expected: 0
```
Invoke `/plan-execute` with this brief to create the implementation plan.
This skill reduces the maximum allowed lines per function across a TypeScript codebase and fixes all violations. It updates the ESLint threshold configuration, discovers functions that exceed the new limit, and produces a refactoring brief plus a task plan to split oversized functions.
The skill reads the existing ESLint thresholds configuration and updates the maxLinesPerFunction value to the requested target. It runs the linter with the new threshold to identify every violation, collects file paths, function names, line counts and locations, then generates a concise brief with refactoring strategies. Finally, it creates a prioritized task list to split or simplify offending functions and verifies success by re-running the lint check.
What inputs are required to run this skill?
Provide the target max lines per function. If omitted, the skill will prompt for the desired threshold.
How does the skill verify that all violations are fixed?
It reruns the linter and counts max-lines-per-function violations; success is when the count is zero.