Find and read multiple files in one operation (50-70% faster for exploration)
View on GitHubSelect agents to install to:
npx add-skill https://github.com/cowwoc/cat/blob/main/plugin/skills/grep-and-read/SKILL.md -a claude-code --skill grep-and-readInstallation paths:
.claude/skills/grep-and-read/# Grep and Read Skill **Purpose**: Search for pattern and read all matching files in a single coordinated operation, eliminating sequential round-trips. **Performance**: 50-70% time savings, 4000-8000 token savings compared to sequential Grep -> Read -> Read -> Read pattern. **When to Use**: - Exploring codebase for specific functionality - Finding all files containing a pattern - Researching implementation approaches - Investigating errors or bugs across multiple files ## Anti-Pattern This Skill Replaces **INEFFICIENT PATTERN** (4 messages, 9-12 seconds): ``` Message 1: Grep "FormattingRule" -> returns 5 files [Wait for response ~2.5s] Message 2: Read src/main/java/.../FormattingRule.java [Wait for response ~2.5s] Message 3: Read src/test/java/.../FormattingRuleTest.java [Wait for response ~2.5s] Message 4: Read docs/architecture.md [Wait for response ~2.5s] -> Impact: 4 round-trips = ~10 seconds, ~12,000 tokens -> Wasted: 3 avoidable round-trips ``` **EFFICIENT PATTERN** (1 message, 3-4 seconds): ``` Message 1: Skill grep-and-read pattern="FormattingRule" max_files=5 - Grep finds matches - Read all matching files in parallel - Return consolidated output [Wait for response ~3.5s] -> Impact: 1 round-trip = ~3.5 seconds, ~4,000 tokens -> Saved: 3 round-trips = 6.5 seconds (65% faster), 8,000 tokens ``` ## Skill Parameters | Parameter | Required | Default | Description | |-----------|----------|---------|-------------| | `pattern` | Yes | - | Grep pattern to search for (regex supported) | | `path` | No | `.` | Directory to search in | | `glob` | No | - | File type filter (e.g., "*.java", "*.md") | | `max_files` | No | 5 | Maximum number of files to read | | `context_lines` | No | 100 | Lines to read per file (0 = all) | | `case_sensitive` | No | true | Case-sensitive search | ## Skill Workflow ### Step 1: Search for Pattern Use Grep tool to find all files containing the pattern: ```bash # Search for pattern with optional filters Grep: