combined-head-linecount-check
Fungsinya
Skill ini menunjukkan kepada agent AI cara melihat bagian atas sebuah file dan menghitung jumlah barisnya dalam satu perintah. Skill ini ditujukan untuk orang yang menginginkan pemeriksaan cepat pada file kode atau konfigurasi.
Kapan dipakai
- ✓Saat Anda ingin melihat beberapa baris pertama sebuah file dan panjang file itu dalam satu langkah.
- ✓Saat Anda memeriksa beberapa file dan ingin lebih sedikit panggilan shell.
- ✓Saat isi header atau panjang file penting sebelum Anda mengeditnya.
Link skill
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/combined-head-linecount-check/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Tampilkan 10 baris pertama main.ts dan beri tahu saya berapa jumlah barisnya, dalam satu pemeriksaan.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent menjalankan head untuk menampilkan baris teratas, mencetak pemisah, lalu menjalankan wc -l untuk menghitung baris. Outputnya menampilkan isi lebih dulu dan jumlah baris di bawah garis strip.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
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.
Pertanyaan umum
Mengapa kedua pemeriksaan digabung?
Setiap panggilan shell membutuhkan satu putaran, sehingga satu perintah gabungan menyelesaikan pekerjaan dalam langkah yang lebih sedikit.
Bisakah memeriksa beberapa file sekaligus?
Bisa. Skill ini menunjukkan cara merangkai pemeriksaan untuk beberapa file dalam satu panggilan shell.
Apa fungsi garis putus-putus?
Garis ini memisahkan isi file dari jumlah baris, sehingga outputnya mudah dibaca.
Detail
Deskripsi asli dari pembuat
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.
repo: HKUDS/AgentPilot
Popularitas
- Bintang GitHub
- 7.8k
- Peringkat
- #13040
- Lisensi
- MIT
- Diperbarui
- 1/11/2026
Komentar
- …
Skill lain dari repositori ini
agentpilot
7.8kMembantu agent Anda meningkatkan proyek langkah demi langkah dengan menyiapkan tugas dan menjalankan loop AgentPilot yang mengusulkan, menguji, dan memberi skor pada perubahan.
openspace
7.8kMembantu agent Anda menyiapkan OpenSpace, alat yang menyimpan dan mengambil skill agent, lalu menghubungkannya ke aplikasi AI Anda melalui MCP.
rsi-arena
7.8kMembantu agent Anda menyiapkan dan menjalankan tes benchmark AI standar, seperti AIME dan Terminal-Bench, untuk membandingkan berbagai metode perbaikan.
experiment-guide
7.8kMembantu agent Anda merencanakan eksperimen kecil, membaca hasilnya, dan mencatat temuan saat menyelidiki cara memperbaiki sebuah program.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.