tdd-enforce

Configure pre-commit hooks and CI coverage gates to enforce test-driven development.

175|26|Updated Aug 14, 2025
One-click install
npx skills add https://github.com/jmagly/ai-writing-guide --skill tdd-enforce-jmagly
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-enforce
Source: https://github.com/jmagly/ai-writing-guide/tree/main/.factory/skills/tdd-enforce
Command: npx skills add https://github.com/jmagly/ai-writing-guide --skill tdd-enforce-jmagly

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires mutation-test, flaky-detect, and includes references (resource) components.

What problem does it solve?

This Skill eliminates untested code by automatically configuring pre-commit hooks and CI coverage gates to enforce test-driven development practices.

Quick Start

When you say "set up TDD enforcement", this Skill installs pre-commit hooks and sets up coverage thresholds to block commits without adequate test coverage.

Example Output

"TDD Enforcement Configured

Pre-commit Hooks:

  • [x] Husky installed and initialized
  • [x] Pre-commit hook: Run affected tests
  • [x] Pre-commit hook: Check test presence for new files

Coverage Gates:

  • Line coverage threshold: 80%
  • Branch coverage threshold: 75%
  • Critical path coverage: 100%

CI Integration:

  • [x] GitHub Actions workflow created
  • [x] Coverage gate: Fail PR if coverage < 80%

Next Steps:

  1. Run npm test to verify baseline coverage
  2. Commit and push to test CI gates
  3. Review coverage report on first PR"

Frequently Asked Questions about tdd-enforce

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce test-driven development in my JavaScript, Python, or Java project?

Test-driven development enforcement automatically blocks commits and merges lacking adequate test coverage through pre-commit hooks and CI gates. This Skill configures project-type detection, installs hooks to validate test presence for changed files, and sets coverage thresholds (e.g., 80% line coverage) to prevent untested code from reaching production.

Can I set up pre-commit hooks to require tests before committing?

Yes. Pre-commit hooks validate that new files have accompanying tests and run affected tests before allowing commits. This Skill installs and configures Husky-based hooks that halt commits violating test requirements, ensuring test-first practices at the developer workflow stage.

What coverage thresholds should I enforce in CI?

Coverage gates typically enforce line coverage ≥80%, branch coverage ≥75%, and 100% coverage on critical paths. This Skill applies these defaults and integrates with GitHub Actions workflows to fail pull requests that drop below your threshold, blocking merges until coverage is restored.

Does TDD enforcement work with existing brownfield projects?

Yes. This Skill applies to both new and brownfield codebases in JavaScript, Python, and Java. It configures project-type detection to identify your tech stack, then installs hooks and CI gates without requiring a fresh start.

How does this Skill prevent flaky tests from blocking commits?

This Skill integrates the flaky-detect dependency to identify unreliable tests during pre-commit validation. By filtering out flaky tests, it ensures genuine test failures block commits while transient failures do not disrupt the development workflow.

Can mutation testing validate that my tests actually catch bugs?

Yes. This Skill depends on mutation-test to verify test quality by introducing code mutations and checking whether tests detect them. Combined with coverage gates, mutation testing ensures tests are not just present but effective at catching real defects.