AgentSkillsCN

unix-tools

在LLM处理之外,优先选用UNIX常用工具作为参考。当您需要处理JSON、文本、搜索文件,或执行批量操作时,这一原则将为您提供可靠的选择。

SKILL.md
--- frontmatter
name: unix-tools
description: Reference for preferred UNIX tools over LLM processing. Use when processing JSON, text, searching files, or doing batch operations.

UNIX Tool Preferences

Prefer UNIX tools over LLM processing. Use the right tool for the task.

JSON

ToolUse ForExample
jqQuery, filter, transform JSONjq '.load_priority' mod.json

Text Processing

ToolUse ForExample
awkColumnar data, calculations, conditional logicawk -F: '{print $1}' file
sedStream editing, find/replace, extract line rangessed -n '10,20p' file
cutExtract fields/columns by delimitercut -d',' -f2 file.csv
sortSort lines (use before uniq)sort -n numbers.txt
uniqDeduplicate adjacent linessort file | uniq -c
trTranslate/delete characterstr '[:upper:]' '[:lower:]'
head/tailFirst/last N lines of filehead -20 file
revReverse stringsecho "hello" | rev

Search & Batch

ToolUse ForExample
findLocate files by name, type, date, sizefind . -name "*.gd" -mtime -1
xargsPipe output as arguments to another commandfind . -name "*.gd" | xargs wc -l

Count & Compare

ToolUse ForExample
wcCount lines (-l), words (-w), chars (-c)wc -l *.gd
diffShow differences between filesdiff old.gd new.gd
commCompare sorted files (unique to each, common)comm -23 file1 file2

Paths

ToolUse ForExample
basenameExtract filename from pathbasename /path/to/file.gd
dirnameExtract directory from pathdirname /path/to/file.gd
realpathResolve to absolute pathrealpath ../relative/path

File Info

ToolUse ForExample
statFile metadata (size, timestamps, permissions)stat file.gd
fileDetect file type by contentfile mystery_file
treeVisualize directory structuretree -L 2 core/
duDisk usage by directorydu -sh mods/*

Data Generation

ToolUse ForExample
seqGenerate number sequencesseq 1 10
shufRandom selection/shuffle linesshuf -n 5 names.txt
bcArbitrary precision calculatorecho "scale=2; 22/7" | bc
dateFormat dates, convert timestampsdate +%Y-%m-%d

Checksums & Encoding

ToolUse ForExample
md5sum/sha256sumCompute/verify hashessha256sum file.zip
base64Encode/decode base64base64 -d encoded.txt
xxdHex dump for binary inspectionxxd binary_file | head

Key Principle

Use UNIX tools for data processing, not LLM token consumption. These tools are faster, deterministic, and won't hallucinate results.