combined-head-linecount-check
预览截图
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "combined-head-linecount-check":https://skillpi.com/zh/skills/deepskill-ba570f6c0aaf0746b877afc7dce6df03442e1ef4e474727c55930b4530bd6692。安装前核对上游来源和版本:https://github.com/HKUDS/OpenSpace。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
在一次 shell 调用中使用 head 和 wc -l 验证文件的前 N 行和总行数,通过 echo 分隔符分隔输出,旨在最小化读取操作和 shell 迭代次数。
介绍来源: third_party · HKUDS · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 使用头和 wc -l 用回声分隔符验证文件的第一个N行和一个 shell 调用中的总行数,将读操作和 shell 迭代最小化 。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: combined-head-linecount-check
description: Verify a file's first N lines and total line count in one shell call using head and wc -l with an echo separator, minimizing read operations and shell iterations.Combined Head + Line Count Check
When you need to both inspect the top of a file and confirm its total line count, collapse the two checks into a single run_shell call instead of issuing two separate commands.
Why
- Each shell call is a round-trip. Two separate calls (
headthenwc -l) cost two iterations. - A combined call costs one iteration and returns both pieces of information atomically.
- When checking multiple files at once, each file still only needs one call (or all files can be parallelized in a single compound command).
Pattern
head -N <file> && echo "---" && wc -l <file>
The echo "---" separator makes the output easy to parse visually: everything above the dashes is content, everything below is the line count.
Examples
Single file — inspect first 10 lines and total count
head -10 src/main.ts && echo "---" && wc -l src/main.ts
Sample output:
import { createApp } from 'vue'
import App from './App.vue'
...
---
142 src/main.ts
Multiple files — fully parallelized
When you need to check several files simultaneously, run them all in one shell call using && chains or newline-separated subshells:
(head -10 src/main.ts && echo "---" && wc -l src/main.ts) && echo "===" && \
(head -10 vite.config.ts && echo "---" && wc -l vite.config.ts) && echo "===" && \
(head -5 package.json && echo "---" && wc -l package.json)
Or, if order independence is acceptable, run them in parallel background jobs and wait:
{
head -10 src/main.ts && echo "---" && wc -l src/main.ts
} &
{
head -10 vite.config.ts && echo "---" && wc -l vite.config.ts
} &
wait
When to Apply
| Situation | Recommendation |
|---|---|
| Verifying a generated/modified file was written correctly | ✅ Use combined call |
| Checking multiple output files after a build step | ✅ Parallelize all in one shell call |
| Only need line count (no content preview required) | Use plain wc -l |
| Only need content (no line count required) | Use plain head -N |
| File is extremely large and you want a middle section | Use sed -n or awk instead |
Integration with Parallel Reads
This pattern compounds well with parallel file reads. In a single iteration you can:
- Read file contents with
catorheadfor multiple files. - Simultaneously verify line counts with
wc -l. - Check for specific patterns with
grep -c.
Example of a 5-file parallel verification in one shell call:
echo "=== main.ts ===" && head -10 src/main.ts && echo "lines:" && wc -l < src/main.ts && \
echo "=== config ===" && head -5 vite.config.ts && echo "lines:" && wc -l < vite.config.ts && \
echo "=== package ===" && head -5 package.json && echo "lines:" && wc -l < package.json && \
echo "=== index ===" && head -8 index.html && echo "lines:" && wc -l < index.html && \
echo "=== readme ===" && head -5 README.md && echo "lines:" && wc -l < README.md
Tip: Using
wc -l < file(with input redirect) prints only the number, without the filename — cleaner output when the filename is already shown by theecholabel above it.
Key Takeaway
Never use two shell calls where one will do. Combining
head -Nandwc -lin a single command is the minimal-overhead way to answer both "what does this file contain?" and "is it the right size?" simultaneously.
当前收录版本
0.0.1
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供了一种高效合并 head 和 wc -l 调用的实用技巧,减少 shell 迭代次数
- 适用于开发、运维等需要快速验证文件内容和行数的场景
待提升项
-
触发词缺失 原报告严重程度:轻微
description 内容完整,但未在 frontmatter 中定义明确的触发关键词或命令别名
改进建议:建议在 frontmatter 中添加 keywords 字段,包含如 head、wc、line count、file check 等触发词,提升匹配精准度
亮点
- description 清晰描述了核心功能和适用场景
亮点
- 文档结构完整,包含 Why、Pattern、Examples、When to Apply 等逻辑清晰的章节
- 提供了丰富的单文件和批量文件使用示例,便于用户理解和应用
待提升项
-
异常处理未覆盖 原报告严重程度:轻微
未处理文件不存在、权限不足等常见 shell 执行异常情况
改进建议:建议在文档中添加错误处理说明,例如使用 test -f 检查文件存在性,或在命令链中加入错误退出码处理
亮点
- shell 命令语法正确,参数使用合理,输出格式清晰易解析
- 提供了并行化处理多个文件的优化方案
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。