Skip to content
cccskills
FreePublished on GitHub

pgvector-search

Búsqueda semántica con Postgres + pgvector: embeddings, schema con columna vector, índices HNSW/IVFFlat, queries de similitud y RAG. Usar para implementar semantic search o retrieval sobre Postgres.

The English summary is being prepared. Showing the original description.

SebastianLuser/claude-code-arcane3 stars(GitHub 3 + cccskills 0)
Works withPostgreSQL

Run score Not tested

See how to install

Files included (1)

  • SKILL.md2.8 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

pgvector-search — Búsqueda semántica con Postgres

MANDATORY WORKFLOW

Antes de generar o modificar código/schema, completar estos pasos en orden.

Step 0: Gather Requirements

  1. Modelo de embeddings y dimensión (ej: OpenAI text-embedding-3-small = 1536; Cohere = 1024)
  2. Volumen de vectores (define el índice: HNSW para alta recall, IVFFlat para datasets grandes/escritura frecuente)
  3. Métrica de distancia: cosine (<=>, default para texto) / L2 (<->) / inner product (<#>)
  4. ¿Es para RAG (retrieval + LLM) o solo ranking de similitud?

Step 1: Habilitar extensión + schema

CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE documents (
  id bigserial PRIMARY KEY,
  content text NOT NULL,
  embedding vector(1536) NOT NULL,
  metadata jsonb
);

Step 2: Índice

-- HNSW: mejor recall/latencia, recomendado por defecto
CREATE INDEX ON documents USING hnsw (embedding vector_cosine_ops);
-- IVFFlat (alternativa para datasets muy grandes): definir lists ≈ rows/1000

Step 3: Insertar embeddings

Generar el embedding del content con el modelo y guardarlo. (Si usás Next + AI SDK, ver skill ai-sdk-setup.)

const { embedding } = await embed({ model, value: content });
await sql`INSERT INTO documents (content, embedding) VALUES (${content}, ${JSON.stringify(embedding)})`;

Step 4: Query de similitud

SELECT content, 1 - (embedding <=> $1) AS similarity
FROM documents
ORDER BY embedding <=> $1   -- usa el índice
LIMIT 5;

Step 5: Buenas prácticas

  • Chunking del contenido antes de embeddear (no documentos enteros)
  • Filtrar por metadata (jsonb) + similitud para hybrid search
  • SET hnsw.ef_search para tunear recall vs latencia
  • Re-embeddear si cambia el modelo (la dimensión debe matchear)
  • No mezclar embeddings de modelos distintos en la misma columna

Cierre

Verificar que el índice se usa (EXPLAIN ANALYZE debe mostrar Index Scan, no Seq Scan) y medir recall/latencia con queries reales. Schema + índice + query validados → setup READY. Confirmar cambios de schema con el usuario antes de aplicarlos. Siguiente paso: skill ai-sdk-setup para generar embeddings, o database-indexing para tuning.


Inspirado en postgres-semantic-search de laguagu/claude-code-nextjs-skills. Adaptado al formato Arcane. Relacionado: skill database-indexing.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Plan, design, and implement A/B tests and experiments with statistical rigor. Covers hypothesis frameworks, sample sizing, metrics, and result analysis.

The English summary is being prepared. Showing the original description.

SebastianLuser/claude-code-arcane3Updated Oct 27, 2026

Web/mobile accessibility decision guide: WCAG 2.2 AA, ARIA, keyboard nav, focus management, contrast, testing. Use for: a11y, accessibility, wcag, aria, screen reader, keyboard, contrast.

The English summary is being prepared. Showing the original description.

SebastianLuser/claude-code-arcane3Updated Oct 27, 2026

Generate, iterate, and scale ad creative for paid advertising across Google, Meta, LinkedIn, and X. Covers platform specs, creative frameworks, and quality validation.

The English summary is being prepared. Showing the original description.

SebastianLuser/claude-code-arcane3Updated Oct 27, 2026

Musica interactiva para juegos: layering vertical, re-secuenciacion horizontal, stingers, reglas de transicion con sync points, y mapeo de estados de gameplay a musica. Usar para: musica adaptativa, sistema de musica dinamica, transiciones musicales, combat music.

The English summary is being prepared. Showing the original description.

SebastianLuser/claude-code-arcane3Updated Oct 27, 2026

Design multi-agent systems, create agent architectures, define communication patterns, and build autonomous agent workflows with structured evaluation frameworks.

The English summary is being prepared. Showing the original description.

SebastianLuser/claude-code-arcane3Updated Oct 27, 2026

Inter-agent communication protocol for C-suite agent teams. Defines invocation syntax, loop prevention, isolation rules, response formats, and quality loops.

The English summary is being prepared. Showing the original description.

SebastianLuser/claude-code-arcane3Updated Oct 27, 2026

See all skills by SebastianLuser

Report a problem with this skill