Chuyển đến nội dung
Skillpedia
Lập trình chung7.8k · #13051

dir-verify-parallel-shell-audit

Skill này làm gì

Skill này hướng dẫn AI agent tìm ra vì sao các file không truy cập được và kiểm tra cây mã nguồn một cách hiệu quả. Nó dành cho nhà phát triển làm việc với các thư mục dự án chưa quen.

Khi nào nên dùng

  • ✓Khi các thao tác file thất bại và bạn cần kiểm tra cấu trúc thư mục có đúng không.
  • ✓Khi bạn cần kiểm tra một cây mã nguồn và đọc nhanh nhiều file.
  • ✓Khi bạn cần chi tiết file như số dòng hoặc các dòng đầu mà không tốn thêm bước.

Liên kết skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/dir-verify-parallel-shell-audit/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/dir-verify-parallel-shell-audit/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Các file của tôi không được tìm thấy trong dự án này. Hãy kiểm tra bố cục thư mục và các dòng đầu của file cấu hình trong một lượt.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent liệt kê các thư mục liên quan và chạy kiểm tra shell để đếm dòng và lấy nội dung đầu trong cùng một bước. Sau đó nó đọc file theo lô và xác nhận các mẫu import, nhờ đó giảm số bước cần thiết.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Verify Directory Structure — Parallel Audit with Shell Property Checks

This skill provides a systematic approach to diagnosing file access issues and auditing source trees efficiently. It extends the parallel batch reading approach with an integrated shell property check phase that combines head -N and wc -l into a single run_shell call, co-scheduled with directory listing in Phase 1. This eliminates a common extra iteration that would otherwise be required to check file properties such as line counts and leading content (e.g., CSS/config file headers).


Steps

Phase 1 — Directory Verification + Shell Property Checks (Combined)

Key optimization: Fire list_dir calls and run_shell property checks in the same iteration. This avoids a dedicated iteration later just to learn "how many lines does this file have?" or "what is the first line of this CSS file?".

  1. Identify Target Paths: Collect every file or directory path involved in the operation. Prefer absolute paths to eliminate ambiguity. At this stage, also note any files whose properties (line count, header content) you already know you will need — typically CSS, config, or data files.

  2. Issue Parallel list_dir + run_shell Calls Simultaneously:

    • Call list_dir on each relevant directory.
    • In the same iteration, issue one or more run_shell calls that bundle head and wc -l for known target files using a single compound shell command.
    Iteration 1 (parallel):
      list_dir(src/components)
      list_dir(src/styles)
      run_shell("head -5 src/styles/main.css && echo '---' && wc -l src/styles/main.css")
      run_shell("head -3 vite.config.ts && echo '---' && wc -l src/main.ts")
    

    Compound shell pattern (combine head + wc + any other checks for a file):

    # Single run_shell call — multiple files, multiple checks, zero extra iterations
    head -10 path/to/file.css && echo "LINE_COUNT:" && wc -l path/to/file.css && \
    echo "---" && head -5 path/to/config.ts && echo "LINE_COUNT:" && wc -l path/to/config.ts
    
  3. Verify Existence & Permissions: Confirm directories exist and that the current user has read (and, if needed, write/execute) permissions. If a directory is missing, create it before proceeding (mkdir -p). If permissions are insufficient, adjust them before retrying.

  4. Build a File Manifest: From the list_dir output, compile the complete list of files to be audited. Group them logically (e.g., by subdirectory or file type) so they can be read in parallel batches in Phase 2.

  5. Record Shell Check Results: Parse and store the head/wc -l output alongside the manifest. This data is immediately available for the final audit report without any additional iterations.


Phase 2 — Parallel Batch File Reading

Why this matters: Reading files sequentially costs one iteration per file. Reading them in parallel batches collapses N files into ⌈N/batch_size⌉ iterations — a significant speedup when auditing dozens of files.

  1. Determine Batch Size: Default to reading 5–10 files per batch. Reduce the batch size if individual files are very large; increase it for small config/index files. Files whose content was partially previewed via head in Phase 1 should still be fully read here if their complete content is needed.

  2. Issue Parallel read_file Calls: Within each batch, invoke read_file for all files simultaneously (a single iteration). Do not wait for one file before requesting the next within the same batch.

    Batch 1 (parallel): read_file(src/components/A.tsx)
                         read_file(src/components/B.tsx)
                         read_file(src/components/C.tsx)
                         read_file(src/components/D.tsx)
                         read_file(src/components/E.tsx)
    
    Batch 2 (parallel): read_file(src/components/F.tsx)
                         ...
    
  3. Collect & Triage Results: After each batch completes, scan results for errors (file-not-found, permission denied) and flag them immediately. Do not abort the remaining batches; continue and aggregate all findings.

  4. Re-verify Missing Files: For any file reported as missing, re-run list_dir on its parent directory to confirm whether the file truly does not exist or whether the path was wrong. Correct the path and retry the single file if necessary.


Phase 3 — TypeScript Import Validation

This phase targets a co

Câu hỏi thường gặp

Điều gì tiết kiệm thời gian nhất?

Skill chạy liệt kê thư mục và kiểm tra thuộc tính file trong cùng một bước, tránh một vòng gọi đi về thừa.

Nó có kiểm tra import TypeScript không?

Có, skill bao gồm việc xác thực các mẫu import TypeScript.

Có nên dùng đường dẫn tuyệt đối không?

Skill ưu tiên đường dẫn tuyệt đối để tránh nhầm lẫn về vị trí file.

Chi tiết

Mô tả gốc của tác giả

Diagnose and resolve file access issues by verifying directory structure, reading multiple files in parallel batches, running combined shell property checks (head/wc-l) in the same iteration as directory listing, and validating TypeScript import patterns — all with built-in guidance to minimize total iteration count.

repo: HKUDS/AgentPilot

Độ phổ biến

Sao GitHub
7.8k
Vị trí xếp hạng
#13051
Giấy phép
MIT
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự