Skip to content
Back to skills

Context Retrieval Loop

ASecurity

Use when about to refactor, rename, or remove code, assessing dead code before deletion, or unsure of the blast radius of a change.

  • 6 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 6, 2026
ai-agentsbashapi

Works with

  • api

Security analysis

A100/100

Scanned September 6, 2026

npx -y skills add yeaight7/agent-powerups --skill context-retrieval-loop --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Context Retrieval Loop?

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

Security grade badge for Context Retrieval Loop
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/yeaight7-context-retrieval-loop-eae47497/badge)](https://www.skillsdirectory.com/skills/yeaight7-context-retrieval-loop-eae47497)

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: context-retrieval-loop
description: Use when about to refactor, rename, or remove code, assessing dead code before deletion, or unsure of the blast radius of a change.
---

# Context Retrieval Loop (Codebase Maintenance)

Gather context before any refactor or maintenance task. Prevents breaking undetected callers or missing test coverage.

## When to Use

- About to refactor, rename, or remove code
- Assessing dead code before deletion
- Unsure of the blast radius of a change

## The 3-Cycle Loop

### Cycle 1 — Broad Search

```bash
# Find callers and references
rg "<symbol-name>" --type ts --type js -l
rg "<symbol-name>" --glob "*.py" -l
```

Stop here if you can confirm the symbol is unused (no results).

### Cycle 2 — Exact Source and Tests

Read the target file and its tests. Find all callers:

```bash
rg "import.*<module>" -l
rg "<function-name>" --glob "*.test.*" -l
```

Stop here if you understand the change scope and existing test coverage.

### Cycle 3 — Config and Build

```bash
# Check if symbol appears in build or config
rg "<symbol-name>" *.config.* tsconfig.json Makefile -l 2>/dev/null
```

Check for re-exports, barrel files, and public API surfaces.

## Output

```
Context gathered:
  <file-path> — <reason>

Blast radius:
  <N> callers in <N> files
  Tests covering this code: <yes/no/partial>

Missing context (if any):
  <what is still unclear>
```

Do not start a refactor without knowing the blast radius. If callers are unclear after Cycle 3, stop and report.

## Verification

- [ ] Cycles ran in order and stopped at the first satisfied condition — never past 3
- [ ] Blast radius is reported: caller count, files affected, test coverage status
- [ ] Re-exports, barrel files, and public API surfaces were checked before concluding
- [ ] No refactor started while callers remained unclear — stopped and reported instead

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…