Skip to content

Commit d8a67b2

Browse files
committed
skills
1 parent 8d74808 commit d8a67b2

File tree

6 files changed

+1309
-0
lines changed

6 files changed

+1309
-0
lines changed

.codex/skills/cloc/SKILL.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
name: cloc
3+
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.
4+
argument-hint: "[path or git ref]"
5+
---
6+
7+
## Prerequisites
8+
9+
Before running cloc, check if it is installed:
10+
11+
```
12+
which cloc
13+
```
14+
15+
If not found, install it:
16+
- macOS: `brew install cloc`
17+
- npm: `npm install -g cloc`
18+
- Debian/Ubuntu: `sudo apt install cloc`
19+
- Red Hat/Fedora: `sudo yum install cloc`
20+
21+
## About cloc
22+
23+
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.
24+
25+
## Common Usage
26+
27+
**Count a directory (default: current project):**
28+
```
29+
cloc .
30+
```
31+
32+
**Count using git file list (respects .gitignore):**
33+
```
34+
cloc --vcs=git
35+
```
36+
37+
**Count a specific path:**
38+
```
39+
cloc $ARGUMENTS
40+
```
41+
42+
**Count by file (detailed breakdown):**
43+
```
44+
cloc --by-file --vcs=git
45+
```
46+
47+
**Diff between two git refs:**
48+
```
49+
cloc --git --diff <ref1> <ref2>
50+
```
51+
52+
**Exclude directories:**
53+
```
54+
cloc --exclude-dir=node_modules,vendor,.git .
55+
```
56+
57+
## Output Formats
58+
59+
Use these flags for machine-readable output:
60+
- `--json` — JSON
61+
- `--yaml` — YAML
62+
- `--csv` — CSV
63+
- `--md` — Markdown table
64+
- `--xml` — XML
65+
66+
## Useful Flags
67+
68+
| Flag | Purpose |
69+
|------|---------|
70+
| `--by-file` | Per-file breakdown instead of per-language |
71+
| `--vcs=git` | Use git to get file list (respects .gitignore) |
72+
| `--git` | Treat arguments as git targets (commits, branches) |
73+
| `--diff <a> <b>` | Show added/removed/modified lines between two sources |
74+
| `--exclude-dir=<d1,d2>` | Skip directories |
75+
| `--exclude-lang=<l1,l2>` | Skip languages |
76+
| `--include-lang=<l1,l2>` | Only count these languages |
77+
| `--force-lang=<lang>,<ext>` | Map file extension to a language |
78+
| `--processes=N` | Parallel processing (N cores) |
79+
| `--quiet` | Suppress progress output |
80+
81+
## Guidelines
82+
83+
- Prefer `--vcs=git` over bare `.` to avoid counting generated/vendored files
84+
- Use `--json` when the user needs to process the output programmatically
85+
- When comparing versions, use `--git --diff <ref1> <ref2>`
86+
- For large repos, consider `--processes=N` to speed things up

0 commit comments

Comments
 (0)