pre-commit-check

Pre-commit validation checklist before staging and committing code. Use BEFORE every git commit to ensure code quality, tests pass, and documentation is updated. Triggers on "commit", "stage changes", "ready to commit", or when completing a feature or fix.

⭐5stars🔀1forks📁View on GitHub🕐Updated Jan 11, 2026⬇️1downloads

When & Why to Use This Skill

The pre-commit-check skill is a comprehensive validation framework designed to automate code quality assurance before staging and committing. It orchestrates build verification, test execution, and linting while integrating advanced AI-driven code reviews, security audits, and architectural assessments. By ensuring documentation and memory logs are updated alongside code changes, it maintains high project standards and prevents technical debt through a standardized, rigorous workflow.

Use Cases

  • Automated Quality Gate: Execute build scripts, test suites, and linters automatically to ensure only stable and error-free code reaches the staging area.
  • Multi-Layered AI Security Audits: Launch specialized sub-agents to perform deep-dive reviews for XSS, API vulnerabilities, and OWASP compliance during the development phase.
  • Project Context & Documentation Sync: Maintain up-to-date decision logs and architectural memory by integrating with ConPort and Serena during the commit process.
  • Architectural Integrity Checks: Use AI-driven reviews to ensure new changes adhere to project-specific patterns, conventions, and maintainability standards.
  • Standardized Git Workflow: Enforce consistent commit message formatting and self-review checklists to improve team collaboration and repository history clarity.
namepre-commit-check
descriptionPre-commit validation checklist before staging and committing code. Use BEFORE every git commit to ensure code quality, tests pass, and documentation is updated. Triggers on "commit", "stage changes", "ready to commit", or when completing a feature or fix.

Pre-Commit Checklist

Run through this checklist before every commit.

Required Checks

1. Build Verification

npm run build
  • Build completes without errors
  • No new warnings introduced

2. Test Suite

npm test
  • All tests pass
  • No skipped tests that should run
  • Coverage not decreased (if tracked)

3. Linting (if configured)

npm run lint
  • No linting errors
  • No new warnings

Context Updates

4. ConPort Documentation

  • Log any decisions made during this work (mcp__conport__log_decision)
  • Update progress entries to DONE (mcp__conport__update_progress)
  • Log any new patterns discovered (mcp__conport__log_system_pattern)
  • Link related items (mcp__conport__link_conport_items)

5. Serena Memory

  • Document architectural learnings if applicable (write_memory)

Code Review

6. Self-Review

  • Changes match the task requirements
  • No debug code left behind (console.log, debugger statements)
  • No commented-out code without explanation
  • No hardcoded values that should be configurable

7. Automated Reviews (for significant changes)

Launch these sub-agents in parallel for comprehensive review:

Code Quality Review:

Task(subagent_type="pr-review-toolkit:code-reviewer", prompt="Review unstaged changes for code quality, bugs, and adherence to project conventions")

Security Review (when changes involve):

  • User input handling, file uploads, URL processing
  • API keys, authentication, authorization
  • Data sanitization or validation
  • External API calls or network requests
Task(subagent_type="security-pro:security-auditor", prompt="Review changes for security vulnerabilities, OWASP compliance, and secure coding practices")

Frontend Security (for UI changes):

Task(subagent_type="frontend-mobile-security:frontend-security-coder", prompt="Review frontend changes for XSS prevention, output sanitization, and client-side security")

Backend Security (for API/service changes):

Task(subagent_type="backend-api-security:backend-security-coder", prompt="Review backend changes for input validation, authentication security, and API security")

Architecture Review (for structural changes):

Task(subagent_type="code-review-ai:architect-review", prompt="Review changes for architectural integrity, patterns adherence, and maintainability")
  • Address all high-priority findings before committing

Commit

8. Stage and Commit

git add -A
git status  # Review staged files
git commit -m "type: descriptive message"

Commit message format:

  • feat: - New feature
  • fix: - Bug fix
  • refactor: - Code refactoring
  • docs: - Documentation only
  • test: - Adding/updating tests
  • chore: - Maintenance tasks