---
name: gsd-context-fetch-2a13798e85ab
description: Search-first skill to reduce unnecessary file reads by searching before loading. Promotes context-efficient exploration through targeted reading and identifier searches.
---

# GSD Context Fetch

## Role
You are a context-efficient agent. Your job is to find relevant code with minimal file reads. **Core principle:** Search first, read targeted sections, never load full files blindly.

## When to Use
Activate this skill **before**:
- Starting any coding task
- Beginning a refactor
- Investigating a bug
- Understanding unfamiliar code

## Process

### Step 1: Define the Question
What are you trying to find or understand?
Examples:
- "Where is the login endpoint defined?"
- "How does the caching layer work?"
- "What calls the `processPayment` function?"

### Step 2: Identify Keywords
Extract searchable terms:

| Question | Keywords |
|----------|----------|
| Login endpoint | `login`, `auth`, `POST.*login` |
| Caching layer | `cache`, `redis`, `memoize` |
| Payment calls | `processPayment`, `payment` |

### Step 3: Search Before Reading

**PowerShell:**
```powershell
# Simple pattern search
Select-String -Path "src/**/*.ts" -Pattern "login" -Recurse

# With ripgrep (if available)
rg "login" --type ts
```

**Bash:**
```bash
# With ripgrep (recommended)
rg "login" --type ts

# With grep
grep -r "login" src/ --include="*.ts"
```

### Step 4: Evaluate Results
From search results, identify:
1. **Primary candidates** — Files directly matching your question
2. **Secondary candidates** — Files that reference primary candidates
3. **Ignore list** — Files with keyword but unrelated context

### Step 5: Targeted Reading
Only read what's justified:

```powershell
# Read specific line range (PowerShell)
Get-Get-Content "src/auth/login.ts" | Select-Object -Skip 49 -First 30

# Read specific function (with view_code_item tool)
# view_code_item: src/auth/login.ts -> handleLogin
```

## Inputs
When invoking this skill, provide:

| Input | Description | Example |
|-------|-------------|---------|
| **Question** | What you're trying to find | "Where is user validation?" |
| **Scope** | Directory or file pattern | `src/`, `*.service.ts` |
| **Keywords** | Terms to search for | `validate`, `user`, `schema` |

## Outputs
After executing this skill, report:
1. **Candidate files** — Ranked by relevance
2. **Relevant extracts** — Key snippets found
3. **Next reads** — Specific files/line-ranges to read next
4. **Skip list** — Files searched but not relevant

## Anti-Patterns

### ❌ Loading Everything First
```
# BAD: Reading 5 full files to "understand context"
Read: src/auth/login.ts (500 lines)
Read: src/auth/register.ts (400 lines)
Read: src/auth/types.ts (200 lines)
```

### ✅ Search Then Target
```
# GOOD: Search first, read only what's needed
Search: "validatePassword" in src/auth/
Found: login.ts:45, register.ts:78
Read: login.ts lines 40-60
```

### ❌ Broad Searches
```
# BAD: Searching for common terms
Search: "function" → 10,000 results
```

### ✅ Specific Searches
```
# GOOD: Searching for specific identifiers
Search: "validateUserCredentials" → 3 results
```

---

*Part of GSD methodology. See PROJECT_RULES.md for search-first discipline rules.*

---
Source attribution: SriSatyaLokesh
Original project: https://github.com/SriSatyaLokesh/copilot-team-workflow
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 Gabriel Moreira

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: SriSatyaLokesh
Original project: https://github.com/SriSatyaLokesh/copilot-team-workflow
Attribution basis: Upstream repository explicitly recorded in package mirror path

Fields of work: Data & Analytics, Development & Engineering, Product Management
Roles: Backend Developer, Data Analyst, Full-Stack Developer, Product Manager, QA / Test Engineer
Specialties: API, Backend
Tools: Grep, Ripgrep, View_Code_Item
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 8cd682b61e8113013a5162b7ba478478af9371543af0e61e0ac9647dff53029e
