storage-debug-instrumentation
БесплатноБез исполняемых скриптовНе проверенAdd comprehensive debugging and observability tooling for backend storage layers (PostgreSQL, ChromaDB) and startup metrics. Includes storage drift detection…
от aiskillstore★ 509 звёзд на GitHubОб этом скилле
Storage Debug Instrumentation
Purpose
Enable rapid diagnosis of storage state, synchronization health, and backend performance bottlenecks by exposing:
- Raw article inspection from both PostgreSQL and ChromaDB
- Storage drift detection (missing/dangling entries)
- Detailed startup timeline breakdown (DB init, cache preload, vector store, RSS refresh)
- One-page debug dashboard consolidating all diagnostics
Scope
- Backend:
app/services/startup_metrics.py,app/main.py,app/vector_store.py,app/database.py,app/api/routes/debug.py - Frontend:
frontend/lib/api.ts,frontend/app/debug/page.tsx - No schema changes; purely additive instrumentation and debug routes
Workflow
1. Create startup metrics service
File: backend/app/services/startup_metrics.py
- Implement thread-safe
StartupMetricsclass to record phase timings - Expose
record_event(name, started_at, detail, metadata)for phase capture - Support
add_note(key, value)for arbitrary annotations - Export singleton
startup_metricsfor app-wide use
2. Instrument vector store initialization
File: backend/app/vector_store.py
- Import
startup_metrics - In
VectorStore.__init__(), wrap initialization withtime.time()timer - Record event with metadata:
host,port,collection,documents - Catch connection errors and annotate them
3. Instrument FastAPI startup sequence
File: backend/app/main.py
- Call
startup_metrics.mark_app_started()at beginning ofon_startup() - Wrap each phase (DB init, schedulers, cache preload, RSS refresh, migration) with
record_event() - Include metadata:
cache_size,article_count,oldest_article_hours - Call
startup_metrics.mark_app_completed()at end - Add app version notes via
add_note()
4. Add database pagination helpers
File: backend/app/database.py
- Implement
fetch_articles_page()to support:- Limit/offset pagination
- Optional source filter
- Missing-embeddings-only flag
- Published date range filters
- Sort direction (asc/desc)
- Return oldest/newest timestamp bounds
- Implement
fetch_article_chroma_mappings()to return all article→chroma ID mappings for drift analysis
5. Add vector store pagination helpers
File: backend/app/vector_store.py
- Implement
list_articles(limit, offset)to return paginated Chroma documents with metadata and previews - Implement
list_all_ids()to return all stored Chroma IDs for drift detection (used by/debug/storage/drift)
6. Expose debug API endpoints
File: backend/app/api/routes/debug.py
- Add
GET /debug/startup→ returns startup metrics timeline (events + notes) - Add
GET /debug/chromadb/articles→ returns paginated raw Chroma entries with limit/offset - Add
GET /debug/database/articles→ returns paginated Postgres rows with filters (source, embeddings, date range, sort) - Add
GET /debug/storage/drift→ compares Chroma IDs vs Postgres mappings, returns missing/dangling counts + samples
7. Add frontend API bindings
File: frontend/lib/api.ts
- Export types:
StartupEventMetric,StartupMetricsResponse,ChromaDebugResponse,DatabaseDebugResponse,StorageDriftReport - Export fetchers:
fetchStartupMetrics(),fetchChromaDebugArticles(),fetchDatabaseDebugArticles(),fetchStorageDrift() - Ensure snake_case→camelCase mapping for response fields
8. Build debug dashboard page
File: frontend/app/debug/page.tsx
- Create
/debugroute with multi-tab inspection UI - Render startup timeline: phase name, duration, metadata badges (cache size, vectors, migrated records)
- Display Chroma browser: paginated table with ID, title, source, preview
- Display Postgres browser: paginated table with filters (source, date range, missing-embeddings-only flag)
- Display drift report: sample tables for missing-in-chroma and dangling-in-chroma entries
- Include summary cards for quick metrics (boot time, total articles, vector count, drift count)
Implementation checklist
- Create
backend/app/services/startup_metrics.py - Instrument
backend/app/vector_store.py::VectorStore.__init__() - Instrument
backend/app/main.py::on_startup()(all phases) - Add
fetch_articles_page()andfetch_article_chroma_mappings()tobackend/app/database.py - Add
list_articles()andlist_all_ids()tobackend/app/vector_store.py - Add
/debug/startup,/debug/chromadb/articles,/debug/database/articles,/debug/storage/drifttobackend/app/api/routes/debug.py - Add types and fetchers to
frontend/lib/api.ts - Create
frontend/app/debug/page.tsxwith dashboard layout - Run
uvx ruff check backend→ all checks pass - Test endpoints in curl or Postman to verify response structure
Verification checklist
-
GET http://localhost:8000/debug/startupreturns valid timeline with events and notes -
GET http://localhost:8000/debug/chromadb/articles?limit=50&offset=0returns paginated Chro
Установить storage-debug-instrumentation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл storage-debug-instrumentation?
Add comprehensive debugging and observability tooling for backend storage layers (PostgreSQL, ChromaDB) and startup metrics. Includes storage drift detection, raw data inspection endpoints, and a Next.js admin dashboard.
Как установить скилл storage-debug-instrumentation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл storage-debug-instrumentation запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic