agentleFS
Baba01hacker666Baba01hacker666/dummyskills/skills/lint-and-typecheck/SKILL.md

lint-and-typecheck

Skill0 starsChanged 2 months agoMITView on GitHub

Guides agents through discovering, executing, and resolving linter and static type-checker errors without suppressing warnings with ignore comments.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 5 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

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

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

    Ensure code adheres to codebase static typing and style standards before committing.

    line 11
  2. Distinctive:

    Use this skill when:

    line 14
  3. Very specific:

    Do not use to run functional or unit tests.

    line 20
  4. Very specific:

    Do not use to review architectural diffs for security risks.

    line 21
  5. Very specific:

    Do not use to refactor working code when no lint errors exist.

    line 22
  6. Distinctive:

    If no target files are specified: inspect git status --porcelain to identify changed files.

    line 29
  7. Very specific:

    If tool configuration is unknown: inspect manifests (package.json, pyproject.toml, go.mod, Cargo.toml) to identify configured linter and …

    line 30
  8. Very specific:

    Strict Prohibition: Never resolve a lint or type error by adding @ts-ignore, @ts-expect-error, eslint-disable, # noqa, # type: ignore, or …

    line 31
  9. Distinctive:

    Follow these numbered actions:

    line 34
  10. Very specific:

    Run type-checker (e.g., npx tsc --noEmit or mypy <files>).

    line 41
  11. Very specific:

    Run linter command (e.g., npm run lint or ruff check .).

    line 44
  12. Very specific:

    If safe auto-fix is available (e.g., eslint --fix or ruff check --fix): run auto-fix for formatting/whitespace, then manually fix remaining …

    line 54
  13. Very specific:

    If a type error is caused by a missing library type definition: check if @types/<pkg> is required in devDependencies.

    line 55
  14. Distinctive:

    If an import is unused: delete the unused import statement.

    line 56
  15. Distinctive:

    Stop and ask the user when:

    line 92

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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 and Type-Check

Guides agents through discovering, executing, and resolving linter and static type-checker errors. Strictly forbids suppressing issues with @ts-ignore, eslint-disable, # noqa, or # type: ignore.

1. Purpose

Ensure code adheres to codebase static typing and style standards before committing. "Type-checking" verifies type safety without runtime execution (e.g. tsc --noEmit, mypy). "Linting" identifies stylistic defects, unused imports, syntax hazards, and antipatterns (e.g. eslint, ruff, golangci-lint).

2. When to Use

Use this skill when:

  • Finishing a code change before opening a pull request or declaring task completion.
  • Investigating pre-commit hook failures or CI lint pipeline failures.
  • User requests: "Lint the project", "Run type checks", or "Fix lint errors".

3. When Not to Use

  • Do not use to run functional or unit tests; use test-runner-debugger.
  • Do not use to review architectural diffs for security risks; use diff-reviewer.
  • Do not use to refactor working code when no lint errors exist; use small-refactor.

4. Required Inputs

  • workspace_root: Directory containing the project (default: current working directory).
  • target_files: Optional specific files modified (e.g. src/auth.ts).

5. Missing-Input Behavior

  1. If no target files are specified: inspect git status --porcelain to identify changed files.
  2. If tool configuration is unknown: inspect manifests (package.json, pyproject.toml, go.mod, Cargo.toml) to identify configured linter and type-checker commands.
  3. Strict Prohibition: Never resolve a lint or type error by adding @ts-ignore, @ts-expect-error, eslint-disable, # noqa, # type: ignore, or any unless explicitly instructed by the user.

6. Procedure

Follow these numbered actions:

  1. Action 1: Identify Configured Tools
    • Node/TypeScript: Check package.json scripts (lint, typecheck, check), tsconfig.json, .eslintrc*, biome.json.
    • Python: Check ruff check, flake8, mypy, pyright, black --check.
    • Go: Check golangci-lint run, go vet ./....
    • Rust: Check cargo clippy -- -D warnings.
  2. Action 2: Execute Type-Check First
    • Run type-checker (e.g., npx tsc --noEmit or mypy <files>).
    • Fix type errors before linting, as types often eliminate underlying logic hazards.
  3. Action 3: Execute Linter
    • Run linter command (e.g., npm run lint or ruff check .).
    • Parse output: extract file path, line number, column, rule name, and error description.
  4. Action 4: Apply Root-Cause Fixes
    • Address the root cause (e.g., add missing return type, remove unused variable, handle null case).
  5. Action 5: Re-Verify Clean Exit
    • Re-run type-checker and linter until exit code is 0 with zero errors and zero warnings.
  6. Action 6: Emit Summary Report
    • Format per Section 8.

