Audit SDK d'enquêtes PostHog

VérifiéPrudence

Auditez les fonctionnalités des enquêtes dans les SDKs PostHog (JS, iOS, Android, Flutter). Vérifiez les versions et suivez la parité.

Spar Skills Guide Bot
DeveloppementIntermédiaire
28/07/2026
Claude Code
#posthog#sdk-audit#feature-parity#surveys#changelog

Recommandé pour

Synthèse automatique

Ce skill guide l'audit d'une fonctionnalité de sondages à travers les SDK PostHog (JS, iOS, Android, Flutter) afin d'alimenter le fichier `surveyVersionRequirements.ts`.

Points forts

  • Vérifie d'abord l'accessibilité des dépôts SDK via des variables d'environnement et propose de les sauvegarder dans `.claude/settings.local.json` avec les permissions Read/Grep.
  • Précise les chemins de code et de CHANGELOG pour chaque SDK, ce qui évite les recherches approximatives.
  • Encadre la création d'issues et la mise à jour de l'issue de suivi GitHub #45658, en passant par un fichier temporaire éditable pour que l'utilisateur voie le diff.

Limites

  • Fortement lié à l'écosystème PostHog : dépôts spécifiques, numéro d'issue de suivi codé en dur, fichier cible `surveyVersionRequirements.ts`.
  • Suppose que l'utilisateur dispose de `gh` authentifié et des dépôts SDK clonés localement.
  • Ne décrit pas de méthode d'audit détaillée au-delà des chemins et du suivi : la recherche de fonctionnalités elle-même reste à la charge du modèle.
Quand l'utiliser

À utiliser lorsqu'il faut déterminer si une fonctionnalité de sondages est prise en charge par chaque SDK PostHog et à partir de quelle version.

Quand l'éviter

À éviter pour auditer des fonctionnalités hors sondages ou des SDK PostHog autres que JS, iOS, Android et Flutter.

Analyse de sécurité

Prudence
Score qualité82/100

The skill is for legitimate internal auditing of PostHog SDKs and uses powerful tools such as gh api, bash, git, and file edits to search code and update tracking issues. No destructive or exfiltrating actions are present, but the use of gh api to modify repository issues and configuration file changes warrants caution.

Points d'attention
  • •Instructs use of gh api to update GitHub issues, including patching issue body via bash command with command substitution.
  • •Uses bash, git, grep, and file editing on external SDK repositories.
  • •Encourages modifying .claude/settings.local.json to grant read/grep permissions to external paths.
Comment cette analyse est faite

Exemples

Audit a survey feature
Use the survey-sdk-audit skill to check whether the 'response filtering' survey feature is supported across posthog-js, posthog-ios, posthog-android, and posthog-flutter, and what versions added it.
Track missing feature support
Audit the 'partial responses' survey feature across the four PostHog SDKs; for any SDK that doesn't support it, open an issue in that repo and add it to the Tracked Issues section of PostHog/posthog#45658.
Save SDK paths for later
Run the survey-sdk-audit setup check, ask me for any missing PostHog SDK repo paths, and save them to .claude/settings.local.json with Read and Grep permissions.

name: survey-sdk-audit description: Audit PostHog survey SDK features and version requirements

Surveys SDK Feature Audit Skill

Use this skill when auditing survey feature support across PostHog SDKs for surveyVersionRequirements.ts.

Feature to audit: $ARGUMENTS

Setup Check (Run First)

Before starting, verify the SDK paths are accessible. Run ls on each path:

  • $POSTHOG_JS_PATH
  • $POSTHOG_IOS_PATH
  • $POSTHOG_ANDROID_PATH
  • $POSTHOG_FLUTTER_PATH

If any path is empty or doesn't exist, ask the user: "I need the path to [SDK repo] on your machine. Where is it located?"

Once you have all paths, ask the user if they'd like to save them for future sessions by adding to .claude/settings.local.json:

{
  "env": {
    "POSTHOG_JS_PATH": "/path/to/posthog-js",
    "POSTHOG_IOS_PATH": "/path/to/posthog-ios",
    "POSTHOG_ANDROID_PATH": "/path/to/posthog-android",
    "POSTHOG_FLUTTER_PATH": "/path/to/posthog-flutter"
  },
  "permissions": {
    "allow": [
      "Read(/path/to/posthog-js/**)",
      "Read(/path/to/posthog-ios/**)",
      "Read(/path/to/posthog-android/**)",
      "Read(/path/to/posthog-flutter/**)",
      "Grep(/path/to/posthog-js/**)",
      "Grep(/path/to/posthog-ios/**)",
      "Grep(/path/to/posthog-android/**)",
      "Grep(/path/to/posthog-flutter/**)"
    ]
  }
}

Note: The Read and Grep permissions grant Claude access to these external SDK repositories without prompting each time.

Using SDK Paths in Commands

IMPORTANT: Environment variables like $POSTHOG_JS_PATH do NOT expand reliably in Bash tool commands.

Instead of bash commands, prefer:

  • Use the Read tool to read files (works with permissions)
  • Use the Grep tool to search files (works with permissions)

If you must use bash, first expand the variable:

echo $POSTHOG_JS_PATH

Then use the echoed path directly in subsequent commands.

Tracking Issue

All survey SDK feature parity work is tracked in: https://github.com/PostHog/posthog/issues/45658

When creating new issues for missing features:

  1. Create the issue in the appropriate SDK repo (see labels below)

  2. Add the issue to the tracking issue's "Tracked Issues" section as a task list item:

    - [ ] https://github.com/PostHog/repo/issues/123
    

    Note: GitHub automatically expands issue links to show titles, so no description is needed.

  3. Update the relevant feature table in the tracking issue if needed

To update the tracking issue body:

Step 1: Fetch the current body to a temp file:

gh api repos/PostHog/posthog/issues/45658 --jq '.body' > /tmp/tracking_issue_body.md

Step 2: Use the Edit tool to modify /tmp/tracking_issue_body.md. This ensures the user can review the diff of your changes before proceeding.

Step 3: After the user has approved the edits, push the update:

gh api repos/PostHog/posthog/issues/45658 -X PATCH -f body="$(cat /tmp/tracking_issue_body.md)"

Important: Always use the Edit tool on the temp file rather than writing directly. This gives the user visibility into exactly what changes are being made to the tracking issue.

SDK Paths and Changelogs

| SDK | Code Path | Changelog | | -------------------- | ---------------------------------------- | ----------------------------------------------------- | | posthog-js (browser) | $POSTHOG_JS_PATH/packages/browser | $POSTHOG_JS_PATH/packages/browser/CHANGELOG.md | | posthog-react-native | $POSTHOG_JS_PATH/packages/react-native | $POSTHOG_JS_PATH/packages/react-native/CHANGELOG.md | | posthog-ios | $POSTHOG_IOS_PATH | $POSTHOG_IOS_PATH/CHANGELOG.md | | posthog-android | $POSTHOG_ANDROID_PATH | $POSTHOG_ANDROID_PATH/CHANGELOG.md | | posthog-flutter | $POSTHOG_FLUTTER_PATH | $POSTHOG_FLUTTER_PATH/CHANGELOG.md |

Flutter Native Dependencies

Flutter wraps native SDKs. Check dependency versions in:

  • iOS: $POSTHOG_FLUTTER_PATH/ios/posthog_flutter.podspec (look for s.dependency 'PostHog')
  • Android: $POSTHOG_FLUTTER_PATH/android/build.gradle (look for posthog-android dependency)

Audit Process

Step 1: Understand the Feature

Look at the check function in surveyVersionRequirements.ts to understand what field/condition triggers this feature:

  • s.conditions?.deviceTypes → search for "deviceTypes"
  • s.appearance?.fontFamily → search for "fontFamily"
  • s.conditions?.urlMatchType → search for "urlMatchType"

Step 2: Search Changelogs First

# Search changelog for the feature keyword
grep -n -i "KEYWORD" /path/to/CHANGELOG.md

If found, read the surrounding lines to get the version number.

Step 3: Search Code If Not in Changelog

# Find commits that added the keyword (use -S for exact string match)
cd /path/to/sdk && git log --oneline --all -S "KEYWORD" -- "*.swift" "*.kt" "*.ts" "*.tsx"

# Then find the first version tag containing that commit
git tag --contains COMMIT_HASH | sort -V | head -3

Step 4: For Flutter, Find When Native Dependency Was Bumped

# Find when Flutter started requiring iOS version X.Y.Z
cd $POSTHOG_FLUTTER_PATH && git log --oneline -p -- "ios/posthog_flutter.podspec" | grep -B10 "X.Y.Z"

# Get the Flutter version for that commit
git tag --contains COMMIT_HASH | sort -V | head -1

Step 5: Verify Feature Actually Works (Not Just Types)

CRITICAL: Having a field in a data model does NOT mean the feature is implemented. You must check the actual filtering/matching logic.

