360 Secure SkillHub
360 安全技能中心

code-stats

该 Skill 以 Node 库和 CLI 形式扫描指定目录(排除 node_modules 和 .git),统计各扩展名下的文件数与行数、总文件数与总行数、语言百分比,以及 TODO/FIXME/HACK/XXX 注释数量,并可输出可读的文本报告,需要在本地 Node 环境运行。

分类:数据
147258xuan
147258xuan
热度 2.94
最近更新 2026-11-13 18:44:14

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add 147258xuan/code-stats
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
code-stats
description
Analyze workspace code complexity — file counts by type, line counts, language breakdown, git commit frequency, and TODO/FIXME density. Use when you need to understand repo health or complexity metrics.

Code Stats Skill

Analyzes a workspace directory for code complexity metrics.

Usage

const { analyze, report } = require('./skills/code-stats');

// Analyze current workspace
const stats = analyze(process.cwd());
console.log(report(stats));

CLI

node skills/code-stats/scripts/stats.js [directory]

Exports

  • analyze(dir) — Returns stats object with file counts, line counts, language breakdown
  • report(stats) — Returns human-readable formatted report string
  • countTodos(dir) — Scans for TODO/FIXME/HACK/XXX comments

Output Fields

  • filesByExt — File count grouped by extension
  • linesByExt — Line count grouped by extension
  • totalFiles — Total file count (excludes node_modules, .git)
  • totalLines — Total lines of code
  • todoCount — TODO/FIXME/HACK/XXX comment count
  • languageBreakdown — Percentage breakdown by language