Backend · Skill
Pick an embedding model and a chunk rule
design-embedding-model-and-chunking
Picks one embedding model and a chunk rule: match prose, code or another language, stay inside the token limit, and keep a single dimension. Use when the user is choosing an embedding model, comparing Voyage and OpenAI embeddings, or setting chunk size and overlap.
Works with: Any AI Not yet model-tested; testing Jan 2027
Paste it into ChatGPT, Claude, Gemini or any AI chat, then tell it about your project. How it works
Install in Claude Code, Cursor or Codex (optional)
Only for AI coding tools that read skill folders. Run one line in a terminal, in your project folder. It downloads this skill's text files from TheSkillVault and nothing else; you can read them first with “View raw SKILL.md”.
Claude Code (all your projects)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/design-embedding-model-and-chunking/raw' -o ~/'.claude/skills/design-embedding-model-and-chunking/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/design-embedding-model-and-chunking/files/LICENSE.txt' -o ~/'.claude/skills/design-embedding-model-and-chunking/LICENSE.txt'Cursor (this project)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/design-embedding-model-and-chunking/raw' -o '.cursor/skills/design-embedding-model-and-chunking/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/design-embedding-model-and-chunking/files/LICENSE.txt' -o '.cursor/skills/design-embedding-model-and-chunking/LICENSE.txt'Codex and other Agent Skills tools (this project)
curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/design-embedding-model-and-chunking/raw' -o '.agents/skills/design-embedding-model-and-chunking/SKILL.md' && curl -fsSL --create-dirs 'https://theskillvault.ai/api/skills/design-embedding-model-and-chunking/files/LICENSE.txt' -o '.agents/skills/design-embedding-model-and-chunking/LICENSE.txt'
Or connect the whole library over MCP
Add TheSkillVault to Cursor or add this to your app's MCP settings (read-only; help):
{
"mcpServers": {
"theskillvault": {
"url": "https://theskillvault.ai/mcp"
}
}
}An embedding model turns text into a list of numbers. Similar texts land near each other. The chunk rule decides what each list stands for. Building the store, the lookup and the answer is a different skill.
When to use
- You are choosing an embedding model for prose, code or another language.
- You need the dimension and the token cap before you embed a corpus.
- Chunks are tiny, huge, or cut in the middle of a sentence.
When not to use
- You want lookup, citations and a saved question set. Use build-rag-search-over-docs.
- You are writing the chat reply, not the index.
Steps
- Name the text. Prose, source code, finance, legal, or many languages. Pick a model aimed at that text.
- Read the current model card before you lock the choice. Dimensions and caps change. The pinned source compared these families:
- Voyage voyage-3-large or voyage-3 for general text, including Claude apps.
- About 1024 dimensions and a 32000 token cap for those two.
- voyage-code-3 for code. voyage-finance-2 and voyage-law-2 for those domains.
- OpenAI text-embedding-3-small for a cheaper index, about 1536 dimensions.
- text-embedding-3-large when you want higher accuracy, about 3072 dimensions.
- Both OpenAI models cap near 8191 tokens.
- A local model such as bge-large-en-v1.5 when text must stay on your machine.
- That local example is about 1024 dimensions, with a much shorter cap.
- Stay under the token cap. A cut-off chunk drops the ending and does not warn you.
- Split on headings or sentences. Do not slice on a raw character count. Keep the heading with the chunk.
- Add a short overlap so a boundary sentence appears twice. A 512-token chunk with about 50 tokens of overlap is only a starting point from the source.
- Use one model and one dimension for the whole index. Store the model name beside the numbers.
- Normalize the numbers if you rank by cosine. Send texts in batches. Cache a chunk that did not change.
- If you change the model or the dimension, embed every chunk again. Old and new numbers are not neighbors.
- Try a few real questions first. Check that the right passage comes back. Then hand the index to the other skill.
Gotchas
- Two models in one index do not share a space. Neighbors from a mix are meaningless.
- A tiny chunk has no context. A huge chunk matches too vaguely.
- Do not send private or confidential text to a hosted model unless that is allowed.
- Read the API key from the environment. Never paste it into code or into a prompt.
- An English-only model misses other languages. Use a multilingual model for a mixed corpus.
Portability
Works with any embedding provider. Voyage, OpenAI and a local model are examples. If you use another host, keep one model, one dimension, chunks under the cap, and a full re-embed when you switch. Lookup and answering stay in the other skill.
Done when
- One model is named, with its dimension and token cap written down.
- The chunk rule splits on headings or sentences and stays under that cap.
- A small set of real questions returns the passage you expected.
- The model name is stored with the numbers, and no API key is in the repo.
Example prompt
"Help me choose an embedding model and a chunk size for code. Compare a Voyage code model with an OpenAI embedding model. Stop before the lookup pipeline."
---
Adapted from "embedding-strategies" in wshobson/agents (MIT, Copyright (c) 2024 Seth Hobson). See LICENSE.txt.
Bundled files
Licence
Adapted from Seth Hobson (wshobson/agents, embedding-strategies) (Copyright (c) 2024 Seth Hobson), MIT License. Adapted by TheSkillVault: kept model choice and chunk rules, with the source comparison shortened to three families; dropped client code, fine-tuning and the retrieval pipeline; added a re-embed rule, gotchas and done-when. Queue name choose-embedding-model; choose is not a house verb.
Licence: MIT License. Attribution when you reuse it: Based on work by Seth Hobson (wshobson/agents, embedding-strategies) (Copyright (c) 2024 Seth Hobson, MIT License), https://github.com/wshobson/agents/tree/7e2fb559cf4b824b27f1fec49fe88f7511066d26/plugins/llm-application-dev/skills/embedding-strategies; adapted by TheSkillVault, https://theskillvault.ai