eobrien60/forge/obh-retrofit-search

Claude Code and agent skill by eobrien60/forge

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Use to assess or replace ad-hoc search with @obh/search. Finds LIKE/ILIKE queries, hand-rolled to_tsvector FTS, and external Elastic/Algolia/Meilisearch clients, then maps each searchable entity to a Postgres full-text index kept fresh from events. Assessment-only by default; implements on request.

Install

npx vskill@latest install eobrien60/forge/obh-retrofit-search

SKILL.md

The same SKILL.md was published earlier as eobrien60/forge/obh-retrofit-search.

Purpose: consolidate search behind the search primitive — Postgres full-text + trigram, kept fresh from domain events. The query side is one client call; the index is maintained worker-side by mapping each entity's create/update/delete events to a search document. No external search service. Requires an event catalogue (see obh-add-events).

Assessment (read-only)

  1. Find the search code. Grep for: LIKE '%…%' / ILIKE search filters; hand-rolled FTS (to_tsvector, plainto_tsquery, ts_rank, @@); external clients (@elastic/elasticsearch, algoliasearch, meilisearch, opensearch); and /search endpoints that scan or in-memory-filter whole tables.
  1. Inventory searchable entities. For each type users search: which fields are matched (title vs body/content), where the query endpoint lives, how results rank today, and (for external services) what the index sync looks like. Flag full-table scans and drift-prone manual indexes as the risks this move fixes.
  1. Map query to the target grammar. The endpoint becomes search.query({ workspaceId, query }) over createSearchClient({ provider: createPostgresSearchProvider({ db }) }). Note the route and response shape that change.
  1. Map each entity to a `defineSearchEntity`. For each type: the events that (re)index it (["note.created","note.updated"]), the deleteEvents that unindex it (["note.deleted"]), and buildDocument/buildDeleteRef mapping the event payload to { workspaceId, entityType, entityId, title, content }. If those events don't exist, record that obh-add-events must run first. Note that the index is populated forward from events, so existing rows need a backfill.

Produces the search retrofit plan. Nothing above mutates the repo — a valid stopping point when you only need the survey.

Implementation (only after the plan is agreed)

  1. Install. forge add search (--dry-run first; auto-adds events). Adds the migration (enables pg_trgm), the client + query route in apps/api, and the worker side (search-entities.ts, dispatch.d/search.ts with events: ["*"], consumers.d/search.ts running the indexer each tick). Run pnpm migrate.
  1. Author the entities. Replace the example defineSearchEntity with the types from the plan (real event names, buildDocument, buildDeleteRef) in apps/worker/src/search-entities.ts. Confirm the mapped events are emitted (obh-add-events).
  1. Backfill and cut over. Populate the index for existing rows — replay each entity's create event, or run a one-off backfill through the client. Point the app/UI at GET /api/search?q=, then retire the old LIKE/to_tsvector queries and tear down any Elastic/Algolia/Meili infrastructure and its sync.
  1. Validate. forge doctor.

Output

Assessment → the search retrofit plan: per entity, the source events/deleteEvents and the document mapping (title/content fields), the query-endpoint swap, the events that must exist first, and a backfill note. Implementation → the installed client/route/worker with authored entities, the backfilled index, and the retired legacy search (queries + external service).

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/eobrien60/forge/obh-retrofit-search/badge)](https://verified-skill.com/skills/eobrien60/forge/obh-retrofit-search)

Something wrong with this skill or its page? Tell us.