$npx -y skills add SamarthaKV29/antigravity-god-mode --skill algolia-searchExpert patterns for Algolia search implementation, indexing strategies, React InstantSearch, and relevance tuning Use when: adding search to, algolia, instantsearch, search api, search functionality.
| 1 | # Algolia Search Integration |
| 2 | |
| 3 | ## Patterns |
| 4 | |
| 5 | ### React InstantSearch with Hooks |
| 6 | |
| 7 | Modern React InstantSearch setup using hooks for type-ahead search. |
| 8 | |
| 9 | Uses react-instantsearch-hooks-web package with algoliasearch client. |
| 10 | Widgets are components that can be customized with classnames. |
| 11 | |
| 12 | Key hooks: |
| 13 | - useSearchBox: Search input handling |
| 14 | - useHits: Access search results |
| 15 | - useRefinementList: Facet filtering |
| 16 | - usePagination: Result pagination |
| 17 | - useInstantSearch: Full state access |
| 18 | |
| 19 | |
| 20 | ### Next.js Server-Side Rendering |
| 21 | |
| 22 | SSR integration for Next.js with react-instantsearch-nextjs package. |
| 23 | |
| 24 | Use <InstantSearchNext> instead of <InstantSearch> for SSR. |
| 25 | Supports both Pages Router and App Router (experimental). |
| 26 | |
| 27 | Key considerations: |
| 28 | - Set dynamic = 'force-dynamic' for fresh results |
| 29 | - Handle URL synchronization with routing prop |
| 30 | - Use getServerState for initial state |
| 31 | |
| 32 | |
| 33 | ### Data Synchronization and Indexing |
| 34 | |
| 35 | Indexing strategies for keeping Algolia in sync with your data. |
| 36 | |
| 37 | Three main approaches: |
| 38 | 1. Full Reindexing - Replace entire index (expensive) |
| 39 | 2. Full Record Updates - Replace individual records |
| 40 | 3. Partial Updates - Update specific attributes only |
| 41 | |
| 42 | Best practices: |
| 43 | - Batch records (ideal: 10MB, 1K-10K records per batch) |
| 44 | - Use incremental updates when possible |
| 45 | - partialUpdateObjects for attribute-only changes |
| 46 | - Avoid deleteBy (computationally expensive) |
| 47 | |
| 48 | |
| 49 | ## ⚠️ Sharp Edges |
| 50 | |
| 51 | | Issue | Severity | Solution | |
| 52 | |-------|----------|----------| |
| 53 | | Issue | critical | See docs | |
| 54 | | Issue | high | See docs | |
| 55 | | Issue | medium | See docs | |
| 56 | | Issue | medium | See docs | |
| 57 | | Issue | medium | See docs | |
| 58 | | Issue | medium | See docs | |
| 59 | | Issue | medium | See docs | |
| 60 | | Issue | medium | See docs | |