Skip to content
Back to skills

Cloc

ASecurity

Count lines of code, analyze codebase size and composition, compare code between versions. Use when the user asks about lines of code, codebase size, language breakdown, or code statistics.

  • 16 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
ai-agentsnodegit

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 9, 2026

npx -y skills add onfire7777/universal-ai-skills-library --skill cloc --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cloc?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cloc
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/onfire7777-cloc/badge)](https://www.skillsdirectory.com/skills/onfire7777-cloc)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cloc
description: Count lines of code, analyze codebase size and composition, compare code between versions. Use when the user asks about lines of code, codebase size, language breakdown, or code statistics.
license: Unspecified
metadata:
  argument-hint: '[path or git ref]'
---
## Prerequisites

Before running cloc, check if it is installed:

```
which cloc
```

If not found, install it:
- macOS: `brew install cloc`
- npm: `npm install -g cloc`
- Debian/Ubuntu: `sudo apt install cloc`
- Red Hat/Fedora: `sudo yum install cloc`

## About cloc

cloc counts blank lines, comment lines, and physical lines of source code in 200+ programming languages. It can analyze files, directories, archives (tar, zip, .whl, .ipynb), and git commits/branches.

## Common Usage

**Count a directory (default: current project):**
```
cloc .
```

**Count using git file list (respects .gitignore):**
```
cloc --vcs=git
```

**Count a specific path:**
```
cloc $ARGUMENTS
```

**Count by file (detailed breakdown):**
```
cloc --by-file --vcs=git
```

**Diff between two git refs:**
```
cloc --git --diff <ref1> <ref2>
```

**Exclude directories:**
```
cloc --exclude-dir=node_modules,vendor,.git .
```

## Output Formats

Use these flags for machine-readable output:
- `--json` — JSON
- `--yaml` — YAML
- `--csv` — CSV
- `--md` — Markdown table
- `--xml` — XML

## Useful Flags

| Flag | Purpose |
|------|---------|
| `--by-file` | Per-file breakdown instead of per-language |
| `--vcs=git` | Use git to get file list (respects .gitignore) |
| `--git` | Treat arguments as git targets (commits, branches) |
| `--diff <a> <b>` | Show added/removed/modified lines between two sources |
| `--exclude-dir=<d1,d2>` | Skip directories |
| `--exclude-lang=<l1,l2>` | Skip languages |
| `--include-lang=<l1,l2>` | Only count these languages |
| `--force-lang=<lang>,<ext>` | Map file extension to a language |
| `--processes=N` | Parallel processing (N cores) |
| `--quiet` | Suppress progress output |

## Guidelines

- Prefer `--vcs=git` over bare `.` to avoid counting generated/vendored files
- Use `--json` when the user needs to process the output programmatically
- When comparing versions, use `--git --diff <ref1> <ref2>`
- For large repos, consider `--processes=N` to speed things up

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…