Help us improve
Share bugs, ideas, or general feedback.
Share bugs, ideas, or general feedback.
Share bugs, ideas, or general feedback.
By xiaolai
Enforce per-file pure LOC limits with automated optimization strategies — counts, flags violations, and provides opus-powered extraction plans
npx claudepluginhub xiaolai/claude-plugin-marketplace --plugin loc-guardianUse this agent to count lines of code and produce LOC statistics reports with file size limit enforcement. <example> Context: User wants to see code metrics for their project. user: "/loc-guardian:scan" assistant: "I'll use the counter agent to count lines of code." <commentary> Standard scan request — count all languages in the current directory. </commentary> </example> <example> Context: User wants LOC for a specific language. user: "/loc-guardian:scan python" assistant: "I'll use the counter agent to count Python lines of code." <commentary> Language-filtered scan — only count Python files. </commentary> </example>
Use this agent to analyze over-limit files and provide concrete optimization strategies. This agent is called by the scan command when files exceed the pure LOC limit. It reads the actual file contents and suggests specific extractions. <example> Context: counter found files over the LOC limit. assistant: "I'll use the optimizer agent to analyze the over-limit files and suggest optimizations." <commentary> The counter flagged violations. The optimizer reads each file and provides line-level extraction suggestions. </commentary> </example> <example> Context: counter's loc-data block contains only WARN lines (no OVER lines) — files are in the 80%+ warning zone but none have exceeded the limit. assistant: "No files are over the limit, but some are in the warning zone. I'll run the lighter warning-zone analysis — reading each WARN file and noting one obvious extraction candidate per file to prevent it from going over." <commentary> No OVER files — optimizer runs lighter WARN-only pass per the documented workflow. Per Step 3, each warning-zone file gets a single-line suggestion with one extraction candidate, rather than the full extraction + optimization report reserved for over-limit files. </commentary> </example>
Uses power tools
Uses Bash, Write, or Edit tools
Share bugs, ideas, or general feedback.
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge.
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge.
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
Monitor code complexity and maintain code quality
Dead code analysis, duplication detection, complexity hotspots, and auto-fix for JavaScript/TypeScript using fallow
Structural codebase indexing for efficient navigation. Reduces token consumption by 60-80% through targeted line-range reads instead of full file scans.
Find and remove dead code across the codebase
Live codebase visualization and structural quality gate — 14 health dimensions graded A-F, dependency analysis, and architecture governance via MCP
Zero-tolerance code pedantry — naming precision, casing law, structural symmetry, import discipline, and the obsessive details that separate clean code from correct code
Natural-Language Programming Manager — scan, lint, and write NL artifacts with Claude-native quality scoring
A 260-token system prompt that overrides three structural presumptions every RLHF-trained LLM inherits from training: that you want confirmation, that old scarcity still applies, that best practices are ceilings.
English language coach for non-native speakers — auto-corrects prompts, translates non-English, refines with :: prefix, tracks improvement over time
Initialize a multi-agent workspace with shared configuration for Claude Code, Codex CLI, and Gemini CLI
Documentation quality and freshness enforcer — detect staleness, check accuracy, measure coverage, and auto-generate docs
Enforce per-file pure LOC limits with automated optimization strategies.
| Command | Description |
|---|---|
/loc-guardian:init | Configure LOC limit and extraction rules for your project |
/loc-guardian:scan | Count LOC, check limits, get optimization strategies |
/loc-guardian:scan python | Count only Python files |
/loc-guardian:scan src/ | Count only files under src/ |
Part of the xiaolai plugin marketplace.
Install tokei:
brew install tokei
Add the marketplace (once):
/plugin marketplace add xiaolai/claude-plugin-marketplace
Then install:
/plugin install loc-guardian@xiaolai
Install fails with "Plugin not found in marketplace 'xiaolai'"? Your local marketplace clone is stale. Run
claude plugin marketplace update xiaolaiand retry —plugin installdoes not auto-refresh.
| Scope | Command | Effect |
|---|---|---|
| User (default) | /plugin install loc-guardian@xiaolai | Available in all your projects |
| Project | /plugin install loc-guardian@xiaolai --scope project | Shared with team via .claude/settings.json |
| Local | /plugin install loc-guardian@xiaolai --scope local | Only you, only this repo |
Run /loc-guardian:init in your project to set your LOC limit and extraction rules
/loc-guardian:init creates .claude/loc-guardian.local.md in your project:
---
max_pure_loc: 350
---
## Extraction Rules
- [What to extract] → `[target file pattern]`
- [What to extract] → `[target file pattern]`
The extraction rules are yours — tailored to your language, framework, and conventions.
ISC