7. Decision Rules

  • If safe auto-fix is available (e.g., eslint --fix or ruff check --fix): run auto-fix for formatting/whitespace, then manually fix remaining logical errors.
  • If a type error is caused by a missing library type definition: check if @types/<pkg> is required in devDependencies.
  • If an import is unused: delete the unused import statement; do not comment it out.

8. Output Format

Emit the report using this template:

### Lint & Type-Check Verification

- **Type Checker**: `[Command, e.g., npx tsc --noEmit]` -> [PASS | FAIL]
- **Linter**: `[Command, e.g., npm run lint]` -> [PASS | FAIL]
- **Files Checked**: [Count or file list]
- **Issues Resolved**: [Count]

#### Resolved Issues
| File | Line | Rule / Error Code | Root Cause & Resolution |
| :--- | :--- | :--- | :--- |
| `[file]` | `[line]` | `[e.g., TS2345]` | [Fixed type mismatch by casting or guard] |
| `[file]` | `[line]` | `[e.g., no-unused-vars]` | [Removed unused import variable] |

#### Final Verification Status
- Clean exit code `0` confirmed across all tools.

9. Verification Checklist

  • Type-checker exited with code 0.
  • Linter exited with code 0.
  • Zero @ts-ignore or # noqa suppression comments were introduced.
  • No unrelated files were reformatted.

10. Common Failures and Recovery

Failure SymptomCauseRecovery Action
tsc passes but eslint failsSeparate rule setsRun both commands sequentially; never assume one covers the other.
Agent adds @ts-ignoreLazy shortcutReject suppression; inspect function definition and provide proper types.
Global reformat modifies 100 filesRunning linter on entire monorepoPass specific file paths to linter (npx eslint src/auth.ts).

11. Stop or Escalation Conditions

Stop and ask the user when:

  • Resolving a type error requires changing a public library API signature shared across external packages.

12. Examples

Example 1: Successful Execution

Input:

Target file: src/user.ts
Error: TS2322: Type 'string | null' is not assignable to type 'string'.
Line: 18: const username: string = user.getName();

Output:

### Lint & Type-Check Verification

- **Type Checker**: `npx tsc --noEmit` -> PASS
- **Linter**: `npm run lint` -> PASS
- **Files Checked**: 1 (`src/user.ts`)
- **Issues Resolved**: 1

#### Resolved Issues
| File | Line | Rule / Error Code | Root Cause & Resolution |
| :--- | :--- | :--- | :--- |
| `src/user.ts` | 18 | `TS2322` | `getName()` returns `string \| null`. Added nullish coalescing default: `const username: string = user.getName() ?? 'Guest';`. |

#### Final Verification Status
- Clean exit code `0` confirmed across all tools.

Example 2: Ambiguous or Missing Input

Input:

Lint the code.
Context: No manifest in directory.

Output:

### Lint & Type-Check: Halted - No Configuration Found

- **Status**: Halted

No linter or type-checker configuration was detected in the workspace (no `package.json`, `tsconfig.json`, `pyproject.toml`, or `.golangci.yml`). 
Please specify:
1. The programming language and tools used.
2. The specific command you use to lint or check types.

Example 3: Expected Final Output

Output:

### Lint & Type-Check Verification

- **Type Checker**: `mypy src/` -> PASS
- **Linter**: `ruff check src/` -> PASS
- **Files Checked**: 3
- **Issues Resolved**: 2

#### Resolved Issues
| File | Line | Rule / Error Code | Root Cause & Resolution |
| :--- | :--- | :--- | :--- |
| `src/api.py` | 12 | `F401` | Removed unused import `import sys`. |
| `src/client.py` | 44 | `arg-type` | Corrected timeout parameter type from `float` to `Optional[float]`. |

#### Final Verification Status
- Clean exit code `0` confirmed across all tools.

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.