Engineering
tdd-enforce avatar

tdd-enforce

Enforce Test-Driven Development (TDD) via pre-commit hooks and CI/CD coverage gates. Automates test execution and ensures compliance with minimum code coverage thresholds.

Introduction

The tdd-enforce skill provides a robust framework for maintaining software quality by integrating Test-Driven Development (TDD) practices directly into the development workflow. Designed for engineering teams and individual developers working in brownfield or greenfield environments, this skill ensures that code changes are verified against automated test suites and coverage requirements before they are committed or merged into the main codebase. By standardizing the enforcement process, it eliminates manual oversight and prevents the degradation of test quality over time.

  • Automatically detects project type (Node.js, Python, Java) to initialize appropriate hooks like Husky, pre-commit, or Maven/Gradle configurations.

  • Configures pre-commit hooks to run affected tests, preventing the commit of code that fails local tests or lacks corresponding test files.

  • Establishes CI/CD coverage gates that fail PRs or builds if they fall below defined thresholds (e.g., Google standard of 80% line coverage).

  • Supports customizable enforcement levels including audit-only mode for gradual TDD adoption, standard warnings, and strict blocking modes for high-integrity projects.

  • Provides granular threshold definitions for line, branch, and function coverage, as well as critical path coverage tracking (e.g., authentication, payments).

  • Automates PR feedback by posting coverage reports directly to code review platforms using GitHub Actions or similar CI providers.

  • Use this skill when initiating a project migration to TDD or when seeking to curb the accumulation of technical debt in existing codebases.

  • Typical inputs include project file structures and preferred threshold levels; output consists of configured local hooks, CI workflow YAML files, and project configuration updates.

  • The skill follows industry standards such as ISTQB for test automation strategy and references established patterns like the Google Testing Blog's coverage guidelines.

  • Users should define critical paths to ensure 100% coverage on sensitive modules, while maintaining flexible thresholds for less volatile components.

  • Ideal for teams practicing continuous integration who require a 'gatekeeper' mechanism to maintain high-quality codebases and ensure that test-first development remains a non-negotiable standard.

Repository Stats

Stars
124
Forks
18
Open Issues
1
Language
TypeScript
Default Branch
main
Sync Status
Idle
Last Synced
Apr 29, 2026, 02:11 PM
View on GitHub