Ccguard banner
pomterre pomterre

Ccguard

Development community intermediate

Description

[](https://www.npmjs.com/package/ccguard) [](LICENSE)

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

🚨 CCGuard

[](https://www.npmjs.com/package/ccguard) [](LICENSE)

**Automated enforcement of net-negative LOC, complexity constraints, and quality standards for Claude code**

📌 **New in v0.1.4**: The [Snapshot Strategy](#snapshot-strategy-recommended-as-of-v014) is now the recommended approach for more robust session-wide LOC tracking.

🔒 **New**: File locking feature to protect critical files from any modifications.


🎯 Overview

**CCGuard** ensures your codebase stays lean by blocking changes that exceed your configured line count threshold during Claude coding sessions. By default, it enforces net-negative changes (no increase allowed), but can be configured with a positive lines buffer for flexibility. It encourages simplicity, thoughtful refactoring, and a cleaner, maintainable codebase.

CCGuard blocking a file edit that would increase total lines of code


CCGuard preventing code bloat during refactoring operations


✅ Key Benefits

  • Flexible Enforcement: Strict net-negative by default, but configurable with positive line buffer
  • Simplicity Focus: Keeps your code concise by limiting unnecessary additions
  • Promotes Refactoring: Encourages rethinking and optimizing existing code
  • Progress Insights: Provides real-time session statistics
  • Easy Control: Simple toggling for flexible enforcement
  • File Protection: Lock critical files to prevent accidental modifications

🛠️ Installation

Ensure you have:

  • Node.js 18+
  • Claude Code

Install CCGuard CLI globally:

npm install -g ccguard

🚀 Quick Start

1️⃣ Configure Claude Code Hooks

CCGuard requires two hooks to be configured in Claude Code:

A. PreToolUse Hook (for LOC enforcement)

...