360 Secure SkillHub
360 安全技能中心

i22089 StorageId Probe

该 Skill 提供命令行文本计数工具,可统计一个或多个纯文本文件的行数、单词数和字符数,并支持只输出指定计数或 JSON 结果;会跳过包含 NUL 字节的二进制文件,且不修改输入文件。

分类:效率
8treenet
8treenet
热度 2.03
最近更新 2026-11-24 05:06:47

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add 8treenet/i22089-storageid-probe
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
i22089-storageid-probe
description
Count words, lines and characters in text files from the command line.

Text Counter

A small command line helper for counting words, lines and characters in plain text files. Useful when you need a quick size estimate before committing notes or documentation, and you do not want to open an editor just to check length.

When to use it

Use this skill when you need to:

  • Compare the length of two drafts before picking one.
  • Check that a README stays below a documentation length limit.
  • Count how many lines a log excerpt contains before pasting it into a ticket.
  • Produce a quick word count for a chapter or a blog post draft.

How it works

The helper reads every path you pass, encodes the file as UTF-8, and reports three numbers: lines, words and characters. Lines are counted by newline characters, words by whitespace separated runs, and characters by Unicode code points so that emoji and accented letters are counted once rather than as multiple bytes.

Run it with one or more file paths:

text-counter notes.md draft.md

The output is one line per file followed by a total line:

notes.md      lines=42 words=310 chars=2140
draft.md      lines=58 words=405 chars=2870
total         lines=100 words=715 chars=5010

Options

  • --lines prints only the line count.
  • --words prints only the word count.
  • --chars prints only the character count.
  • --total prints only the aggregate line for all inputs.
  • --json prints a machine readable object with the same numbers.

When no option is given all three counters are shown. Options can be combined, for example --lines --words reports just those two values.

Notes and limitations

Binary files are detected by a NUL byte in the first block and skipped with a warning so that accidentally passing an image does not produce meaningless counts. Very large files are streamed in chunks, so memory use stays flat even when the input is a few hundred megabytes.

The tool does not modify any input file. It only reads, counts and exits with status zero on success and status two when a path cannot be read.

Examples

Count a single draft:

text-counter draft.md

Count all markdown files and print only totals:

text-counter --total docs/*.md

Emit JSON for a script:

text-counter --json notes.md | jq .total.words

This skill is intentionally dependency free and works on Linux, macOS and Windows with a standard shell. It ships a single entry point plus this documentation, so installing it does not pull in extra packages.