Skip to content
Back to skills

Zero Cat Bash Prevention

ASecurity

Use bounded native file readers when available to inspect source with line numbers and relevant context.

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

Works with

  • claude code
  • cursor
  • terminal
  • api

Security analysis

A100/100

Scanned October 22, 2026

npx -y skills add alivirgo/Major-AI-Skills --skill zero-cat-bash-prevention --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Zero Cat Bash Prevention?

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

Security grade badge for Zero Cat Bash Prevention
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/alivirgo-zero-cat-bash-prevention/badge)](https://www.skillsdirectory.com/skills/alivirgo-zero-cat-bash-prevention)

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: zero-cat-bash-prevention
description: "Use bounded native file readers when available to inspect source with line numbers and relevant context."
category: efficiency
risk: safe
source: self
source_type: self
date_added: "2026-08-26"
tags: ["zero-cat", "view-file", "native-tools", "line-numbering", "token-optimization", "agent-architecture"]
tools: ["claude", "cursor", "gemini", "codex", "lmstudio"]
---

# Zero-Cat Native Inspection Protocol (view_file over Shell cat)

## Overview
When inspecting a file on disk (*e.g., `src/services/billing.ts`*), naive agents frequently spawn terminal subprocesses to execute Unix or Windows print commands (*`run_command("cat src/services/billing.ts")`* or *`run_command("type file.ts")`*).

Using shell `cat` introduces four major operational failures:
1. **Zero Line-Number Indexing**: Shell `cat` outputs raw unnumbered text. The agent cannot accurately determine `StartLine` or `EndLine` for downstream `replace_file_content` edits, causing hallucinated line offsets.
2. **Zero Slice Bounding**: `cat` dumps the entire 2,000-line file into context, burning **15,000+ tokens** when the agent only needed to check a 10-line function.
3. **Subprocess Process Latency**: Initializing a shell subprocess takes 400ms+, whereas native IDE filesystem APIs execute in **sub-millisecond memory reads**.
4. **Cross-Platform Incompatibility**: `cat` fails or produces errors on Windows `cmd.exe` environments.

The **Zero-Cat Native Inspection Protocol** mandates using the native **`view_file`** tool, returning **1-indexed line numbers (`42: code`)** with precise `[StartLine, EndLine]` slice controls.

---

## Shell Subprocess `cat` vs. Native `view_file` Tool

```
┌─────────────────────────────────────────────────────────────┐
│                 File Inspection Mechanics                   │
│                                                             │
│  Shell Subprocess `cat file.ts` (600 Lines / 4,800 Tokens): │
│  import { db } from './db';                                 │
│  export function query() { ... }                            │
│  // [595 unindexed lines dumped into context]               │
│  ↳ 4,800 tokens billed, 0 line numbers for editing!         │
│                                                             │
│  Native `view_file` Tool (30 Lines / 280 Tokens - 94.1% Cut):│
│  40: export async function chargeCustomer(id: string) {     │
│  41:   const customer = await getCustomer(id);              │
│  42:   if (!customer) throw new NotFoundError();            │
│  ↳ 280 clean tokens, exact line numbers ready for patching  │
└─────────────────────────────────────────────────────────────┘
```

---

## The 4 Built-In Superpowers of `view_file`

```
┌───────────────────────────────────────────────────────────────────────────┐
│ 1. 1-INDEXED LINE NUMBERING: Every line prefixed with `<line_no>: `       │
│ 2. SURGICAL SLICE WINDOWING: `StartLine` and `EndLine` parameters         │
│ 3. SUB-MILLISECOND VFS READS: Reads from IDE memory buffer without PTY    │
│ 4. CROSS-PLATFORM DETERMINISM: 100% Identical on Windows, macOS, Linux    │
└───────────────────────────────────────────────────────────────────────────┘
```

---

## Tool Invocation Standard

When inspecting code in Antigravity IDE / Claude Code:

```json
{
  "AbsolutePath": "c:/Users/ASUS/Documents/Newfolder/Antigravity/Major AI Skills/src/services/billing.ts",
  "StartLine": 40,
  "EndLine": 75,
  "toolAction": "Inspecting customer billing handler slice",
  "toolSummary": "Surgical File View"
}
```

---

## Benchmark Comparison

Inspecting and editing 50 target functions in full-stack repositories:

| Inspection Tool | Ingested Tokens / Inspection | Line Number Indexing | Subsequent Edit Success |
| :--- | :--- | :--- | :--- |
| **Shell `cat` / `Get-Content`** | 4,200 tokens | ❌ None (Unnumbered) | 52% (Frequent line offset errors) |
| **Native `view_file` Tool** | **310 tokens** | **✅ Exact 1-Indexed** | **98% (First-pass patch success)** |

---

## Agent Operational Directive
> **MANDATORY**: Agents must NEVER run `cat`, `type`, `head`, `tail`, or `Get-Content` via shell tools (`run_command`). Always call the dedicated native `view_file` tool with specific `StartLine` and `EndLine` arguments.

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.