Skip to content
Back to skills

No Vendor Directory Scans

ASecurity

Exclude generated dependency and build directories from recursive searches unless the investigation specifically requires them.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 22, 2026
ai-agentsjavascripttypescriptpythonrustgojavakotlinreactnextjsnode

Works with

  • cursor
  • vscode

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned October 22, 2026

npx -y skills add alivirgo/Major-AI-Skills --skill no-vendor-directory-scans --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of No Vendor Directory Scans?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for No Vendor Directory Scans
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/alivirgo-no-vendor-directory-scans/badge)](https://www.skillsdirectory.com/skills/alivirgo-no-vendor-directory-scans)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: no-vendor-directory-scans
description: "Exclude generated dependency and build directories from recursive searches unless the investigation specifically requires them."
category: efficiency
risk: safe
source: self
source_type: self
date_added: "2026-08-26"
tags: ["vendor-exclusion", "node-modules", "venv", "directory-traversal", "token-optimization", "agent-runtime"]
tools: ["claude", "cursor", "gemini", "codex", "lmstudio"]
---

# Vendor & Artifact Directory Exclusion Protocol

## Overview
In modern software engineering, a typical repository containing 20 source files also contains **30,000+ third-party vendor files** inside `node_modules/`, `venv/`, or Rust `target/` directories.

When an autonomous agent runs an unconstrained recursive search or directory crawler without vendor exclusions, the tool attempts to index and return thousands of third-party package files.

Unconstrained vendor scans cause:
1. **Catastrophic Context Overflow**: A single `list_dir` or `find` on `node_modules/` dumps **80,000+ tokens**, instantly exhausting context windows.
2. **Hallucinated Package Edits**: Models mistakenly try to fix bugs by editing files inside `node_modules/` or `site-packages/` (which get wiped out on next `npm install`).
3. **Execution Latency Stalls**: Scanning 50,000 disk inodes takes 5 to 10 seconds of local I/O.

The **Vendor & Artifact Directory Exclusion Protocol** enforces strict, non-bypassable directory blacklists at the tool runner layer.

---

## Unconstrained Directory Crawl vs. Vendor-Exclusion Guard

```
┌─────────────────────────────────────────────────────────────┐
│                 Directory Ingestion Comparison              │
│                                                             │
│  Unconstrained Recursive Crawl (32,000 Files / 90k Tokens): │
│  • `node_modules/lodash/package.json`                       │
│  • `node_modules/react/cjs/react.development.js`            │
│  • `venv/lib/python3.11/site-packages/pydantic/...`         │
│  • `.git/objects/4f/8a2b3...`                               │
│  ↳ 90,000 tokens billed, context window crashes!           │
│                                                             │
│  Vendor-Exclusion Guard (22 Files / 180 Tokens):            │
│  • `src/components/Button.tsx`                              │
│  • `src/services/auth.ts`                                   │
│  • `package.json`                                           │
│  ↳ 180 clean tokens (99.8% Reduction!), 100% active code    │
└─────────────────────────────────────────────────────────────┘
```

---

## The Universal Vendor Exclusion Blacklist

Every agent tool (`list_dir`, `grep_search`, `glob`) must automatically filter out paths containing any of these segment names:

```
┌───────────────────────────────────────────────────────────────────────────┐
│ • JAVASCRIPT / TYPESCRIPT: `node_modules`, `.next`, `dist`, `build`, `.turbo`│
│ • PYTHON: `venv`, `.venv`, `__pycache__`, `.pytest_cache`, `site-packages`│
│ • RUST / GO: `target`, `vendor`                                           │
│ • JAVA / KOTLIN: `.gradle`, `build`, `target`, `.m2`                      │
│ • GIT & ENVIRONMENT: `.git`, `.idea`, `.vscode`, `.DS_Store`, `coverage`   │
└───────────────────────────────────────────────────────────────────────────┘
```

---

## Production Python Directory Filter Middleware

```python
from pathlib import Path
from typing import List, Set

BANNED_DIR_NAMES: Set[str] = {
    # Package managers & dependencies
    "node_modules", "venv", ".venv", "vendor", "site-packages",
    # Build artifacts & caches
    "dist", "build", "target", ".next", ".turbo", ".cache", "__pycache__",
    ".pytest_cache", ".mypy_cache", ".ruff_cache", "coverage",
    # Version control & IDEs
    ".git", ".svn", ".hg", ".idea", ".vscode", ".DS_Store"
}

def is_path_safe_from_vendor(path: Path, root: Path) -> bool:
    """Returns True if the path contains zero blacklisted vendor directory segments."""
    try:
        rel_parts = path.relative_to(root).parts
        return not any(part in BANNED_DIR_NAMES for part in rel_parts)
    except ValueError:
        return False

def safe_crawl_workspace(root: Path) -> List[str]:
    """Recursively lists repository files while strictly excluding vendor directories."""
    safe_files = []
    for p in root.rglob("*"):
        if p.is_file() and is_path_safe_from_vendor(p, root):
            safe_files.append(str(p.relative_to(root)).replace("\\", "/"))
    return safe_files
```

---

## Benchmark Comparison

Listing repository contents for a modern Next.js + Python microservice:

| Scan Configuration | Files Returned | Tokens Ingested | I/O Scan Time | Context Safety |
| :--- | :--- | :--- | :--- | :--- |
| **Unconstrained Scan** | 38,420 files | 115,000 tokens | 6.4 seconds | 🚨 Crash / Overflow |
| **Vendor Exclusion Protocol**| **42 files** | **310 tokens** | **0.01 seconds** | **✅ 100% Safe** |

---

## Agent Operational Directive
> **MANDATORY**: Filesystem exploration and search tools must automatically exclude `node_modules`, `venv`, `dist`, `target`, and `.git` by default. Never traverse into vendor dependency trees unless the user explicitly requests an audit of an external package.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.