Skip to content

Guide · Agent skill

How to use the Sentence Transformers agent skill: setup and examples

Updated · written with AI from the project's own documentation and checked against our catalogue data

The Sentence Transformers skill teaches an AI agent how to use the sentence-transformers Python library to turn sentences and documents into numerical vectors (embeddings) that capture meaning. It is aimed at developers and data people who want to build semantic search, retrieval-augmented generation (RAG) or text similarity features using models that run locally. After reading this guide you will know what the skill does, how to install it, how to phrase requests so the agent uses it, and what you need on your machine before running the code it writes.

Sentence Transformers EmbeddingsOrchestra-Research/AI-Research-SKILLs · MIT

Quick start

  1. 1Download the ZIP. Download the skill ZIP from this page and unzip it.
  2. 2Place the folder. Move the sentence-transformers folder into ~/.claude/skills/ or your project's .claude/skills/ folder, or upload the ZIP under Settings → Capabilities → Skills in the Claude apps.
  3. 3Install the library. Run pip install sentence-transformers in a Python environment. This also installs transformers and torch.
  4. 4Make a natural request. Describe your embedding or semantic search task in plain language, mentioning your data and what you want back.
  5. 5Review and run the code. Read the generated script, then run it. The first run downloads the model from Hugging Face.

What is an agent skill and what does this one do?

An agent skill is a folder containing a SKILL.md file with instructions, and optionally reference files, that an AI agent loads when a task matches the skill's description. This skill is for the sentence-transformers library, a Python framework for sentence, text and image embeddings.

Once installed, the agent can write Python code that loads pre-trained models, compares how similar texts are, runs semantic search over a collection, fine-tunes a model, and plugs embeddings into LangChain or LlamaIndex pipelines. The models run locally rather than through a paid API.

  • Load a pre-trained model such as all-MiniLM-L6-v2 and encode text into vectors
  • Compute cosine similarity or dot product between embeddings
  • Run semantic search over a corpus with util.semantic_search
  • Fine-tune a model on your own labelled sentence pairs
  • Connect embeddings to LangChain (Chroma) or LlamaIndex

Install the Sentence Transformers skill

Download the skill ZIP from this page and unzip it. For a personal setup, place the unzipped sentence-transformers folder in ~/.claude/skills/. For a single project, place it in that project's .claude/skills/ folder instead.

In the Claude apps you can instead upload the ZIP under Settings → Capabilities → Skills.

  • Personal: ~/.claude/skills/sentence-transformers/
  • Project: .claude/skills/sentence-transformers/ inside your project

Install the Python package the skill relies on

The skill writes code that needs the sentence-transformers package. Install it with pip. This also pulls in transformers and torch. Models are downloaded from Hugging Face on first use, so you need internet access the first time a model loads.

  • Python is required
  • Optional for integration examples: langchain-community, langchain-chroma or llama-index
pip install sentence-transformers

How do you trigger the skill with a natural request?

You do not need a special command. Describe the task in plain language that mentions embeddings, semantic search, similarity, clustering or RAG, and the agent should load the skill when it matches the description. Naming the library or a model makes the match more likely.

Good requests say what the input is, what you want back and where it should run. For example, ask for a script that embeds your text files and returns the top matches for a question.

  • "Write a Python script that embeds my support articles with all-MiniLM-L6-v2 and returns the three most similar ones to a query."
  • "Cluster these 5,000 customer comments by topic using a local sentence-transformers model."
  • "Set up a Chroma vector store with sentence-transformers embeddings for my docs folder."
  • "Use a multilingual sentence-transformers model to search German and English product descriptions."

Choose a model

The skill's model guide recommends all-MiniLM-L6-v2 as a default for prototyping and general tasks. It is fast and produces 384-dimension vectors. all-mpnet-base-v2 produces 768 dimensions and is described as better quality for production RAG. all-roberta-large-v1 gives the best quality in the guide but is slower and uses 1024 dimensions.

For multilingual text, the skill points to paraphrase-multilingual models. Domain-specific models exist for legal, scientific and code text, but the skill notes that provenance varies, so check each model's source and terms before using it on sensitive data.

  • Start with all-MiniLM-L6-v2 as a baseline
  • Use all-mpnet-base-v2 when you want better quality in RAG
  • Use paraphrase-multilingual-mpnet-base-v2 for multilingual search
  • Test more than one model, since quality varies by task
model = SentenceTransformer('all-MiniLM-L6-v2')

Safety notes: scripts and network access

This skill runs scripts and uses the network. The Python code it writes will run on your machine, so read it before executing, especially code that fine-tunes models or writes files. Model weights are fetched from Hugging Face on first use, which means outbound network access is needed at that point.

If you work with sensitive data, check the licence and source of each model before you embed private documents with it. Running models locally keeps your text off third-party APIs, but it does not make an unvetted model safe.

  • Review generated code before running it
  • Expect a one-time download of model files from Hugging Face
  • Verify model licences for sensitive or commercial work

Tips for better results

Ask the agent to normalise embeddings and to cache them, since the library's best practices recommend both. Encoding in batches is more efficient than encoding one sentence at a time. If a GPU is available, the skill notes encoding can be about 10 times faster, though your speed will depend on your hardware.

Memory matters. Larger models need more RAM, and the performance table in the skill lists about 120MB for MiniLM and about 1.3GB for RoBERTa.

  • Encode in batches with a sensible batch_size
  • Save embeddings to disk so you do not recompute them
  • Ask for a small test on a few hundred documents before a full run
  • Check the reference models guide when choosing between options

What people use it for

  • Building a RAG chatbot over internal documents with local embeddings stored in Chroma
  • Finding the most similar support tickets to a new query using semantic search
  • Clustering large sets of customer comments without per-call API costs
  • Searching multilingual product catalogues with a multilingual model

Frequently asked questions

How do I install the sentence-transformers skill?

Download the skill ZIP from this page and unzip it into ~/.claude/skills/ for personal use or into a project's .claude/skills/ folder. In the Claude apps you can instead upload the ZIP under Settings → Capabilities → Skills.

What does the sentence-transformers skill require?

It requires Python and the pip package sentence-transformers, which pulls in transformers and torch. It also needs internet access the first time a pre-trained model is downloaded from Hugging Face. langchain-community, langchain-chroma or llama-index are optional, for the integration examples.

Is sentence-transformers free to use?

The skill is listed under the MIT licence. The sentence-transformers library runs models locally, so you avoid per-call API fees. Individual models downloaded from Hugging Face may have their own terms, so check those before commercial or sensitive use.

What are the alternatives to Sentence Transformers?

The skill itself points to OpenAI Embeddings for API-based, highest-quality embeddings, Instructor for task-specific instructions, and Cohere Embed as a managed service. Choose one of these if you need the highest possible quality from a hosted service and do not mind sending data to a provider.

Why does my sentence-transformers code download a model the first time?

The library fetches pre-trained model weights from Hugging Face on first use. If the download fails, check that your machine has internet access. After the first download, the model is used locally.

Can it handle languages other than English?

Yes. The skill describes multilingual models such as paraphrase-multilingual-MiniLM-L12-v2 and paraphrase-multilingual-mpnet-base-v2, and the reference guide lists LaBSE for 109 languages. Test any model on your own language data before relying on it.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you are a developer or data person who wants an agent to write local embedding code for semantic search, RAG or clustering, and you are comfortable running Python. Skip it if you want a finished search app with no code, or if you need the highest possible quality from a managed service, where the skill itself suggests OpenAI or Cohere.

Download the skill