Key files to check for survey filtering logic:

  • posthog-js (browser): $POSTHOG_JS_PATH/packages/browser/src/extensions/surveys/surveys-extension-utils.tsx - utility functions like canActivateRepeatedly, getSurveySeen, hasEvents
  • posthog-js (browser): $POSTHOG_JS_PATH/packages/browser/src/extensions/surveys.tsx - main survey logic
  • posthog-react-native: $POSTHOG_JS_PATH/packages/react-native/src/surveys/getActiveMatchingSurveys.ts - main filtering logic
  • posthog-react-native: $POSTHOG_JS_PATH/packages/react-native/src/surveys/surveys-utils.ts - utility functions like canActivateRepeatedly, hasEvents
  • posthog-ios: $POSTHOG_IOS_PATH/PostHog/Surveys/PostHogSurveyIntegration.swift → getActiveMatchingSurveys() method, canActivateRepeatedly computed property
  • posthog-android: $POSTHOG_ANDROID_PATH/posthog-android/src/main/java/com/posthog/android/surveys/PostHogSurveysIntegration.kt → getActiveMatchingSurveys() method, canActivateRepeatedly() function

Key utility functions to compare across SDKs:

  • canActivateRepeatedly - determines if a survey can be shown again after being seen
  • hasEvents - checks if survey has event-based triggers
  • getSurveySeen - checks if user has already seen the survey

Example pitfall 1: Both iOS and Android have linkedFlagKey in their Survey model, but neither implements linkedFlagVariant checking. They only call isFeatureEnabled(key) (boolean) instead of comparing flags[key] === variant.

Example pitfall 2: The browser canActivateRepeatedly checks THREE conditions: (1) event repeatedActivation, (2) schedule === 'always', (3) survey in progress. Mobile SDKs may only check condition (1), missing the schedule check entirely.

What to look for:

  • Is the field parsed from JSON into the model? (necessary but not sufficient)
  • Is the field used in filtering logic like getActiveMatchingSurveys()?
  • Does the logic match the reference implementation behavior?
  • Test files don't count as implementation

Reference Implementation

posthog-js browser is the canonical implementation - it has every feature and is the source of truth for how things are supposed to work.

When auditing a feature:

  1. First check $POSTHOG_JS_PATH/packages/browser/src/extensions/surveys.ts to understand the complete, correct behavior
  2. Then compare mobile SDKs against posthog-react-native ($POSTHOG_JS_PATH/packages/react-native/src/surveys/getActiveMatchingSurveys.ts) which is the reference for mobile-specific implementations

Web-Only vs Cross-Platform Features

Some features only make sense on web:

  • URL targeting: No concept of "current URL" in native apps → issue: false for all mobile
  • CSS selector targeting: No DOM in native apps → issue: false for all mobile
  • Custom fonts via CSS: May need native implementation or may not be applicable

Output Format

For each feature, produce:

{
    feature: 'Feature Name',
    sdkVersions: {
        'posthog-js': 'X.Y.Z',
        'posthog-react-native': 'X.Y.Z',  // or omit if unsupported
        'posthog-ios': 'X.Y.Z',
        'posthog-android': 'X.Y.Z',
        'posthog_flutter': 'X.Y.Z',  // add comment: first version to require native SDK >= X.Y
    },
    unsupportedSdks: [
        { sdk: 'sdk-name', issue: 'https://github.com/PostHog/repo/issues/123' },  // needs implementation
        { sdk: 'sdk-name', issue: false },  // not applicable (e.g., web-only feature)
    ],
    check: (s) => ...,
}

Creating GitHub Issues

IMPORTANT: Always search for existing issues BEFORE creating new ones.

# Search in the SDK-specific repo
gh issue list --repo PostHog/posthog-ios --search "FEATURE_KEYWORD" --state all --limit 20
gh issue list --repo PostHog/posthog-android --search "FEATURE_KEYWORD" --state all --limit 20
gh issue list --repo PostHog/posthog-flutter --search "FEATURE_KEYWORD" --state all --limit 20

# Also search with broader terms
gh issue list --repo PostHog/posthog-ios --search "survey feature flag" --state all --limit 20

Always search issues in the main repo PostHog/posthog AND the SDK-specific repo(s) to ensure an issue does not already exist anywhere.

Labels by Repository

| Repository | Labels for Survey Features | | ----------------------- | -------------------------- | | PostHog/posthog-js | feature/surveys | | PostHog/posthog-ios | Survey, enhancement | | PostHog/posthog-android | Survey, enhancement | | PostHog/posthog-flutter | Survey, enhancement |

