Scan codebase exports and generate CODE_INDEX.md organized by capability. Check this index before writing new functions to prevent duplication (no more formatDate2 when formatDate exists).
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Update Code Index?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/brain-bootstrap-update-code-index)
---
name: update-code-index
description: Scan codebase exports and generate CODE_INDEX.md organized by capability. Check this index before writing new functions to prevent duplication (no more formatDate2 when formatDate exists).
---
# Update Code Index Skill
Scan source files for all exported functions, classes, hooks, and components. Generate `CODE_INDEX.md` as a "check before write" safety net.
> ⚠️ **Before writing any new function**, check `CODE_INDEX.md` for existing similar ones. Found a match? Use or extend it instead of creating a duplicate.
## Steps
### 1. Identify Source Directories
```bash
ls -d src/ lib/ app/ core/ 2>/dev/null || true
```
### 2. Scan for Exports
**TypeScript / JavaScript:**
```bash
grep -rn 'export function\|export const\|export class\|export default' \
. --include='*.ts' --include='*.tsx' --include='*.js' --include='*.jsx' \
--exclude-dir=node_modules --exclude-dir=dist --exclude-dir=build \
--exclude-dir='.next' --exclude-dir=coverage 2>/dev/null | head -200
```
**Python:**
```bash
grep -rn '^def \|^async def \|^class ' \
. --include='*.py' \
--exclude-dir=__pycache__ --exclude-dir=.venv --exclude-dir=venv \
2>/dev/null | head -200
```
### 3. Categorize by Capability
| Category | Match on name or description |
|----------|------------------------------|
| Date / Time | date, time, format, parse, duration, timestamp |
| Validation | validate, is*, check, verify, sanitize |
| API clients | fetch, get, post, put, delete, request, client |
| Auth | auth, login, logout, session, token, permission |
| Database | db, query, find, create, update, delete, repo |
| React Hooks | `use*` exports in `.tsx` files |
| Components | PascalCase exports in `.tsx` / `.jsx` |
| Utilities | helper, util, common (catch-all) |
### 4. Write CODE_INDEX.md
```markdown
# Code Index
*Auto-generated by /update-code-index — [TIMESTAMP]*
> Check this before writing new code. Find a match? Use or extend it instead.
## [Category]
- `functionName()` — src/path/to/file.ts:LINE — what it does in one line
```
### 5. Report Summary
- Total exports scanned (by language)
- ⚠️ Potential duplicates — same-purpose functions with different names in different files
- Functions/classes missing docstrings (warn, don't block)
Close with: "CODE_INDEX.md updated. I'll check it before writing any new code."