Skip to content
Skillpedia
General coding7.8k Β· #13089

verify-directory-structure-parallel-audit

What it does

This skill checks that folders and files exist and can be read, then reads groups of files together. It is for people auditing a larger codebase who want the work done faster.

When to use it

  • βœ“When a file operation fails and you need to check the folder first.
  • βœ“When you need to audit many source files in one pass.
  • βœ“When you want to check TypeScript import patterns across a project.

Skill link

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

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/verify-directory-structure-parallel-audit/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œCan you check my project folders and then review the imports in all the source files?”

5 new skills a week. 1 minute to read.

How it works

The agent lists the folders, builds a list of files to check, reads them in batches, and then reviews the TypeScript import patterns.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Verify Directory Structure β€” Parallel Audit

This skill provides a systematic approach to diagnosing file access issues and auditing source trees efficiently. It extends basic directory verification with parallel batch file reading (dramatically reducing iteration count when many files must be inspected) and a dedicated TypeScript import validation phase that catches a common class of structural bugs.


Steps

Phase 1 β€” Directory Verification

  1. Identify Target Paths: Collect every file or directory path involved in the operation. Prefer absolute paths to eliminate ambiguity.

  2. Enumerate with list_dir: Call list_dir on each relevant directory. Record all file names, sizes, and modification dates. This is your ground truth before touching any file.

  3. Verify Existence & Permissions: Confirm the directory exists and that the current user has read (and, if needed, write/execute) permissions. If a directory is missing, create it before proceeding. 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.


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.

  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 common class of structural bugs found when auditing TypeScript source trees.

  1. Identify Import Statements: For every .ts / .tsx file read in Phase 2, extract all import lines.

  2. Classify Import Kind β€” Value vs. Type:

    Pattern Correct usage
    import Foo from '...' Runtime value (class, function, object)
    import { Foo } from '...' Runtime value export
    import type Foo from '...' Type-only import (erased at compile time)
    import type { Foo } from '...' Type-only named import
    import { type Foo } from '...' Inline type modifier (TS 4.5+)
  3. Flag Value Imports Used Only as Types: If an identifier imported without type is used only in type positions (: Foo, as Foo, implements Foo, generic parameters), it should be converted to import type. This prevents accidental runtime dependencies and satisfies verbatimModuleSyntax / isolatedModules compiler flags.

    // ❌ Before β€” value import used only as a type
    import { UserProfile } from './types';
    const handler = (u: UserProfile) => { ... };
    
    // βœ… After β€” type-only import
    import type { UserProfile } from './types';
    const handler = (u: UserProfile) => { ... };
    
  4. Flag Duplicate Imports: Detect cases where the same module is imported more than once in a file (often from copy-paste). Merge them into a single import statement.

    // ❌ Duplicate
    import { A } from './utils';
    import { B } from './utils';
    
    // βœ… Merged
    import { A, B } from './utils';
    
  5. Verify Barrel / Index Exports: When

FAQ

Why read files in batches?

Reading several files at once takes fewer steps than reading them one by one.

What does it check in the folders?

It checks that each folder exists and that the user can read it, and it creates missing folders when needed.

Does it change files?

The audit step reads files first. Any edits are a separate, explicit step.

Details

Original description by the author

Diagnose and resolve file access issues by verifying directory structure, then reading multiple files in parallel batches for efficient auditing, with built-in guidance for validating TypeScript import patterns.

repo: HKUDS/AgentPilot

Popularity

GitHub stars
7.8k
Ranking position
#13089
License
MIT
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills