lint-and-validate
Automatic quality control, linting, and static analysis procedures. Use after every code modification to ensure syntax correctness and project standards. Triggers onKeywords: lint, format, check, validate, types, static analysis.
Lint and Validate — Code Quality Auto-Checking Skill
Skill Overview
Lint and Validate is a mandatory code quality checking skill that automatically runs linting, formatting, and static analysis after every code change. It ensures the code meets project standards and has no syntax errors.
Use Cases
-
Pre-commit Checks
Automatically run ESLint, TypeScript type checks, or a Python linter beforegit committo prevent problematic code from entering the repository. -
CI/CD Quality Gates
Use it as a quality gate in continuous integration pipelines. Only code that passes all checks can be merged or deployed, ensuring overall repository quality. -
Unified Team Collaboration Standards
By standardizing lint rules and type checks, it ensures consistent coding style across team members and reduces the cost of format-related discussions during code reviews.
Core Capabilities
1. Multi-ecosystem Support
- Node.js / TypeScript: integrates ESLint auto-fixing, TypeScript type checking without compilation (
tsc --noEmit), andnpm auditsecurity auditing - Python: supports Ruff as a fast linter, Bandit security vulnerability scanning, and MyPy type checking
2. Quality Loop Workflow
Follow the loop of "write code → run audits → analyze reports → fix issues." Code containing lint or type errors is not allowed to be marked as completed.
3. Helper Scripts
scripts/lint_runner.py: runs various lint tools in a unified wayscripts/type_coverage.py: analyzes the project’s type coverage
Common Questions
How can I automatically run lint checks when committing code?
For Node.js projects, you can run npm run lint or npx eslint "path" --fix. For Python projects, use ruff check "path" --fix. It’s recommended to configure a git pre-commit hook or use Husky to trigger checks automatically before each commit.
How can I automatically fix code formatting issues after an ESLint error?
Use npx eslint "path" --fix to automatically fix most formatting issues reported by ESLint. For errors that can’t be auto-fixed, you’ll need to modify the code manually. For TypeScript projects, also run npx tsc --noEmit to ensure there are no type errors.
Which linter tool is recommended for Python projects?
Ruff is the currently recommended Python linter. Compared with traditional tools, it’s faster and more feature-rich. For security checks, use Bandit to scan common vulnerabilities; for type checking, use MyPy. If the project root has no configuration file, the skill will prompt you to create .eslintrc, tsconfig.json, or pyproject.toml.