Skip to main content
rule CX Codex

quality-gates — Claude Code rule: what it checks before a commit

quality-gates — a Claude rule that makes the agent lint and typecheck before a commit, then sweep the staged diff for debug lines and hardcoded keys.

MIT ★ 2,966 updated 2026-09-29

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/quality-gates.mdc
Open on GitHub

What quality-gates does

The rule lays out a pre-commit routine for the agent: run the linter and the type checker, and run tests for the paths you touched. Debug output such as console.log, debugger or a stray print has no place in code headed for production. Secrets and API keys belong in environment variables rather than in source files.

It also lists what to inspect in the staged diff: debug statements, TODO and FIXME notes with no ticket number, hardcoded strings like api_key = "...", and test-only code left behind. Read it as a checklist for the diff. The agent runs the tools.

Because the front matter carries alwaysApply: true, the rule loads in every session, not just at commit time, so expect reminders about leftover debug lines during ordinary refactoring too. The file sits at .claude/rules/quality-gates.md.

What it helps with

  • run lint and typecheck before committing
  • catch leftover console.log and debugger lines in the staged diff
  • move a hardcoded API key into an environment variable
  • link every TODO to a ticket instead of leaving it bare
  • strip test-only stubs that slipped into the commit

Example prompts for the agent

  • Run the linter and the type checker on the touched files before you commit.
  • Check the staged diff for console.log and for TODO notes with no ticket.
  • Find hardcoded keys in the source and move them into environment variables.

How to install quality-gates

Manually: put the files in place

.cursor/rules/quality-gates.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about quality-gates

How to install quality-gates in Claude Code?

Add the marketplace first with /plugin marketplace add rohitg00/pro-workflow, then install the plugin with /plugin install pro-workflow@pro-workflow. The rule lands at .claude/rules/quality-gates.md.

What does quality-gates do?

It asks the agent to lint and typecheck before a commit and to test the code paths it changed. It also screens the staged diff for debug statements, ticketless TODO notes and hardcoded keys.

When does this rule apply?

The front matter sets alwaysApply: true, so it is active in every session rather than only at commit time. Reminders about debug lines will show up during ordinary edits as well.

Source text

quality-gates.mdc · MIT
---
description: Enforce quality checks before commits - lint, typecheck, and test affected code
alwaysApply: true
---

Run lint and typecheck before every commit. Test affected code paths.

No `console.log` or `debugger` statements in production code.

No hardcoded secrets, API keys, or credentials in source files. Use environment variables.

Before committing, scan staged changes for:
- Debug statements (console.log, print, debugger)
- TODO/FIXME without ticket references
- Hardcoded secrets matching patterns like `api_key = "..."`
- Leftover test-only code

© Rohit Ghumare · MIT · rohitg00/pro-workflow

Similar IDE rules

All IDE rules for Code review and refactoring →

From the same set83

The whole set →
no-debug-statements The no-debug-statements rule flags debugging calls for removal before a commit in JavaScript, TypeScript, Python, Go, and Rust files. Use it during a pre-commit review. CX Codex +1 ★ 2,966repo stars atomic-commits Enforces Git best practices: atomic commits in Conventional Commits format, mandatory feature branches, and selective file staging. CX Codex +1 ★ 2,966repo stars cost-tracker cost-tracker is a Claude Code command that estimates current-session spend, identifies its main cost drivers, and suggests optimizations. Compare the estimate with a task budget. CX Codex +1 ★ 2,966repo stars self-correction self-correction turns a correction into a one-line [LEARN] rule with a category, and saves it only once you approve the wording. CX Codex +1 ★ 2,966repo stars mcp-audit Audits active MCP servers, estimates token overhead from tool schemas, and flags unused integrations to disable. CX Codex +1 ★ 2,966repo stars auto-setup auto-setup detects a project’s stack and configures quality gates, permission rules, and hooks. Useful when bringing a new codebase into Claude Code. CX Codex +1 ★ 2,966repo stars compact-guard compact-guard is a Claude Code command that saves working state before context compaction and restores critical data afterward. Run it before manual compaction or when auto-compaction warnings appear. CX Codex +1 ★ 2,966repo stars wrap-up wrap-up audits git diffs, runs test suites, records lessons learned, and prepares context before closing a Claude Code session. CX Codex +1 ★ 2,966repo stars

More in the catalog

Project sponsors

Companies that keep this analytics open