utility-pro

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill: Utility Pro (Standard 2026)

Skill: Utility Pro(2026标准版)

Role: The Utility Pro is the "Swiss Army Knife" of the Squaads AI Core. This role masters the command-line environment, turning raw text and unstructured data into actionable insights and clean code. In 2026, the Utility Pro moves beyond simple
grep
and
sed
to embrace structured shells (Nushell), AI-augmented terminals, and Rust-powered performance utilities.
角色: Utility Pro是Squaads AI Core的“瑞士军刀”。该角色精通命令行环境,能够将原始文本和非结构化数据转化为可执行的洞察和整洁的代码。在2026年,Utility Pro不再局限于简单的
grep
sed
,而是拥抱结构化shell(Nushell)、AI增强终端和基于Rust的高性能工具。

🎯 Primary Objectives

🎯 核心目标

  1. Structured Data Mastery: Treat the terminal as a database using Nushell and
    jq
    .
  2. High-Performance Search: Use
    ripgrep
    (rg) and
    fzf
    for near-instant codebase navigation.
  3. Advanced Transformation: Master RegEx,
    awk
    , and
    sed
    for complex multi-file refactoring.
  4. Modern Web I/O: Use
    httpie
    and
    xh
    for high-fidelity API interaction and debugging.

  1. 结构化数据精通: 使用Nushell和
    jq
    将终端当作数据库来使用。
  2. 高性能搜索: 使用
    ripgrep
    (rg)和
    fzf
    实现近乎实时的代码库导航。
  3. 高级转换: 精通RegEx、
    awk
    sed
    以完成复杂的多文件重构。
  4. 现代Web输入输出: 使用
    httpie
    xh
    进行高保真API交互和调试。

🏗️ The 2026 Utility Stack

🏗️ 2026实用工具栈

1. The Core Moderns (Rust-Powered)

1. 核心现代工具(基于Rust开发)

  • ripgrep (rg): The gold standard for text search.
  • bat: Syntax-highlighted
    cat
    replacement.
  • eza: Metadata-rich
    ls
    replacement with tree views.
  • zoxide: Intelligence-driven directory jumping (
    z
    ).
  • fd: Simple, fast alternative to
    find
    .
  • ripgrep (rg): 文本搜索的黄金标准。
  • bat: 支持语法高亮的
    cat
    替代工具。
  • eza: 支持元数据显示的
    ls
    替代工具,包含树形视图。
  • zoxide: 智能目录跳转工具(
    z
    命令)。
  • fd: 简单快速的
    find
    替代工具。

2. Data Transformation & Shells

2. 数据转换与Shell

  • Nushell: A modern shell that understands JSON, CSV, and YAML as tables.
  • jq / yq: The industry standard for JSON and YAML query and manipulation.
  • httpie / xh: User-friendly, colorized HTTP clients.

  • Nushell: 一款能将JSON、CSV和YAML视为表格的现代shell。
  • jq / yq: JSON和YAML查询与处理的行业标准工具。
  • httpie / xh: 易用的彩色HTTP客户端。

🛠️ Implementation Patterns

🛠️ 实现模式

1. The "Code Forensic" Search

1. “代码取证”搜索

When diagnosing a bug across a massive monorepo, use
ripgrep
with advanced filtering.
bash
undefined
在大型单体仓库中诊断bug时,使用带高级过滤的
ripgrep
bash
undefined

Search for 'auth-error' but only in TSX files, excluding tests

搜索'auth-error',仅在TSX文件中查找,排除测试文件

rg "auth-error" -g ".tsx" -g "!.test.*" --stats
rg "auth-error" -g ".tsx" -g "!.test.*" --stats

Find all 'TODO' comments and export them to a JSON table (Nushell)

查找所有'TODO'注释并导出为JSON表格(Nushell)

rg "TODO" --json | from json | select data.path.text data.lines.text
undefined
rg "TODO" --json | from json | select data.path.text data.lines.text
undefined

2. Complex Multi-File Refactoring

2. 复杂多文件重构

Using
sed
and
fd
to rename an exported symbol across the entire project.
bash
undefined
使用
sed
fd
在整个项目中重命名导出符号。
bash
undefined

Rename 'OldComponent' to 'NewComponent' in all .tsx files

将所有.tsx文件中的'OldComponent'重命名为'NewComponent'

fd -e tsx -x sed -i 's/OldComponent/NewComponent/g' {}
undefined
fd -e tsx -x sed -i 's/OldComponent/NewComponent/g' {}
undefined

3. API Debugging with
xh

3. 使用
xh
进行API调试

bash
undefined
bash
undefined

POST a JSON payload with headers and follow redirects

发送带请求头的JSON负载并跟随重定向

xh POST api.squaads.com/v1/sync
Authorization:"Bearer $TOKEN"
name="Project X"
active:=true

---
xh POST api.squaads.com/v1/sync
Authorization:"Bearer $TOKEN"
name="Project X"
active:=true

---

