cache-refresh
Skill0 starsChanged 5 months agoMITView on GitHub
Keeps idev skill caches fresh after source files are created, deleted, or renamed. Use after structural file changes or when the user says refresh caches.
In this repository38 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-contract-validationSkill
- architecture-scannerSkill
- auto-approve-policySkill
- auto-learningSkill
- backend-patternsSkill
- branch-syncSkill
- browser-testSkill
- browseSkill
- build-checkSkill
- codebase-explainerSkill
- coding-standardsSkill
- commit-styleSkill
- context-switchingSkill
- continuous-learningSkill
- db-preflightSkill
- env-preflightSkill
- eval-harnessSkill
- feature-completenessSkill
- file-indexSkill
- frontend-patternsSkill
- function-extractSkill
- idev-initSkill
- import-graphSkill
- lessons-learnedSkill
- post-creation-verifySkill
- pre-ship-verifySkill
- project-mapSkill
- self-reviewSkill
- session-resumeSkill
- skill-benchmarkSkill
- skilloptSkill
- smart-contextSkill
- strategic-compactSkill
- task-journalSkill
- tdd-workflowSkill
- test-coverageSkill
- test-mapSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 12 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Keep all skill caches fresh by detecting when source files change and triggering targeted cache updates.
- Distinctive: line 12
Incremental: After Claude creates, deletes, or renames a file during a task
- Distinctive: line 13
Full refresh: When user says "refresh caches" or when caches are older than 7 days
- Distinctive: line 29
After Claude creates, renames, or deletes a source file, determine which caches are affected:
- Distinctive: line 78
When a refresh is requested (or the session-start hook has flagged old caches), check what is actually stale:
- Distinctive: line 100
When triggered by user ("refresh caches") or expiry:
- Distinctive: line 112
Run these as parallel agents for speed.
- Distinctive: line 134
Do NOT rescan everything after a single file change — use incremental updates
- Distinctive: line 135
Do NOT skip cache updates after creating files — stale caches cause real bugs
- Distinctive: line 136
Do NOT run a full refresh every time caches are mentioned — only when actually stale
- Distinctive: line 137
Do NOT update caches for non-source file changes (.md, .txt, config)
- Distinctive: line 138
Do NOT block the user's task to refresh — update in the background when possible
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cache Refresh Skill
Purpose
Keep all skill caches fresh by detecting when source files change and triggering targeted cache updates. Prevents stale data from causing wrong file paths, missing registrations, or outdated function line numbers.
Activation
- Incremental: After Claude creates, deletes, or renames a file during a task
- Full refresh: When user says "refresh caches" or when caches are older than 7 days
Note: skills do not run at session start. The session-start hook surfaces cache ages; this skill defines what to do when the user or another skill asks for a refresh (for example, after the hook reports stale caches).
How It Works
This skill does NOT use a file watcher daemon. Instead, it hooks into Claude's own actions — every time Claude creates or modifies a file, this skill updates the relevant caches incrementally.
Phase 1: Track File Changes During Session
After Claude creates, renames, or deletes a source file, determine which caches are affected:
File change → Affected caches:
New .cs file (Entity) → file-index, backend-patterns (Function Index), post-creation-verify
New .cs file (Controller) → file-index, architecture-scanner (apiRoutes), backend-patterns
New .cs file (Service) → file-index, backend-patterns
New .tsx/.ts file → file-index, frontend-patterns (Function Index)
New .service.ts file → file-index, architecture-scanner (apiRoutes)
New .hook.ts file → file-index, frontend-patterns
New route added → architecture-scanner, file-index
DI registration changed → post-creation-verify (registration points may shift)
DbContext changed → post-creation-verify (registration points may shift)
Any file deleted → file-index (remove entry), pattern cache Function Index (remove entry)Phase 2: Incremental Update Rules
After creating a new feature:
1. Add new files to file-index/index.md under the correct feature section
2. Add new API routes to architecture-scanner/cache.json apiRoutes
3. Add new function entries to pattern cache Function Index sections
4. Update post-creation-verify registration points if DI/DbContext files were modified
5. Update session-resume recentFiles.modified list
6. Update task-journal with completed taskAfter modifying an existing file:
1. If function was added/removed → update Function Index entries
2. If DI file was modified → update post-creation-verify registration points
3. If route was added → update architecture-scanner apiRoutesAfter deleting a file:
1. Remove from file-index
2. Remove from architecture-scanner apiRoutes (if controller/service)
3. Remove function entries from the pattern cache Function IndexPhase 3: Staleness Detection
When a refresh is requested (or the session-start hook has flagged old caches), check what is actually stale:
1. Read each cache's "generated" date
2. If older than 7 days → mark for full refresh
3. If git is available: run `git log --since="CACHE_DATE" --name-only --pretty=format:""`
→ Get list of files changed since cache was generated
→ If changed files overlap with cached paths → mark for targeted refresh
4. If no git: compare cache date onlyStaleness levels:
Fresh (< 1 day old, no conflicting changes): Use as-is
Stale (1-7 days, minor changes): Incremental update
Expired (> 7 days): Full rescanPhase 4: Full Refresh
When triggered by user ("refresh caches") or expiry:
1. Regenerate file-index/index.md (scan all features)
2. Regenerate architecture-scanner/cache.json (scan routes)
3. Regenerate backend-patterns function-index (scan key files)
4. Regenerate frontend-patterns function-index (scan key files)
5. Regenerate post-creation-verify/cache.json (rescan DI line numbers)
6. Regenerate build-check/cache.json (rescan build commands)
7. Update all "generated" datesRun these as parallel agents for speed.
Phase 5: Integration
After every file creation/modification by Claude:
1. cache-refresh determines which caches are affected
2. Updates them incrementally (add/remove entries)
3. No full rescan needed for single-file changes
When the session-start hook reports cache ages:
1. If a refresh is warranted, run the staleness check (~1 grep command)
2. If stale → targeted refresh
3. If fresh → use as-isAnti-Patterns
- Do NOT rescan everything after a single file change — use incremental updates
- Do NOT skip cache updates after creating files — stale caches cause real bugs
- Do NOT run a full refresh every time caches are mentioned — only when actually stale
- Do NOT update caches for non-source file changes (.md, .txt, config)
- Do NOT block the user's task to refresh — update in the background when possible
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

