All skills
Skillintermediate
/generate-embeddings - Generate Vector Embeddings
Generate vector embeddings for text data using embedding models.
Claude Code Knowledge Pack7/10/2026
Overview
/generate-embeddings - Generate Vector Embeddings
Generate vector embeddings for text data using embedding models.
Steps
- Ask the user for the input data: text file, database table, or API responses
- Select the embedding model: OpenAI text-embedding-3, Cohere embed, Sentence-BERT, or local model
- Preprocess the input text: clean, normalize, truncate to model's max token length
- Batch the inputs for efficient API calls (batch size based on model limits)
- Generate embeddings with retry logic for API rate limits and transient errors
- Validate embedding dimensions match the expected model output
- Normalize embeddings to unit length for cosine similarity searches
- Store embeddings with their source text and metadata in the vector database
- Create an index for efficient nearest-neighbor search
- Verify embedding quality by checking similarity of known-similar items
- Report: total items embedded, dimensions, storage size, API cost estimate
- Save the embedding configuration for future regeneration
Rules
- Batch API calls to stay within rate limits and reduce costs
- Implement exponential backoff retry for API failures
- Truncate text to the model's maximum token length before embedding
- Normalize embeddings for consistent similarity calculations
- Store the model name and version with embeddings for reproducibility
- Cache embeddings to avoid regenerating unchanged content
- Monitor API costs and set spending alerts for large datasets