agentleFS
khairoldkhairold/claude-skills/skills/lint-fix/SKILL.md

lint-fix

Skill0 starsChanged 7 months agoMITView on GitHub

Run typecheck and lint, then fix all errors and warnings to zero. Use when asked to "do typecheck and lint", "fix lint errors", "fix all warnings", "clean up lint", or any request to make typecheck/lint pass clean. Applies a systematic batch-fix workflow rather than fixing issues one at a time.

18 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use docstring, changelog and 5 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • NVIDIASkill

    docstring

    Write or review docstrings for public modules, classes, and functions in sdm/. Use when adding or reviewing docstrings to follow repo best practices (Args sections, paper citations, tensor shape notation).

    Also in 3 projects that use this

  • HashiCorpSkill

    changelog

    Add a `.changelog/<PR_NUMBER>.txt` entry for a GitHub Pull Request, commit, and push.

    Also in 5 projects that use this

  • SentrySkill

    commit

    Create commit messages following Sentry conventions. Use when committing code changes, writing commit messages, or formatting git history. Follows conventional commits with Sentry-specific issue references.

    Also in 5 projects that use this

  • CloudflareSkill

    security-audit

    Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.

    Also in 3 projects that use this

  • SentrySkill

    review

    Fixture review skill.

    Also in 3 projects that use this

  • GoogleSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Before running anything, check package.json scripts and config files to determine:

    line 22
  2. Distinctive:

    Run typecheck and lint in parallel to get the full picture upfront:

    line 35
  3. Distinctive:

    Run the linter's auto-fix to eliminate mechanical issues (import order, duplicate imports, array type style, unused directives):

    line 46
  4. Distinctive:

    Read all files for the current pattern category in a single parallel tool call.

    line 76
  5. Distinctive:

    If anything remains, go back to Step 3 with the smaller set.

    line 95
  6. Very specific:

    Always include a -- reason comment after eslint-disable-line so future readers (human or agent) understand the intent:

    line 115

“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Lint Fix

A systematic workflow for driving typecheck and lint to zero errors, zero warnings.

Philosophy

  1. Zero tolerance — warnings are future errors. Fix them all, not just what's red.
  2. Auto-fix first — let the tooling do its job before you touch anything.
  3. Fix by pattern, not by file — categorize issues, then sweep each category across the whole codebase in one pass.
  4. Parallel everything — run typecheck and lint simultaneously; batch-read all affected files at once.
  5. Verify after every round — never assume fixes are clean. Re-run both checks after each batch of changes.
  6. Know when to suppress vs. fix — not every warning is a bug. Animated refs are stable. Platform checks are static. Add eslint-disable with an explanation, not blindly.

Step 0: Detect Project Tooling

Before running anything, check package.json scripts and config files to determine:

WhatHow to detect
Typecheck commandpackage.json scripts: typecheck, type-check, tsc, or fall back to npx tsc --noEmit
Lint commandpackage.json scripts: lint. Check for ESLint config (.eslintrc*, eslint.config.*), Biome (biome.json), or framework wrappers (expo lint, next lint)
Auto-fix flagESLint: --fix. Biome: check --fix. Expo: expo lint -- --fix
Package managerbun.lockb/bun.lock → bun, pnpm-lock.yaml → pnpm, yarn.lock → yarn, else npm

Workflow

Step 1: Discover

Run typecheck and lint in parallel to get the full picture upfront:

# Adapt these to the project's actual commands
npx tsc --noEmit 2>&1 | head -100 &
npm run lint 2>&1 | head -100 &
wait

Step 2: Auto-fix

Run the linter's auto-fix to eliminate mechanical issues (import order, duplicate imports, array type style, unused directives):

# ESLint
npx eslint . --fix
# Or framework wrapper
npx expo lint -- --fix
npx next lint --fix
# Or Biome
npx biome check --fix .

This typically resolves 30-60% of warnings with zero risk.

Step 3: Categorize remaining issues

Group what's left by pattern, not by file:

PatternExampleFix strategy
Conditional hooksuseState / useMemo / useCallback called after an early returnMove all hooks above the first conditional return
Unescaped entities' or " in JSX text contentReplace with &apos; / &quot;
Missing hook deps (real)A function or value genuinely needed in the dep arrayAdd the dependency, or wrap the value in useCallback/useMemo
Missing hook deps (stable refs)Animated values (useSharedValue), platform constants, router singletonsAdd eslint-disable-line react-hooks/exhaustive-deps with a -- comment explaining why it's safe
Type errorsWrong types, missing properties, etc.Fix the types to match the actual runtime contract
Unused variables/importsImported but not usedRemove them (auto-fix usually catches these)
Any pattern@typescript-eslint/*, no-explicit-any, etc.Fix the underlying issue; suppress only with explanation

Step 4: Batch-read affected files

Read all files for the current pattern category in a single parallel tool call. Don't fix one file, re-run, fix the next — that's O(n) round trips.

Step 5: Batch-fix by pattern

Apply the same class of fix across all affected files in one pass:

  • Conditional hooks: For each file, move all useState/useMemo/useCallback/custom hook calls above the first if (...) return. The early return stays — it just moves below the hooks.
  • Unescaped entities: Find-and-replace literal ' → &apos; and " → &quot; in JSX text nodes only (not in props or JS expressions).
  • Platform-conditional hooks (e.g. if (Platform.OS === 'web') return stub; return useNativeHook()): Restructure so the hook is always called, then conditionally return the result. Add eslint-disable if the branch is truly static.

Step 6: Verify

Re-run both typecheck and lint:

npx tsc --noEmit 2>&1
npm run lint 2>&1

If anything remains, go back to Step 3 with the smaller set. Repeat until output is clean.

Step 7: Confirm zero

The final run must show:

  • TypeCheck: no output (clean)
  • Lint: no ✖ N problems line, or explicitly 0 problems

When to suppress vs. fix

Suppress (eslint-disable with explanation) when:

  • The dependency is a Reanimated shared value — created by useSharedValue, these are stable refs that never change identity
  • The effect intentionally runs only once on mount and the "missing" deps (like router) are stable singletons
  • The code branches on Platform.OS — this is a build-time constant, the branch is always the same

Fix (add the dep or restructure) when:

  • The missing dep is a function defined in the component body — wrap it in useCallback
  • The missing dep is derived state that genuinely changes — add it to the array
  • The hook is called conditionally — restructure to call unconditionally

Always include a -- reason comment after eslint-disable-line so future readers (human or agent) understand the intent:

}, [visible]); // eslint-disable-line react-hooks/exhaustive-deps -- animated values are stable refs

Common anti-patterns to avoid

  • ❌ Fixing one file at a time, re-running lint after each fix
  • ❌ Adding // @ts-ignore or blanket eslint-disable without understanding the issue
  • ❌ Only fixing errors and leaving warnings "for later"
  • ❌ Adding every suggested dependency to a useEffect dep array without thinking (causes infinite loops with animated values)
  • ❌ Running typecheck and lint sequentially when they're independent

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.