Search

From tinh2/skills-hub-registry · View interactive version

Search is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Add full-text search to my app — set up Algolia, Meilisearch, Typesense, or Elasticsearch with index configuration, typo tolerance, faceted filtering, real-time sync from database mutations, a search UI component with instant results, and a bulk reindex script

How to use this skill

Skill file

You are in AUTONOMOUS MODE. Do NOT ask questions. Detect everything from the codebase and proceed.

PURPOSE:

Set up production-ready full-text search. Auto-detect the project's framework and the requested

search provider. Install the SDK, create a search service with index/search/delete operations,

build a search UI component, configure real-time index sync, and set up ranking and filtering.

TASK:

$ARGUMENTS

============================================================ PHASE 0: DETECTION ============================================================

  1. FRAMEWORK DETECTION — scan the project root to identify the tech stack:
  1. PROVIDER DETECTION — determine search provider from $ARGUMENTS or existing config:
  1. DATA MODEL DETECTION — identify what needs to be indexed:
  1. EXISTING SEARCH CHECK — search for existing search implementations:

============================================================ PHASE 1: SDK INSTALLATION ============================================================

Install the correct SDK for the detected provider and framework:

ALGOLIA:

TYPESENSE:

MEILISEARCH:

ELASTICSEARCH / OPENSEARCH:

After installing:

============================================================ PHASE 2: SEARCH SERVICE ============================================================

Create a search service that abstracts the provider.

FILE LOCATION:

THE SERVICE MUST EXPOSE:

init(config)

Initialize the search client. Validate connection on startup.

createIndex(indexName, options?)

Create an index with settings. Options: primaryKey, searchableAttributes, filterableAttributes.

configureIndex(indexName, settings)

Update index settings: searchable fields, filterable fields, sortable fields, ranking rules,

synonyms, stop words, typo tolerance.

indexDocument(indexName, document)

Add or update a single document in the index.

indexDocuments(indexName, documents)

Bulk index an array of documents. Use batch/bulk API for performance.

deleteDocument(indexName, documentId)

Remove a single document from the index.

deleteIndex(indexName)

Delete an entire index and its documents.

search(indexName, query, options?)

Full-text search. Options: filters, facets, page, hitsPerPage, attributesToHighlight,

attributesToRetrieve, sort.

Returns: { hits: [], totalHits, page, totalPages, processingTimeMs, facets? }.

getDocument(indexName, documentId)

Retrieve a specific document by ID.

getIndexStats(indexName)

Get document count and index size.

IMPLEMENTATION REQUIREMENTS:

============================================================ PHASE 3: INDEX CONFIGURATION ============================================================

For each detected data model, configure an optimized search index:

  1. SEARCHABLE ATTRIBUTES — ordered by priority:
  1. FILTERABLE ATTRIBUTES:
  1. SORTABLE ATTRIBUTES:
  1. RANKING RULES (in order):
  1. SYNONYMS:
  1. TYPO TOLERANCE:

Write index configuration to search/index-config.ts (or equivalent) as code, not raw JSON,

so it can be version-controlled and reviewed.

============================================================ PHASE 4: REAL-TIME INDEX SYNC ============================================================

Set up automatic index synchronization when data changes:

  1. DATABASE HOOKS — wire into the ORM/database lifecycle:

PRISMA:

MONGOOSE:

FIRESTORE:

SUPABASE:

TYPEORM:

  1. SYNC SERVICE — create a dedicated sync module:

FILE: src/services/search-sync.ts (or equivalent)

  1. BULK REINDEX COMMAND — create a script for initial or full reindexing:

FILE: scripts/reindex.ts (or equivalent)

============================================================ PHASE 5: SEARCH UI COMPONENT ============================================================

Build a search UI appropriate for the framework:

REACT / NEXT.JS:

VUE:

FLUTTER:

ANGULAR:

ALL FRAMEWORKS:

============================================================ PHASE 6: PAGINATION & FILTERING ============================================================

  1. PAGINATION:
  1. FILTERING:
  1. SORTING:

============================================================ PHASE 7: VALIDATION ============================================================

  1. Run the project's build/compile step — fix any errors.
  2. Run existing tests — fix any failures caused by search integration.
  3. Write at least 4 unit tests:
  1. Verify the reindex script runs without errors (in dry-run mode if possible).
  2. Commit all changes with descriptive messages:

============================================================ DO NOT ============================================================

============================================================ OUTPUT ============================================================

Search Setup

NEXT STEPS:

After search is set up:

============================================================

SELF-HEALING VALIDATION (max 3 iterations)

============================================================

After completing the integration, validate:

  1. Run the project's test suite to verify the integration works end-to-end.
  2. Run build/compile to confirm no breakage.
  3. Verify the integration responds correctly (health checks, test calls, smoke tests).
  4. If failures occur, diagnose from error output and apply minimal fixes.
  5. Repeat up to 3 iterations.

IF STILL FAILING after 3 iterations:

============================================================

SELF-EVOLUTION TELEMETRY

============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:

Entry format:

### /search — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}

Only log if the memory directory exists. Skip silently if not found.

Keep entries concise — /evolve will parse these for skill improvement signals.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.