with one click
code-quality
// Automated code quality checks including linting, formatting, and type checking
// Automated code quality checks including linting, formatting, and type checking
| name | code-quality |
| description | Automated code quality checks including linting, formatting, and type checking |
| category | quality |
| version | 1.0.0 |
| platforms | {"claude":{"model":"sonnet"},"codex":{"model":"gpt-5.5"}} |
Performs comprehensive code quality checks including linting, formatting, and type checking across multiple languages.
Automate code quality validation to ensure:
@agent Use the code-quality skill to check src/
# JavaScript/TypeScript project
npx eslint src/
npx prettier --check src/
npx tsc --noEmit
# Python project
pylint src/
black --check src/
mypy src/
ESLint Config (.eslintrc.json):
{
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"rules": {
"no-console": "warn",
"no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "warn"
}
}
Prettier Config (.prettierrc):
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
}
TypeScript Config (tsconfig.json):
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"esModuleInterop": true
}
}
Pylint Config (.pylintrc):
[MASTER]
max-line-length=100
[MESSAGES CONTROL]
disable=C0111 # Missing docstring
[BASIC]
good-names=i,j,k,x,y,z,id
Black Config (pyproject.toml):
[tool.black]
line-length = 100
target-version = ['py38', 'py39', 'py310']
Mypy Config (mypy.ini):
[mypy]
python_version = 3.10
warn_return_any = True
warn_unused_configs = True
disallow_untyped_defs = True
async function checkJavaScriptQuality(directory: string) {
const results = {
eslint: { passed: false, errors: [], warnings: [] },
prettier: { passed: false, files: [] },
typescript: { passed: false, errors: [] },
};
// Run ESLint
const eslintResult = await runCommand(`npx eslint ${directory}`);
results.eslint.passed = eslintResult.exitCode === 0;
results.eslint.errors = parseEslintOutput(eslintResult.stdout);
// Run Prettier check
const prettierResult = await runCommand(`npx prettier --check ${directory}`);
results.prettier.passed = prettierResult.exitCode === 0;
results.prettier.files = parsePrettierOutput(prettierResult.stdout);
// Run TypeScript check
const tscResult = await runCommand(`npx tsc --noEmit`);
results.typescript.passed = tscResult.exitCode === 0;
results.typescript.errors = parseTscOutput(tscResult.stdout);
return results;
}
async def check_python_quality(directory: str):
results = {
'pylint': {'passed': False, 'score': 0, 'errors': []},
'black': {'passed': False, 'files': []},
'mypy': {'passed': False, 'errors': []}
}
# Run Pylint
pylint_result = await run_command(f'pylint {directory}')
results['pylint']['passed'] = pylint_result.exit_code in [0, 4, 8, 16]
results['pylint']['score'] = parse_pylint_score(pylint_result.stdout)
results['pylint']['errors'] = parse_pylint_output(pylint_result.stdout)
# Run Black check
black_result = await run_command(f'black --check {directory}')
results['black']['passed'] = black_result.exit_code == 0
results['black']['files'] = parse_black_output(black_result.stdout)
# Run Mypy
mypy_result = await run_command(f'mypy {directory}')
results['mypy']['passed'] = mypy_result.exit_code == 0
results['mypy']['errors'] = parse_mypy_output(mypy_result.stdout)
return results
ā
Code Quality Check: PASSED
JavaScript/TypeScript:
ā
ESLint: No issues found
ā
Prettier: All files formatted correctly
ā
TypeScript: No type errors
Python:
ā
Pylint: Score 9.5/10
ā
Black: All files formatted
ā
Mypy: No type errors
Summary: All quality checks passed!
ā Code Quality Check: FAILED
JavaScript/TypeScript:
ā ESLint: 3 errors, 5 warnings
- src/auth/login.ts:42 - 'user' is assigned a value but never used
- src/api/routes.ts:15 - Unexpected console statement
ā ļø Prettier: 2 files need formatting
- src/utils/helpers.ts
- src/components/Button.tsx
ā
TypeScript: No type errors
Python:
ā Pylint: Score 7.2/10
- src/auth.py:23 - Line too long (105/100)
- src/db.py:45 - Missing docstring
ā Black: 1 file needs formatting
- src/models.py
ā
Mypy: No type errors
Summary: Fix 3 ESLint errors, 2 formatting issues, improve Pylint score
Before completing implementation:
1. Write code
2. Run code-quality skill
3. Fix any issues found
4. Re-run until all checks pass
5. Mark task complete
During code review:
1. Run code-quality skill on changed files
2. If quality checks fail, request fixes
3. If quality checks pass, proceed with functional review
# .git/hooks/pre-commit
#!/bin/bash
echo "Running code quality checks..."
# Run code quality skill
npx eslint src/
npx prettier --check src/
npx tsc --noEmit
if [ $? -ne 0 ]; then
echo "ā Code quality checks failed. Please fix issues before committing."
exit 1
fi
echo "ā
Code quality checks passed!"
npx eslint src/ --fix
npx prettier --write src/
black src/
@builder Implement feature and auto-fix code quality issues
Agent will:
name: Code Quality
on: [push, pull_request]
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npx eslint src/
- name: Run Prettier
run: npx prettier --check src/
- name: Run TypeScript
run: npx tsc --noEmit
- name: Upload results
if: failure()
uses: actions/upload-artifact@v3
with:
name: quality-report
path: quality-report.json
{
"devDependencies": {
"eslint": "^8.50.0",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
}
}
pip install pylint black mypy
ESLint:
{
"rules": {
"max-len": ["error", { "code": 100 }],
"no-var": "error",
"prefer-const": "error"
}
}
Pylint:
[MESSAGES CONTROL]
enable=C0103,C0114,C0115,C0116
ESLint (.eslintignore):
dist/
build/
node_modules/
Prettier (.prettierignore):
dist/
build/
*.min.js
Black (.gitignore or explicit):
*.pyc
__pycache__/
Only check changed files:
# Git changed files
git diff --name-only --diff-filter=ACMR | grep '\.ts$' | xargs eslint
# Staged files only
git diff --cached --name-only --diff-filter=ACMR | grep '\.ts$' | xargs eslint
# Run checks in parallel
npx eslint src/ & \
npx prettier --check src/ & \
npx tsc --noEmit & \
wait
if [ $? -ne 0 ]; then
echo "Some checks failed"
exit 1
fi
Problem: ESLint can't find parser or plugin
Solution:
npm install --save-dev @typescript-eslint/eslint-plugin @typescript-eslint/parser
Problem: Prettier and ESLint rules conflict
Solution: Use eslint-config-prettier
npm install --save-dev eslint-config-prettier
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier" // Disable ESLint rules that conflict with Prettier
]
}
Problem: Type definitions missing
Solution:
npm install --save-dev @types/node @types/react
Problem: Pylint score below threshold
Solution:
.pylintrcā Run code quality checks before committing ā Auto-fix formatting issues ā Integrate with CI/CD ā Fail builds on quality issues ā Keep rules consistent across team ā Document any disabled rules
ā Disable all rules to pass checks ā Commit without running quality checks ā Ignore linting warnings (they become errors) ā Use different formatters in same project ā Skip quality checks "to move faster"
For more information, see skills README or main documentation