Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

add-embedding-support

БесплатноБез исполняемых скриптовНе проверен

Add Qdrant embedding support to v3 WordPress components for RAG chatbot. Implements component-level content chunking for searchable, structured embeddings…

diegosouzapwот diegosouzapw★ 68 звёзд на GitHub

Об этом скилле

Add Embedding Support Skill

You are helping add Qdrant embedding support to WordPress v3 components. This enables component content to be indexed and searched via a RAG-based chatbot powered by Claude's API.

System Overview

The embedding system:

  • Chunks at component level: Each component becomes one or more embedding chunks
  • Avoids sub-component loading: Write extraction code directly in the component class
  • Supports sections: Complex components add multiple sections (sub-chunks) per instance
  • Tracks metadata: Links, dates, and custom metadata stored separately
  • Respects skip markers: Components can opt-out via ComponentEmbeddingSkipAwareInterface

How It Works

  1. CLI command wp vendi embedding:generate runs
  2. Sets global constant VENDI_RENDER_CONTEXT to RenderingContextEnum::EMBEDDING
  3. Loads each component via vendi_load_component_v3()
  4. Template detects context and returns component instance (no HTML rendering)
  5. Component's getEmbedding() method extracts structured data
  6. ComponentEmbedding DTO formats data into JSON chunks for Qdrant

Output Format

Each component produces a JSON object like this:

{
  "content": "Heading: Ask a Researcher\nBody: Are you a CRNA with research questions?\nLinks: Contact us",
  "metadata": {
    "type": "page",
    "url": "https://example.com/page/",
    "created": "2022-11-29T21:01:08+00:00",
    "updated": "2024-03-07T09:07:06+00:00",
    "links": [
      {
        "text": "Contact us",
        "url": "https://example.com/contact/"
      }
    ],
    "component_type": "content_callout_full_width"
  },
  "id": "660-3"
}

Component Type Classification

Embeddable Components

  • Implements ComponentEmbeddingAwareInterface
  • Provides getEmbedding() method
  • Content is indexed for chatbot

Skippable Components

  • Implements ComponentEmbeddingSkipAwareInterface (marker interface)
  • No getEmbedding() method needed
  • Ignored during embedding generation
  • Use for: ads, navigation, forms, decorative elements

Simple Components

  • Single chunk with heading and/or body
  • No repeater fields
  • Auto-extraction via interfaces

Complex Components

  • Multiple sections from repeater/flexible content
  • Each item becomes a separate section (sub-chunk)
  • May include links/CTAs tracked in metadata

Implementation Patterns

Pattern 1: Simple Component (Single Chunk)

When to use: Component has just heading and/or body copy, no repeater fields

Choosing the Right Interfaces

IMPORTANT: Inspect the actual template file to determine which interfaces to implement:

  • PrimaryHeadingInterface - Use when template displays a component-level heading (outside loops)

    • Example: <h2><?php esc_html_e(get_sub_field('headline')); ?></h2> at the top level
    • NOT for headings inside repeater loops
  • PrimaryCopyInterface - Use when template displays component-level body/intro copy (outside loops)

    • Example: <?php echo wp_kses_post(get_sub_field('intro_copy')); ?> before any repeaters
    • NOT for copy inside repeater loops

The interfaces should map to what actually exists in the template structure.

Required Interfaces

use Vendi\Theme\ComponentInterfaces\ComponentEmbeddingAwareInterface;
use Vendi\Theme\ComponentInterfaces\PrimaryHeadingInterface; // If template has top-level heading
use Vendi\Theme\ComponentInterfaces\PrimaryCopyInterface;    // If template has top-level copy
use Vendi\Theme\DTO\Embedding\ComponentEmbedding;
use Vendi\Theme\DTO\Embedding\ComponentEmbeddingInterface;

Class Implementation

class simple_component extends BaseComponent implements
    ComponentEmbeddingAwareInterface,
    PrimaryHeadingInterface,      // Only if template has top-level heading
    PrimaryCopyInterface          // Only if template has top-level copy
{
    public function getEmbedding(): ?ComponentEmbeddingInterface
    {
        return ComponentEmbedding::fromComponent($this);
    }

    public function getPrimaryHeadingText(): ?string
    {
        // Return the field that corresponds to the top-level heading in template
        return get_sub_field('headline');
    }

    public function getPrimaryCopy(): ?string
    {
        // Return the field that corresponds to the top-level copy in template
        return get_sub_field('copy');
    }
}

Output

Heading: [from getPrimaryHeadingText() if interface implemented]
Body: [from getPrimaryCopy() if interface implemented]

Key Points:

  • Inspect template first to determine which interfaces are needed
  • fromComponent() auto-extracts heading and body via interfaces
  • Single chunk per component instance
  • No manual section creation needed
  • Don't guess at structure - base decision on actual template code

Pattern 2: Skippable Component (No Embedding)

When to use: Ads, navigation, forms, decorative/visual-only elements

Required Interface

use Vendi\Theme\Com
Полный SKILL.md на GitHub

Установить add-embedding-support в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

metadata.json

FAQ

Что делает скилл add-embedding-support?

Add Qdrant embedding support to v3 WordPress components for RAG chatbot. Implements component-level content chunking for searchable, structured embeddings. Use when adding embedding to new or existing v3 components.

Как установить скилл add-embedding-support?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл add-embedding-support запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить add-embedding-support с