implement-caching-strategy — команда для Claude Code: кэш в проекте
Слэш-команда для Claude, которая разбирает архитектуру проекта и предлагает слои кэширования: браузер, приложение, база, API.
npx claude-code-templates@latest --command performance/implement-caching-strategyЧто делает implement-caching-strategy
Команда implement-caching-strategy проводит агента по десяти шагам: сначала анализ архитектуры и узких мест, потом браузерный кэш, кэш на уровне приложения, кэширование запросов к базе, ответов API, инвалидация, мониторинг и тесты. Аргумент задаёт область работы: [cache-type], --browser, --application или --database.
Внутри — только инструкции для модели, отдельных скриптов нет. Агент работает инструментами Read, Bash, Grep, Glob: читает код, ищет места с дорогими запросами, правит конфиги. Поэтому на проекте без доступа к файловой системе или с закрытым репозиторием команда ничего не сделает.
Стратегию команда выбирает по коду, а не по вашим догадкам. Если в проекте уже есть Redis или Memcached, она отталкивается от них; если нет — предложит вариант и объяснит, что придётся поднять. Проверьте предложенную схему инвалидации до того, как катить её в прод: именно там чаще всего ломается консистентность данных.
Какие задачи решает
- найти в проекте места, где кэш даст выигрыш
- настроить HTTP-заголовки и политики кэша для статики
- подобрать TTL и схему инвалидации для данных
- закэшировать дорогие запросы к базе
- собрать метрики попаданий и промахов кэша
Примеры запросов агенту
- /implement-caching-strategy --application
- /implement-caching-strategy --database
- /implement-caching-strategy --browser
Как установить implement-caching-strategy
1Через claude-code-templates
npx claude-code-templates@latest --command performance/implement-caching-strategy2Вручную: положить файлы
.claude/commands/implement-caching-strategy.mdВызов — /implement-caching-strategy. Для всех проектов — ~/.claude/commands/
Вручную: положить файлы
~/.codex/prompts/implement-caching-strategy.mdВызов — /prompts:implement-caching-strategy. В Codex этот формат помечен устаревшим, замена — скиллы
Вручную: положить файлы
.github/prompts/implement-caching-strategy.prompt.mdВручную: положить файлы
.gemini/commands/implement-caching-strategy.tomlGemini хранит команды в TOML: текст запроса — в поле prompt
Из того же набора205
Весь набор →Похожие
Рядом в теме «Бэкенд и API»
Все слэш-команды по теме «Бэкенд и API» →Вопросы о implement-caching-strategy
Как установить implement-caching-strategy в Claude?
Выполните npx claude-code-templates@latest --command performance/implement-caching-strategy, затем проверьте, что файл появился по пути .claude/commands/implement-caching-strategy.md.
Что делает implement-caching-strategy?
Разбирает архитектуру проекта и предлагает слои кэширования: браузер, CDN, приложение, база, ответы API. Отдельно проходит инвалидацию, прогрев, мониторинг и тесты.
Какие инструменты нужны команде?
В frontmatter разрешены Read, Bash, Grep, Glob. Этого хватает, чтобы читать код, искать узкие места и править конфиги.
Исходный текст
implement-caching-strategy.md · MIT
---
allowed-tools: Read, Bash, Grep, Glob
argument-hint: "[cache-type] | --browser | --application | --database"
description: Design and implement comprehensive caching solutions for improved performance and scalability
---
# Implement Caching Strategy
Design and implement caching solutions: **$ARGUMENTS**
## Instructions
1. **Caching Strategy Analysis**
- Analyze application architecture and identify caching opportunities
- Assess current performance bottlenecks and data access patterns
- Define caching requirements (TTL, invalidation, consistency)
- Plan multi-layer caching architecture (browser, CDN, application, database)
- Evaluate caching technologies and storage solutions
2. **Browser and Client-Side Caching**
- Configure HTTP caching headers and cache policies for static assets
- Implement service worker caching strategies for progressive web apps
- Set up browser storage caching (localStorage, sessionStorage, IndexedDB)
- Configure CDN caching rules and edge optimization
- Implement cache-first, network-first, and stale-while-revalidate strategies
3. **Application-Level Caching**
- Implement in-memory caching for frequently accessed data
- Set up distributed caching with Redis or Memcached
- Design cache key naming conventions and namespacing
- Implement cache warming strategies for critical data
- Configure cache expiration and TTL policies
4. **Database Query Caching**
- Implement query result caching for expensive database operations
- Set up prepared statement caching and connection pooling
- Design cache invalidation strategies for data consistency
- Implement materialized views for complex aggregations
- Configure database-level caching features and optimizations
5. **API Response Caching**
- Implement API endpoint response caching with appropriate headers
- Set up middleware for automatic response caching
- Configure GraphQL query caching and field-level optimization
- Implement conditional requests with ETag and Last-Modified headers
- Design cache invalidation for API data updates
6. **Cache Invalidation Strategies**
- Design intelligent cache invalidation based on data dependencies
- Implement event-driven cache invalidation systems
- Set up cache tagging and bulk invalidation mechanisms
- Configure time-based and trigger-based invalidation policies
- Implement cache versioning and rollback strategies
7. **Frontend Caching Strategies**
- Implement client-side data caching with libraries like React Query
- Set up component-level caching and memoization
- Configure asset bundling and chunk caching strategies
- Implement progressive image loading and caching
- Set up offline-first caching for PWAs
8. **Cache Monitoring and Analytics**
- Set up cache performance monitoring and metrics collection
- Track cache hit rates, miss rates, and efficiency metrics
- Monitor cache memory usage and storage optimization
- Implement cache performance alerting and notifications
- Analyze cache usage patterns and optimization opportunities
9. **Cache Warming and Preloading**
- Implement automated cache warming for critical data
- Set up scheduled cache refresh and preloading strategies
- Design on-demand cache generation for popular content
- Configure cache warming triggers based on usage patterns
- Implement predictive caching based on user behavior
10. **Testing and Validation**
- Set up cache performance testing and benchmarking
- Implement cache consistency validation and testing
- Configure cache invalidation testing scenarios
- Test cache behavior under high load and failure conditions
- Validate cache security and data isolation requirements
Focus on implementing caching strategies that provide the most significant performance improvements while maintaining data consistency and system reliability. Always measure cache effectiveness and adjust strategies based on real-world usage patterns.
© davila7 · MIT · davila7/claude-code-templates