quality-check

yuush10's avatarfrom yuush10

Run quality checks on code changes. Use after implementation, before commits, or when the user mentions review, check, validate, or lint.

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 9, 2026⬇️2downloads

When & Why to Use This Skill

This Claude skill automates comprehensive code quality validation by performing TypeScript compilation, running Jest unit tests, and detecting anti-patterns. It ensures code stability and adherence to best practices during the development lifecycle, specifically optimized for projects requiring rigorous build verification and Google Apps Script compatibility.

Use Cases

  • Pre-commit Validation: Automatically run a full suite of checks including linting, testing, and building before pushing code to prevent broken builds and maintain repository integrity.
  • Automated Code Review: Identify common anti-patterns, unused variables, and logic errors early in the development process to reduce manual review overhead.
  • Environment-Specific Compliance: Verify specialized requirements such as Google Apps Script (GAS) export declarations and IIFE patterns to ensure seamless deployment to target platforms.
  • Regression Testing: Quickly execute Jest test suites after code modifications to ensure new features or bug fixes haven't introduced breaking changes to existing functionality.
namequality-check
descriptionRun quality checks on code changes. Use after implementation, before commits, or when the user mentions review, check, validate, or lint.
allowed-toolsBash, Read, Grep, Glob

Quality Check

Performs comprehensive quality validation for the Auto Invoice Collector project.

Workflow

Run these checks before any commit:

  1. TypeScript compilation
  2. Jest tests
  3. Anti-pattern detection
  4. Bundle build verification
  5. GAS export validation

Step 1: TypeScript Compilation

npx tsc --noEmit

If errors found, list each error with file path and line number.

Step 2: Run Jest Tests

npm test

Report:

  • Total tests run
  • Tests passed/failed
  • Coverage summary (if available)

Step 3: Anti-Pattern Detection

Check for these anti-patterns in modified files:

GAS-Specific:

  • IIFE patterns that hide functions from GAS
  • Missing try-catch around API calls (Gmail, Drive, UrlFetchApp)
  • Hardcoded secrets (API keys, credentials)
  • console.log in production code (use Logger.log)

General:

  • Unused imports or variables
  • _unusedVar renames (delete instead)
  • Progress comments (// fixed, // removed)
  • Empty catch blocks

Step 4: Bundle Build

npm run build

Verify dist/bundle.js is generated without errors.

Step 5: GAS Export Validation

Verify all globalThis exports have footer declarations (macOS-compatible):

# Extract exports and footer functions, compare
EXPORTS=$(find src -name "*.ts" -exec grep -h '(globalThis as any)\.' {} + 2>/dev/null | \
  sed -n 's/.*(\globalThis as any)\.\([a-zA-Z_][a-zA-Z0-9_]*\) =.*/\1/p' | sort -u)
FOOTER=$(grep -E '^function [a-zA-Z_][a-zA-Z0-9_]*\(' rollup.config.mjs | \
  sed -n 's/^function \([a-zA-Z_][a-zA-Z0-9_]*\)(.*/\1/p' | sort -u)

# Find missing (in exports but not in footer)
MISSING=$(comm -23 <(echo "$EXPORTS") <(echo "$FOOTER"))

if [ -n "$MISSING" ]; then
  echo "✗ Missing from rollup footer:"
  echo "$MISSING"
  exit 1
fi
echo "✓ GAS exports synced"

If missing functions found, see /gas-export-check for fix suggestions.

Results Summary

Report format:

  • Compilation: PASS/FAIL
  • Tests: X/Y passed
  • Anti-patterns: N violations found
  • Build: PASS/FAIL

If all pass: Ready for commit. If any fail: List specific issues to fix.

Iteration Loop

If issues found:

  1. Fix the issue
  2. Re-run the specific failing check
  3. Continue until all checks pass