Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Vector Database

ASecurity

Work with vector databases for RAG, embeddings, and semantic search using ChromaDB or similar. Use when building knowledge bases for PSI Engine or AI-powered search.

33 stars
0 votes
0 copies
0 views
Added 2/10/2026
databasesjavascriptpythongojavabashtestingdebuggingapidatabase

Works with

cliapi

Security Analysis

A96/100
mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned 2/12/2026

$npx -y skills add lovedragonball/power-ranger-toolkit --skill vector-database --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Vector Database?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Vector Database
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/lovedragonball-vector-database/badge)](https://www.skillsdirectory.com/skills/lovedragonball-vector-database)

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

Download with Pro
Files
skill.md
---
name: vector-database
description: Work with vector databases for RAG, embeddings, and semantic search using ChromaDB or similar. Use when building knowledge bases for PSI Engine or AI-powered search.
---

# 🧮 Vector Database Skill

## ChromaDB Setup

### Installation
```bash
pip install chromadb
```

### Initialize
```python
import chromadb

# Persistent storage
client = chromadb.PersistentClient(path="./chroma_db")

# In-memory (testing)
client = chromadb.Client()

# Get or create collection
collection = client.get_or_create_collection(
    name="knowledge_base",
    metadata={"hnsw:space": "cosine"}
)
```

---

## CRUD Operations

### Add Documents
```python
collection.add(
    documents=["How to fix null pointer exception in Python"],
    metadatas=[{
        "source": "agent_1",
        "category": "debugging",
        "language": "python",
        "date": "2026-01-14"
    }],
    ids=["doc_001"]
)
```

### Query (Semantic Search)
```python
results = collection.query(
    query_texts=["null reference error"],
    n_results=5,
    where={"category": "debugging"},
    include=["documents", "metadatas", "distances"]
)

# Results
for i, doc in enumerate(results['documents'][0]):
    print(f"Score: {results['distances'][0][i]}")
    print(f"Doc: {doc}")
```

### Update
```python
collection.update(
    ids=["doc_001"],
    documents=["Updated solution for null pointer"],
    metadatas=[{"updated": True}]
)
```

### Delete
```python
collection.delete(ids=["doc_001"])
# or
collection.delete(where={"category": "outdated"})
```

---

## RAG Pattern

```python
def rag_query(question: str, context_limit: int = 5) -> str:
    # 1. Search similar documents
    results = collection.query(
        query_texts=[question],
        n_results=context_limit
    )
    
    # 2. Build context
    context = "\n\n".join(results['documents'][0])
    
    # 3. Generate answer with LLM
    prompt = f"""Based on this context:
{context}

Answer this question: {question}"""
    
    return llm.generate(prompt)
```

---

## Custom Embeddings

```python
from chromadb.utils import embedding_functions

# OpenAI
openai_ef = embedding_functions.OpenAIEmbeddingFunction(
    api_key="your-key",
    model_name="text-embedding-ada-002"
)

# Sentence Transformers (local)
st_ef = embedding_functions.SentenceTransformerEmbeddingFunction(
    model_name="all-MiniLM-L6-v2"
)

collection = client.create_collection(
    name="custom_embeddings",
    embedding_function=st_ef
)
```

---

## Filtering

```python
# Where clause
results = collection.query(
    query_texts=["error handling"],
    where={
        "$and": [
            {"category": {"$eq": "debugging"}},
            {"language": {"$in": ["python", "javascript"]}}
        ]
    }
)

# Where document (full-text)
results = collection.query(
    query_texts=["error"],
    where_document={"$contains": "exception"}
)
```

---

## PSI Engine Integration

```python
class KnowledgeHarvester:
    def __init__(self):
        self.client = chromadb.PersistentClient("./knowledge")
        self.collection = self.client.get_or_create_collection("learnings")
    
    def harvest(self, task_result: dict):
        self.collection.add(
            documents=[task_result['solution']],
            metadatas=[{
                'task': task_result['task'],
                'agent': task_result['agent_id'],
                'timestamp': datetime.now().isoformat()
            }],
            ids=[f"learning_{uuid.uuid4()}"]
        )
    
    def find_similar(self, query: str, limit: int = 5):
        return self.collection.query(
            query_texts=[query],
            n_results=limit
        )
```

Attribution

lovedragonballlovedragonball
View sourceSee grades on GitHubMore from lovedragonball →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

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 (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Mysql Best Practices

MySQL development best practices for schema design, query optimization, and database administration

2481 votes

Jpa Patterns

Spring Boot中的JPA/Hibernate实体设计、关系、查询优化、事务、审计、索引、分页和连接池模式。

2456590 votes

Clickhouse Io

ClickHouse数据库模式、查询优化、分析和数据工程最佳实践,适用于高性能分析工作负载。

2456590 votes

Postgres Patterns

基于Supabase最佳实践的PostgreSQL数据库模式,用于查询优化、架构设计、索引和安全。

2456590 votes

Sql Pro

Master modern SQL with cloud-native databases, OLTP/OLAP

458250 votes
View all in databases →