skills/code-quality/SKILL.md
Code quality enforcement and review. Use when: reviewing code, refactoring for clean code, enforcing SOLID principles, setting up linting/formatting, improving readability, fixing code smells, applying design patterns, or conducting code audits.
npx skillsauth add Awais16/skills-vault code-qualityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
is, has, should, can prefixes — isLoading, hasPermissiongetUser, handleSubmit, validateEmail, parseResponseMAX_RETRY_COUNT, API_BASE_URLdata, info, item, result — be specific// Bad
function process(user: User) {
if (user) {
if (user.isActive) {
// deep nesting...
}
}
}
// Good
function process(user: User) {
if (!user) return;
if (!user.isActive) return;
// flat logic...
}
| Smell | Fix | |-------|-----| | Long function (>20 lines) | Extract into smaller functions | | Deep nesting (>3 levels) | Early returns, extract helpers | | Primitive obsession | Create value objects or branded types | | Feature envy | Move logic to the class/module that owns the data | | Shotgun surgery | Consolidate related changes into one module | | Duplicated logic (3+ times) | Extract shared utility | | Boolean parameters | Replace with two separate functions or enum | | Magic numbers/strings | Extract to named constants | | God object/module | Split by responsibility |
// .eslintrc.json — use @typescript-eslint for TS projects
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"prettier"
],
"rules": {
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/consistent-type-imports": "error",
"no-console": ["warn", { "allow": ["warn", "error"] }]
}
}
// .prettierrc
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2,
"arrowParens": "always",
"plugins": ["prettier-plugin-tailwindcss"]
}
| Pattern | Use When | |---------|----------| | Strategy | Multiple algorithms for the same task; swap at runtime | | Factory | Complex object creation; hide construction logic | | Observer | Decouple event producers from consumers | | Builder | Complex objects with many optional parameters | | Repository | Abstract data access from business logic | | Adapter | Bridge incompatible interfaces (e.g., third-party APIs) | | Facade | Simplify a complex subsystem behind a clean API |
When reviewing code, check:
any types or type assertions without justificationtools
TypeScript best practices, advanced type patterns, and strict typing. Use when: writing TypeScript code, creating type definitions, fixing type errors, designing type-safe APIs, using generics, creating utility types, or migrating from JavaScript to TypeScript.
development
Testing strategies and patterns for TypeScript/React/Next.js. Use when: writing unit tests, integration tests, e2e tests, setting up Vitest/Jest/Playwright, testing React components, testing API routes, mocking dependencies, or establishing testing patterns.
development
Web application security best practices and OWASP patterns. Use when: implementing authentication, authorization, input validation, sanitization, CSRF/XSS prevention, securing API endpoints, managing secrets, handling file uploads, configuring CORS, or auditing code for security vulnerabilities.
development
React best practices, component patterns, hooks, and state management. Use when: building React components, managing state with Zustand or Context API, writing custom hooks, optimizing renders, handling forms, implementing accessibility, or structuring component architecture.