Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 46279f7

Browse files
committed
Add a migration skill
1 parent 0b6a019 commit 46279f7

File tree

6 files changed

+637
-3
lines changed

6 files changed

+637
-3
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
title: Amplitude Migration - Begin
3+
description: Scan the project for Amplitude SDK usage and create a migration plan
4+
---
5+
6+
You are migrating this project from Amplitude Analytics to PostHog.
7+
8+
## Step 1: Detect Amplitude Installation
9+
10+
Check `package.json` for any of these Amplitude packages:
11+
- `@amplitude/analytics-browser`
12+
- `@amplitude/analytics-node`
13+
- `@amplitude/analytics-react-native`
14+
- `amplitude-js`
15+
16+
Note which packages are installed and their versions.
17+
18+
## Step 2: Scan for Amplitude Code
19+
20+
Search the codebase for files containing Amplitude usage:
21+
22+
1. **Import statements** - Look for:
23+
- `from '@amplitude/analytics-browser'`
24+
- `from 'amplitude-js'`
25+
- `from '@amplitude/analytics-node'`
26+
- `from './ampli'` (generated Amplitude SDK)
27+
28+
2. **Initialization code** - Look for:
29+
- `init('AMPLITUDE_API_KEY')`
30+
- `amplitude.getInstance().init()`
31+
- `ampli.load()`
32+
33+
3. **Tracking calls** - Look for:
34+
- `track()`, `logEvent()`
35+
- `identify()`, `setUserId()`
36+
- `setGroup()`, `groupIdentify()`
37+
- `revenue()`, `Revenue`
38+
- Ampli type-safe methods like `ampli.buttonClicked()`
39+
40+
4. **Configuration files** - Check for Amplitude environment variables:
41+
- `AMPLITUDE_API_KEY`
42+
- `REACT_APP_AMPLITUDE_API_KEY`
43+
- `NEXT_PUBLIC_AMPLITUDE_API_KEY`
44+
- `VITE_AMPLITUDE_API_KEY`
45+
46+
## Step 3: Create Migration Plan
47+
48+
Create a file `.posthog-migration.json` at the project root with:
49+
50+
```json
51+
{
52+
"sourceProvider": "amplitude",
53+
"detectedPackages": ["@amplitude/analytics-browser"],
54+
"filesToMigrate": [
55+
{
56+
"path": "src/index.tsx",
57+
"patterns": ["initialization", "provider-setup"]
58+
},
59+
{
60+
"path": "src/components/Button.tsx",
61+
"patterns": ["event-tracking"]
62+
}
63+
],
64+
"hasAmpliSdk": false,
65+
"ampliDirectory": null,
66+
"environmentVariables": {
67+
"remove": ["AMPLITUDE_API_KEY"],
68+
"add": ["POSTHOG_KEY", "POSTHOG_HOST"]
69+
}
70+
}
71+
```
72+
73+
## Step 4: Determine PostHog Package
74+
75+
Map Amplitude packages to PostHog equivalents:
76+
- `@amplitude/analytics-browser``posthog-js`
77+
- `amplitude-js``posthog-js`
78+
- `@amplitude/analytics-node``posthog-node`
79+
80+
## Status
81+
82+
Report these status updates as you work:
83+
84+
- [STATUS] Checking for Amplitude installation
85+
- [STATUS] Scanning for Amplitude usage patterns
86+
- [STATUS] Found X files with Amplitude code
87+
- [STATUS] Creating migration plan

0 commit comments

Comments
 (0)