Skip to content
Back to skills

Tools Count Sloc

ASecurity

Present a summary of the code base including lines of source code and complexity metrics.

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 9, 2026
developmentrustgobashgit

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add AI-native-Systems-Research/ai-native-storage-certus --skill tools-count-sloc --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tools Count Sloc?

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

Security grade badge for Tools Count Sloc
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ai-native-systems-research-tools-count-sloc/badge)](https://www.skillsdirectory.com/skills/ai-native-systems-research-tools-count-sloc)

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: tools-count-sloc
description: Present a summary of the code base including lines of source code and complexity metrics.
allowed-tools: Bash(*)
argument-hint: "[path]  (default: repo root)"
---

Count lines of source code and present complexity metrics for the codebase.

## Input

Optional argument: a subdirectory to scope the analysis (e.g. `components/dispatcher/v0`). Defaults to the repository root.

## Steps

1. Determine the target directory:

```bash
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
if [[ -n "$ARGUMENTS" ]]; then
    TARGET="$REPO_ROOT/$ARGUMENTS"
    if [[ ! -d "$TARGET" ]]; then
        echo "Error: directory not found: $TARGET" >&2
        exit 1
    fi
else
    TARGET="$REPO_ROOT"
fi
```

2. Ensure `tokei` is installed (it's a fast, accurate SLOC counter written in Rust):

```bash
if ! command -v tokei &>/dev/null; then
    echo "Installing tokei..."
    cargo install tokei --quiet
fi
```

3. Run tokei for the SLOC summary, excluding build artifacts and vendored dependencies:

```bash
tokei "$TARGET" --exclude deps/spdk-build --exclude target --sort code
```

4. Run the complexity analysis script to produce per-component metrics:

```bash
SCRIPT="$(git rev-parse --show-toplevel)/.claude/skills/tools-count-sloc/complexity.sh"
bash "$SCRIPT" "$TARGET"
```

5. Present the results to the user in a clear summary with:
   - Total lines of code (by language)
   - Breakdown by component/directory
   - Complexity indicators (files with highest function counts, deepest nesting)
   - Comparison of code vs tests vs comments ratios

6. Write out the presented results to SUMMARY.md file. Interactively allow user to specify a different directory.

Files in this skill

  • SKILL.md1.7 KB
  • complexity.sh4.3 KB

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…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.