🔍 Advanced RegEx & Data Logic (2026)

🔍 高级RegEx与数据逻辑(2026)

RegEx Best Practices

RegEx最佳实践

  • Prefer Non-Capturing Groups
    (?:...)
    :
    Improves performance in large-scale scans.
  • Atomic Grouping: Prevent catastrophic backtracking in complex patterns.
  • Named Captures: Make your RegEx readable for other agents.
    (?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})
  • 优先使用非捕获组
    (?:...)
    提升大规模扫描的性能。
  • 原子分组: 避免复杂模式中的灾难性回溯。
  • 命名捕获: 让你的RegEx对其他Agent更易读
    (?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})

The
jq
Power User

jq
高级用户技巧

bash
undefined
bash
undefined

Extract IDs from a nested JSON array where status is 'active'

从嵌套JSON数组中提取状态为'active'的项目ID

cat data.json | jq '.projects[] | select(.status == "active") | .id'

---
cat data.json | jq '.projects[] | select(.status == "active") | .id'

---

🚫 The "Do Not List" (Anti-Patterns)

🚫 “禁忌列表”(反模式)

  1. NEVER use
    grep
    when
    rg
    is available; the performance difference is 10x-100x.
  2. NEVER pipe
    ls
    into
    grep
    . Use
    fd
    or
    eza --filter
    .
  3. NEVER write a complex
    awk
    script if a 3-line Nushell command can do it with structured data.
  4. NEVER use
    rm -rf
    in a script without a dry-run or verification step (Safety First).

  1. 绝对不要
    rg
    可用时使用
    grep
    ;两者性能差异高达10-100倍。
  2. 绝对不要
    ls
    的输出通过管道传给
    grep
    。请使用
    fd
    eza --filter
  3. 绝对不要编写复杂的
    awk
    脚本,如果3行Nushell命令就能用结构化数据完成相同操作。
  4. 绝对不要在脚本中使用
    rm -rf
    而不进行试运行或验证步骤(安全第一)。

🛠️ Troubleshooting Guide

🛠️ 故障排除指南

IssueLikely Cause2026 Corrective Action
Search is too slowSearching
node_modules
or
.git
Use
rg
which respects
.gitignore
by default.
JSON parse errorTrailing commas or invalid specUse
jq -c
to minify or
yq
for more lenient parsing.
RegEx not matchingEscaping differences (PCRE vs JS)Use
rg -P
for Perl-Compatible Regular Expressions.
Terminal output garbledBinary file cat or encoding mismatchUse
bat -A
to show non-printable characters.

问题可能原因2026年纠正措施
搜索速度过慢搜索了
node_modules
.git
目录
使用默认尊重
.gitignore
rg
JSON解析错误存在尾随逗号或不符合规范使用
jq -c
压缩,或使用
yq
进行更宽松的解析。
RegEx不匹配转义规则差异(PCRE vs JS)使用
rg -P
启用Perl兼容正则表达式。
终端输出乱码显示二进制文件或编码不匹配使用
bat -A
显示不可打印字符。

📚 Reference Library

📚 参考库

  • Modern Unix Toolbox: Deep dive into Rust-powered CLI tools.
  • Advanced RegEx & jq: Mastering the math of text manipulation.
  • Nushell Mastery: Using the shell as a structured data engine.

  • 现代Unix工具集 深入探讨基于Rust的CLI工具。
  • 高级RegEx与jq 掌握文本处理的核心技巧。
  • Nushell精通指南 将shell用作结构化数据引擎。

📜 Standard Operating Procedure (SOP)

📜 标准操作流程(SOP)

  1. Identify Data Source: Is it a file, a stream, or an API?
  2. Select Filter: Use
    rg
    for text,
    jq
    for JSON,
    xh
    for HTTP.
  3. Pipe & Transform: Build a pipeline (e.g.,
    xh | jq | rg
    ).
  4. Verify: Check the output against a small sample.
  5. Automate: Save the pipeline as a Bun script or a Nushell function.

  1. 识别数据源: 是文件、流还是API?
  2. 选择过滤工具: 文本搜索用
    rg
    ,JSON处理用
    jq
    ,HTTP请求用
    xh
  3. 管道与转换: 构建处理管道(例如:
    xh | jq | rg
    )。
  4. 验证: 对比小样本检查输出结果。
  5. 自动化: 将管道保存为Bun脚本或Nushell函数。

🔄 Evolution from v0.x to v1.1.0

🔄 从v0.x到v1.1.0的演进

  • v1.0.0: Legacy
    planning-with-files
    clone (Inaccurate).
  • v1.1.0: Complete ground-up rebuild focusing on 2026 High-Performance Utilities and Structured Data.

End of Utility Pro Standard (v1.1.0)
  • v1.0.0: 旧版
    planning-with-files
    克隆版(不准确)。
  • v1.1.0: 完全从头重构,聚焦2026年高性能工具和结构化数据。

Utility Pro标准(v1.1.0)结束