Skip to content
Back to skills

Collection

ASecurity

Computes semantic embeddings for text and measures distance between sentences. Use for semantic similarity analysis and comparing text.

  • 24 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
ai-agentspythonbashperformance

Works with

  • cli

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-8522e5b2/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-8522e5b2)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: embeddings
description: Computes semantic embeddings for text and measures distance between sentences. Use for semantic similarity analysis and comparing text.
allowed-tools: Bash, Read
---

# Embeddings Skill

This skill computes semantic embeddings for text and measures the semantic distance between sentences using sentence transformers.

## Instructions

To compute embeddings and measure distance:
1. Accept one or more sentences as input
2. Use the sentence-transformers library with the 'all-MiniLM-L6-v2' model
3. Compute embeddings (384-dimensional vectors)
4. Calculate cosine distance or Euclidean distance between embeddings
5. Return the distance metric

## What are Embeddings?

Embeddings are numerical vector representations of text that capture semantic meaning. Sentences with similar meanings have embeddings that are close together in vector space.

## Distance Metrics

### Cosine Distance
- Range: [0, 2]
- 0 = identical meaning
- 2 = opposite meaning
- Most commonly used for semantic similarity

### Euclidean Distance
- Range: [0, ∞)
- Measures straight-line distance in embedding space
- Sensitive to magnitude differences

## Python Code Usage

```python
import sys
sys.path.append('.claude/skills/embeddings')
from embedding_utils import (
    compute_embedding,
    cosine_distance,
    semantic_similarity
)

# Compute embeddings
sentence1 = "The cat sits on the mat"
sentence2 = "A feline rests on the rug"

emb1 = compute_embedding(sentence1)
emb2 = compute_embedding(sentence2)

# Calculate distance
distance = cosine_distance(emb1, emb2)
print(f"Semantic distance: {distance:.4f}")

# Or use the convenience function
distance = semantic_similarity(sentence1, sentence2, distance_metric='cosine')
```

## Usage Example

**Similar sentences:**
- Sentence 1: "The dog runs in the park"
- Sentence 2: "A canine sprints through the garden"
- Cosine Distance: ~0.15 (very similar)

**Different sentences:**
- Sentence 1: "The dog runs in the park"
- Sentence 2: "Quantum physics explains particle behavior"
- Cosine Distance: ~0.85 (very different)

## Functions Available

1. `compute_embedding(sentence)` - Get embedding vector for a sentence
2. `compute_embeddings_batch(sentences)` - Get embeddings for multiple sentences
3. `cosine_distance(emb1, emb2)` - Calculate cosine distance
4. `euclidean_distance(emb1, emb2)` - Calculate Euclidean distance
5. `semantic_similarity(sent1, sent2, metric)` - End-to-end similarity calculation

## Model Information

- Model: `all-MiniLM-L6-v2`
- Embedding dimensions: 384
- Performance: Fast and efficient
- Use case: General-purpose sentence embeddings

## Notes

- The model is loaded once and cached for efficiency
- Requires `sentence-transformers` package
- Works well for short texts (sentences, paragraphs)
- Language: Primarily English, with some multilingual capability

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…