Imported from z5labs/ai (
plugins/audit-skill/skills/audit-skill-workspace/iteration-6/eval-2/with_skill/work/.claude/skills/word-count/SKILL.md). Install upstream withnpx skills add z5labs/ai --skill word-count. Copyright stays with the author.
word-count
Produce a three-number report (word count, line count, byte count) for a single text file and write the result to a sibling .count.md file.
This skill is idempotent: re-running on the same input file overwrites the report with current numbers. Re-running with a different input file produces a separate report.
Inputs
path(required, positional CLI arg): absolute or repo-relative path to a regular file. Validation: must exist ([ -f "$path" ]) and be a text file (test withfile --brief --mime-type "$path"—--briefstrips the leading<path>:prefix so the raw output is the mime type; reject if it doesn't start withtext/).
Output
- A file at
<path>.count.mdcontaining three lines:words: N,lines: N,bytes: N. Overwrites any existing file at that destination — re-running is the documented refresh path.
Workflow
- Validate input. If
pathdoesn't exist or isn't a text file, exit with a one-line error to the user and do not write anything. - Compute counts. Run
wc -lwc "$path".wcemits fields in a fixed order — lines, words, bytes — regardless of the flag order, so the output is<lines> <words> <bytes> <path>. Map field 1 →lines, field 2 →words, field 3 →bytes. Do NOT infer the mapping from the flag order. - Write the report. Overwrite
<path>.count.mdwith the three lines above. Tell the user the report path.
When to skip
If the user asks for things this skill doesn't produce — character count (vs byte count), Unicode-aware grapheme counts, frequency analysis, language detection — defer to a more capable text-analysis tool rather than misusing this one.