跳到正文
cccskills
免费在 GitHub 公开

combined-head-linecount-check

Inspect the first few lines of a file and its total line count in one shell call. Combine head and wc -l with a visible separator to check generated or modified files with fewer calls.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

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.

查看安装方法

适用场景

  • Checking the beginning and line count of a generated file
  • Inspecting a file after edits
  • Checking several output files after a build

包含的文件(2)

  • SKILL.md3.6 KB
  • .skill_id43 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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 (head then wc -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

SituationRecommendation
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 sectionUse sed -n or awk instead

Integration with Parallel Reads

This pattern compounds well with parallel file reads. In a single iteration you can:

  1. Read file contents with cat or head for multiple files.
  2. Simultaneously verify line counts with wc -l.
  3. 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 the echo label above it.

Key Takeaway

Never use two shell calls where one will do. Combining head -N and wc -l in a single command is the minimal-overhead way to answer both "what does this file contain?" and "is it the right size?" simultaneously.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Prepare audio stems, the separate parts of a track, for mixing by matching their durations with silence, loops, or crossfades. Verify each generated and processed file before moving to the next production step.

中文简介正在准备中。当前显示英语简介。

  • Match audio parts with different durations
  • Extend drums and melodic parts using suitable methods
  • Check audio specifications before mixing
HKUDS/OpenSpace77562026年8月13日 更新

Produce audio in separate stems, meaning individual instrument tracks, and verify each output as you go. Align track lengths with silence, loops, or crossfades, then apply effects, mix a master, and package the files.

中文简介正在准备中。当前显示英语简介。

  • Align instrument tracks to a reference audio file
  • Choose how to extend tracks that are too short
  • Verify audio properties after generation and effects
HKUDS/OpenSpace77562026年8月13日 更新

Build serverless endpoints that relay external API requests for a dashboard while keeping API keys on the server. Includes Vercel examples for input checks, caching, cross-origin access, and consistent JSON responses.

中文简介正在准备中。当前显示英语简介。

  • Connect a dashboard to external APIs without exposing API keys
  • Create endpoints for stock quotes and news
  • Standardize API responses and error handling
HKUDS/OpenSpace77562026年8月13日 更新

Produce a master track and separate audio parts through a structured Python workflow. Apply filters and reverb, export WAV files with consistent settings, package them in a ZIP archive, and check that the deliverables meet the requested specifications.

中文简介正在准备中。当前显示英语简介。

  • Export a master track with separate audio parts
  • Apply filters and reverb to audio
  • Check duration and format across deliverables
HKUDS/OpenSpace77562026年8月13日 更新

Keep document creation moving when web searches and page retrieval repeatedly fail. The skill preserves the original task, uses the model’s existing knowledge, and clearly identifies information that could not be checked against external sources.

中文简介正在准备中。当前显示英语简介。

  • Continue drafting after repeated web retrieval failures
  • Preserve task requirements during network errors
  • Mark information that could not be externally verified
HKUDS/OpenSpace77562026年8月13日 更新

When Python execution repeatedly fails in execute_code_sandbox, use a file-based alternative: save the script, run it through the shell, and capture results or errors. The guidance covers paths, imports, timeouts, structured output, and optional cleanup.

中文简介正在准备中。当前显示英语简介。

  • Retry Python work through the shell after repeated sandbox failures
  • Run longer tasks with an adjusted timeout
  • Execute Python work that needs multiple files or system utilities
HKUDS/OpenSpace77562026年8月13日 更新

查看 HKUDS 的全部技能

报告此技能的问题