Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c493b39
feat: add algolia-migration skill for API client upgrades
MarioAlexandruDan May 20, 2026
4b3e993
fix(algolia-migration): address pr-review findings
MarioAlexandruDan May 20, 2026
a8968b6
fix(algolia-migration): correct method signatures from source verific…
MarioAlexandruDan May 20, 2026
9549dbf
fix(algolia-migration): correct Go helper method signatures
MarioAlexandruDan May 20, 2026
1591e01
fix(algolia-migration): correct Java saveObjects overload in eval #6
MarioAlexandruDan May 20, 2026
1e8149b
fix(algolia-migration): source-verified corrections across 6 language…
MarioAlexandruDan May 20, 2026
9f696c9
fix(algolia-migration): final source-verified corrections
MarioAlexandruDan May 20, 2026
33b6ae9
fix(algolia-migration): csharp.md method renames table uses Operation…
MarioAlexandruDan May 20, 2026
ef50196
fix(algolia-migration): source-verified corrections from final testin…
MarioAlexandruDan May 20, 2026
8cf8dcc
fix(algolia-migration): source-verified option function names in go.md
MarioAlexandruDan May 20, 2026
da850a5
fix(algolia-migration): SKILL.md browse pattern varies by language
MarioAlexandruDan May 20, 2026
f5bc4f8
fix(algolia-migration): C# browse uses aggregator callback, not IEnum…
MarioAlexandruDan May 21, 2026
5c4c2db
feat(algolia-migration): rewrite all 11 reference files from official…
MarioAlexandruDan May 21, 2026
4b603c3
feat(algolia-migration): rewrite reference files from official upgrad…
MarioAlexandruDan May 21, 2026
f0ee057
Update .claude-plugin/marketplace.json
MarioAlexandruDan May 21, 2026
3531196
Update skills/algolia-migration/SKILL.md
MarioAlexandruDan May 22, 2026
c0740e7
Update skills/algolia-migration/SKILL.md
MarioAlexandruDan May 22, 2026
57dd946
Update skills/algolia-migration/SKILL.md
MarioAlexandruDan May 22, 2026
888112d
Update skills/algolia-migration/SKILL.md
MarioAlexandruDan May 22, 2026
3306fdf
Update skills/algolia-migration/SKILL.md
MarioAlexandruDan May 22, 2026
09bd626
Update README.md
MarioAlexandruDan May 22, 2026
635c40f
feat(algolia-migration): remove Kotlin and Dart from scope
MarioAlexandruDan May 22, 2026
cf050dd
feat(algolia-migration): remove dart.md (new client, no migration)
MarioAlexandruDan May 22, 2026
82f119f
fix(algolia-migration): clean rendering artifacts from all reference …
MarioAlexandruDan May 22, 2026
bfa2225
Delete pr-review-26.md
MarioAlexandruDan May 28, 2026
cb9f2cf
fix(csharp): correct API signatures and code examples against v7 client
MarioAlexandruDan May 29, 2026
09e5bd7
fix(go): correct API signatures, option names, and constants against …
MarioAlexandruDan May 29, 2026
5a7ec20
fix(java): correct helper signatures, return types, and overloads aga…
MarioAlexandruDan May 29, 2026
72a71d1
fix(javascript): replaceAllObjects scopes is optional, not required
MarioAlexandruDan May 29, 2026
37cb451
docs(skill): note JS v5 accountCopyIndex exception in AccountClient s…
MarioAlexandruDan May 29, 2026
ae4aef6
fix(php): correct helper signatures, iterator usage, and transformati…
MarioAlexandruDan May 29, 2026
36c64d1
fix(python): invalid syntax in v3 examples, scopes optional, correct …
MarioAlexandruDan May 29, 2026
7ba5fe8
fix(ruby): browse block receives individual records, scopes optional,…
MarioAlexandruDan May 29, 2026
29e919d
fix(scala): return types, browseParams name, required params, for-com…
MarioAlexandruDan May 29, 2026
8d648db
fix(swift): instance methods not static, required browse params, save…
MarioAlexandruDan May 29, 2026
9306933
fix(review): SaveObjectsAsync return type, scopes optional in SKILL.m…
MarioAlexandruDan May 29, 2026
603fb88
fix(js): saveObjects returns BatchResponse[], use waitForTasks; fix e…
MarioAlexandruDan May 29, 2026
6d73bae
fix(evals): Dart eval #11 should expect out-of-scope refusal, not wor…
MarioAlexandruDan May 29, 2026
2b49b5e
fix(go,php): residual option names in transformation sections
MarioAlexandruDan Jun 2, 2026
cb9b836
feat(kotlin): add Kotlin v2→v3 migration reference
MarioAlexandruDan Jun 2, 2026
13c8f20
feat(evals): add Kotlin v2→v3 eval at ID 8
MarioAlexandruDan Jun 2, 2026
4f3f9a7
Merge branch 'main' into feat/add-algolia-migration
MarioAlexandruDan Jun 12, 2026
04d9be9
docs(references): align migration references with docs-new upgrade gu…
MarioAlexandruDan Jul 6, 2026
3b01aa4
Merge remote-tracking branch 'origin/main' into feat/add-algolia-migr…
MarioAlexandruDan Jul 6, 2026
ef8ddad
Merge remote-tracking branch 'origin/feat/add-algolia-migration' into…
MarioAlexandruDan Jul 6, 2026
5daf44c
docs(references): regenerate all references from merged docs-new upgr…
MarioAlexandruDan Jul 6, 2026
a431a0c
fix: address Copilot review feedback on migration skill
MarioAlexandruDan Jul 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@
"skills": [
"./skills/algolia-crawler"
]
},
{
"name": "algolia-migration",
"description": "Migrate existing Algolia backend/server-side API client code, or frontend search-only builds (lite client), to the latest major version. Use when upgrading algoliasearch packages, fixing initIndex removal, replacing .wait() chaining, updating imports after a version bump, or handling any breaking changes across JS (v4→v5), Python (v3→v4), Go (v3→v4), PHP (v3→v4), Java (v3→v4), C# (v6→v7), Ruby (v2→v3), Kotlin (v2→v3), Scala (v1→v2), or Swift (v8→v9). Do NOT use for new project setup, InstantSearch frontend widgets, analytics queries, or recommendations.",
"source": "./",
"strict": false,
"skills": [
"./skills/algolia-migration"
]
}
]
}
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
| `algobot-cli` | AI agents, Agent Studio, RAG, and conversational experiences built on Algolia |
| `instantsearch` | Build search UIs (autocomplete, search results, faceted search) with InstantSearch |
| `algolia-crawler` | Crawl web pages or whole sites into a RAG-optimized index with the Algolia Crawler |
| `algolia-migration` | Migrate API client code to the latest major version (JS, Python, Go, PHP, Java, C#, Ruby, Kotlin, Scala, Swift) |

---

Expand All @@ -28,13 +29,13 @@

```bash
/plugin marketplace add algolia/skills
/plugin install <skill> # e.g. algolia-mcp, algolia-cli, algobot-cli, instantsearch, algolia-crawler
/plugin install <skill> # e.g. algolia-mcp, algolia-cli, algobot-cli, instantsearch, algolia-crawler, algolia-migration
```

Or install directly:

```bash
/plugin install <skill>@algolia-skills # e.g. algolia-mcp, algolia-cli, algobot-cli, instantsearch, algolia-crawler
/plugin install <skill>@algolia-skills # e.g. algolia-mcp, algolia-cli, algobot-cli, instantsearch, algolia-crawler, algolia-migration
```

#### npx
Expand All @@ -47,7 +48,7 @@ npx skills add https://github.com/algolia/skills

```bash
git clone https://github.com/algolia/skills.git
cp -r skills/<skill> <skills-directory> # e.g. algolia-mcp, algolia-cli, algobot-cli, instantsearch, algolia-crawler
cp -r skills/<skill> <skills-directory> # e.g. algolia-mcp, algolia-cli, algobot-cli, instantsearch, algolia-crawler, algolia-migration
```

<details>
Expand Down
113 changes: 113 additions & 0 deletions skills/algolia-migration/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
name: algolia-migration
description: >-
Migrate existing Algolia API client code to a newer major version.
Triggers on: upgrading algoliasearch, moving from initIndex to client methods,
fixing "initIndex is not a function", updating imports after a version bump,
handling breaking changes from v3→v4 or v4→v5, replacing .wait() chaining,
or any mention of "migrate Algolia client", "upgrade Algolia SDK", or a
specific old-to-new version (e.g. "Python v3 to v4", "JS v4 to v5").
Covers JavaScript, Python, Go, PHP, Java, C#, Ruby, Kotlin, Scala, Swift. Dart is a new client and is excluded from scope.
Comment thread
MarioAlexandruDan marked this conversation as resolved.
Do NOT use for new project setup (use algolia-cli or algolia-mcp instead),
InstantSearch / frontend frameworks, analytics queries, or recommendations.
license: MIT
metadata:
author: algolia
version: "1.0"
---

# Algolia API Client Migration

> This skill covers **API client upgrades** (backend and frontend search-only builds).
> For frontend search UI, see **instantsearch**. For index operations, see **algolia-cli**.

## Supported migrations

| Language | Migration | Reference |
|------------|--------------|-----------|
| JavaScript | v4 → v5 | [references/javascript.md](references/javascript.md) |
| Python | v3 → v4 | [references/python.md](references/python.md) |
| Go | v3 → v4 | [references/go.md](references/go.md) |
| PHP | v3 → v4 | [references/php.md](references/php.md) |
| Java | v3 → v4 | [references/java.md](references/java.md) |
| C# | v6 → v7 | [references/csharp.md](references/csharp.md) |
| Ruby | v2 → v3 | [references/ruby.md](references/ruby.md) |
| Kotlin | v2 → v3 | [references/kotlin.md](references/kotlin.md) |
| Scala | v1 → v2 | [references/scala.md](references/scala.md) |
| Swift | v8 → v9 | [references/swift.md](references/swift.md) |

Open the matching reference file before writing any migration code.

## Universal breaking changes

Every language migration shares the same set of architectural shifts. Understand these first; the reference files add language-specific syntax on top.

### 1. `initIndex` is gone

The index object pattern is eliminated in every language. All methods moved to the **client** with `indexName` as an explicit parameter.

**The fix:** remove `initIndex` / `init_index` / `index(withName:)`, call the method on the client, pass `indexName`.

**Grep to find all affected call sites:**
```
grep -r "initIndex\|init_index\|InitIndex\|index(withName" .
```

### 2. `.wait()` chaining is gone

Chained `.wait()` / `!` bang methods on task responses are replaced by dedicated wait helpers.

| Old | New |
|-----|-----|
| `index.saveObjects(records).wait()` | `client.waitForTask(...)` with the index name and task ID |
| `index.save_objects!(objects)` (Ruby) | `client.save_objects(index_name, objects, true)` |

Three helpers available in every language: `waitForTask`, `waitForAppTask`, `waitForApiKey`. The exact calling convention varies by language (e.g. JS v5 takes an options object, Python uses keyword arguments) — see the language reference for the precise signature.

### 3. `copyIndex` / `moveIndex` → `operationIndex`

All index copy and move operations, including scoped copies (`copyRules`, `copySettings`, `copySynonyms`), consolidate into a single `operationIndex` call with `operation: "copy"` or `"move"` and an optional `scope` array.

### 4. `objectID` is required in `saveObjects`

`autoGenerateObjectIDIfNotExist` is removed. Every object passed to `saveObjects` must include an explicit `objectID`. To let the API generate IDs, use `chunkedBatch` with `action: addObject`.

### 5. `replaceAllObjects` — `scopes` is optional

The `safe` option is removed. The `scopes` parameter defaults to `["settings", "rules", "synonyms"]` in every language — you only need to pass it explicitly if you want a subset.

### 6. Browse helpers change pattern

The old iterator/chained patterns are gone. The new pattern **varies by language** — check the reference file:

- **Aggregator callback** (JS, Python, Go, Ruby, Scala, Swift): pass an `aggregator` function that receives each page response
- **Iterable** (C#, Java): the helper returns an `IEnumerable<T>` / `Iterable<T>` — iterate with `foreach` or `.forEach()`
- **Iterable / foreach** (PHP): the method returns `ObjectIterator` — iterate with a for-each loop

### 7. `AccountClient` is gone

Cross-application index copies now require composing helpers across two client instances manually: get settings from source, set on destination; browse + save for rules, synonyms, and objects.
Comment thread
MarioAlexandruDan marked this conversation as resolved.

JavaScript exception: v5 ships `client.accountCopyIndex({ sourceIndexName, destinationAppID, destinationApiKey, destinationIndexName, ... })` as a built-in. No manual composition needed, but the call signature differs from v4's `accountCopyIndex(srcIndex, destIndex)` — see references/javascript.md.

### 8. Dedicated clients per API

Each API now has its own client class. If the code previously imported one monolithic client, update imports for `RecommendClient`, `AnalyticsClient`, `AbtestingClient`, etc.

## Migration workflow

1. **Detect language and version** from the project's package manifest (`package.json`, `go.mod`, `composer.json`, `pom.xml`, `Gemfile`, etc.).
2. **Open the matching reference file** from the table above.
3. **Grep for `initIndex`** (and language equivalents) to enumerate all call sites.
4. **Update the install / dependency** first so the compiler/runtime flags all remaining issues.
5. **Apply universal changes** (sections above) before language-specific ones.
6. **Replace wait patterns** — search for `.wait()`, `waitTask`, `wait_task`, bang methods.
7. **Verify** by running the existing test suite or a minimal integration test.

## Direct Invocation

If the skill doesn't trigger automatically, invoke it directly:

- **`/algolia-migration`** — Load the full skill for any Algolia client upgrade task

This is useful when the request is brief (e.g., "update my Algolia imports") and the skill might not auto-trigger.
Loading
Loading