dotnet-cloc

Generates line-count, language-mix, and branch-diff statistics for .NET repositories using cloc.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-cloc-zhenpenglai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-cloc
Source: https://github.com/zhenpengLai/myuseskill/tree/main/dotnet-cloc
Command: npx skills add https://github.com/zhenpengLai/myuseskill --skill dotnet-cloc-zhenpenglai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Measuring the size and composition of a .NET codebase is hard to do consistently: build output folders pollute counts, language mixes are unclear, and branch-to-branch comparisons lack repeatable commands. This Skill standardizes how the open-source cloc tool is used in .NET repositories so footprint, composition, and diff metrics are reproducible in local workflows and CI. ## Core Features & Use Cases - Repeatable LOC and language-mix reporting: Count C#, Razor, MSBuild, JSON, XML, and YAML with explicit include and exclude rules that skip bin, obj, and vendored folders. - Branch and release diff statistics: Compare refs such as origin/main versus HEAD or tagged releases with cloc --git --diff to quantify change size. - Machine-readable output for CI: Emit JSON, CSV, YAML, or Markdown reports that docs and pipelines can consume and rerun. - Use Case: A team wants to verify that a refactoring reduced production code size. The Skill runs a baseline cloc count, compares it after the refactor, and produces a JSON diff report for the pull request. ## Quick Start Ask the AI to add cloc-based line-count and language-mix reporting to your .NET repository, excluding build output directories.

Frequently Asked Questions about dotnet-cloc

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

FAQPage Schema
How do I count lines of code in a .NET repository?▼

Run cloc with Git awareness using cloc --vcs=git, which respects tracked files. For .NET-focused counts, add --include-lang="C#,MSBuild,JSON,XML,YAML" and exclude build output with --exclude-dir=bin,obj.

How to compare code size between Git branches with cloc?▼

Use cloc --git --diff origin/main HEAD to get added, removed, and modified line counts between refs. Add --include-lang="C#" to scope the diff and --json for machine-readable output suitable for CI.

How do I install cloc on macOS, Linux, or Windows?▼

Install via Homebrew (brew install cloc), apt, dnf, or yum on Linux, Chocolatey or Scoop on Windows, or npm install -g cloc as a fallback. A Docker option (aldanial/cloc) works without local installation; verify with cloc --version.

Why are my cloc counts higher than expected?▼

Counts are usually inflated by build output and vendored code. Exclude bin, obj, .git, node_modules, and generated folders with --exclude-dir, and filter generated files like .Designer.cs or .g.cs with --not-match-f.

When should I not use cloc for code metrics?▼

Avoid using cloc to judge developer productivity or code quality from raw line counts. It measures size and composition only; pair it with tests, analyzers, and architecture review for meaningful engineering decisions.

Can cloc output be consumed by CI pipelines?▼

Yes, cloc supports --json, --csv, --yaml, and --md output formats plus --report-file for saving results. Pipelines can parse the JSON with jq, enforce thresholds, and upload reports as build artifacts.