Issue Creation Command

# posthog-js (covers browser and react-native)
gh issue create --repo PostHog/posthog-js --label "feature/surveys" --title "..." --body "..."

# posthog-ios
gh issue create --repo PostHog/posthog-ios --label "Survey" --label "enhancement" --title "..." --body "..."

# posthog-android
gh issue create --repo PostHog/posthog-android --label "Survey" --label "enhancement" --title "..." --body "..."

# posthog-flutter
gh issue create --repo PostHog/posthog-flutter --label "Survey" --label "enhancement" --title "..." --body "..."

Issue Template

## 🚨 IMPORTANT

This issue is likely user-facing in the main PostHog app, see [`surveyVersionRequirements.ts`](https://github.com/PostHog/posthog/blob/master/frontend/src/scenes/surveys/surveyVersionRequirements.ts). If you delete or close this issue, be sure to update the version requirements list here.

## Summary

The [SDK] SDK does not support [feature] for surveys.

## Current State

- [What exists, if anything - types, partial implementation, etc.]

## Expected Behavior

[What should happen when this feature is configured]

## Reference Implementation

See posthog-js browser: `packages/browser/src/extensions/surveys.ts`
For mobile-specific patterns, see posthog-react-native: `packages/react-native/src/surveys/getActiveMatchingSurveys.ts`

## Tracking

This is tracked in the survey SDK feature parity issue: https://github.com/PostHog/posthog/issues/45658

_This issue was generated by Claude using the `/survey-sdk-audit` skill._

Completion Checklist

Before finishing the audit, verify all steps are complete:

  • [ ] Understand the feature - Read the check function in surveyVersionRequirements.ts
  • [ ] Check browser SDK - Find version in changelog (this is the reference implementation)
  • [ ] Check react-native SDK - Find version in changelog
  • [ ] Check iOS SDK - Verify if feature is actually implemented (not just types)
  • [ ] Check Android SDK - Verify if feature is actually implemented (not just types)
  • [ ] Check Flutter SDK - Check native dependency versions
  • [ ] Search for existing issues - Before creating new ones
  • [ ] Create GitHub issues - For any unsupported SDKs (with proper labels)
  • [ ] Update surveyVersionRequirements.ts - Fix versions and add issue links to unsupportedSdks
  • [ ] Update tracking issue - Add new issues to https://github.com/PostHog/posthog/issues/45658

Common Pitfalls

  1. Don't guess versions - always verify with changelog or git history
  2. Types ≠ Implementation - having a field in a data class doesn't mean filtering logic exists
  3. Model field ≠ Feature support - the field may be parsed but never used in decision-making (e.g., linkedFlagKey exists but linkedFlagVariant check is missing)
  4. Test code ≠ Production code - functions only in test files aren't shipped
  5. Flutter inherits from native - its "support" depends on iOS/Android SDK versions it requires
  6. Always search for existing issues first - before creating new GitHub issues
  7. Compare utility function implementations - functions like canActivateRepeatedly may have different logic across SDKs; browser is the source of truth

Post-Audit: Skill Improvement

After completing an audit, consider whether any learnings should be added to this skill file:

  1. New pitfalls discovered - Add to Common Pitfalls section
  2. New key files identified - Add to the file paths in Step 5
  3. New utility functions to compare - Add to the "Key utility functions" list
  4. Pattern changes - If SDK implementations have changed structure, update paths

If you find improvements, propose them to the user:

I found some learnings during this audit that could improve the skill:
- [describe the improvement]

Would you like me to update the skill file?

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/posthog-survey-sdk-audit-ms47vr12/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/posthog-survey-sdk-audit-ms47vr12' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/posthog-survey-sdk-audit-ms47vr12/download' --output '.skill-downloads/posthog-survey-sdk-audit-ms47vr12/SKILL.md.part' && mv '.skill-downloads/posthog-survey-sdk-audit-ms47vr12/SKILL.md.part' '.skill-downloads/posthog-survey-sdk-audit-ms47vr12/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/posthog-survey-sdk-audit-ms47vr12/SKILL.md' && test -s '.skill-downloads/posthog-survey-sdk-audit-ms47vr12/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/survey-sdk-audit' && cp -R '.skill-downloads/posthog-survey-sdk-audit-ms47vr12' '.claude/skills/survey-sdk-audit'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/posthog-survey-sdk-audit-ms47vr12'

openskills read 'posthog-survey-sdk-audit-ms47vr12'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/posthog-survey-sdk-audit-ms47vr12/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires