rkmahale17/rulcode.com / .claude/skills/integration-react-native
integration-react-native
UnverifiedInstall and configure PostHog analytics SDK in React Native applications, including event tracking, feature flags, user identification, and error tracking. Use when the user needs to add PostHog analytics, session recording, or feature flags to a React Native app.
PostHog Integration for React Native
Set up PostHog analytics in a React Native application: install the SDK, configure the provider, implement event tracking, identify users, and add error tracking.
Workflow
Follow these steps in order:
basic-integration-1.0-begin.md- PostHog Setup - Begin Start herebasic-integration-1.1-edit.md- PostHog Setup - Editbasic-integration-1.2-revise.md- PostHog Setup - Revisebasic-integration-1.3-conclude.md- PostHog Setup - Conclusion
Reference files
references/EXAMPLE.md- React Native example project codereferences/react-native.md- React Native SDK docsreferences/identify-users.md- User identification docs
Framework guidelines
- Install
posthog-react-nativeand its required peer dependencyreact-native-svg - Use
react-native-configto loadPOSTHOG_PROJECT_TOKENandPOSTHOG_HOSTfrom.env(embedded at build time, not runtime) - Place
PostHogProviderINSIDENavigationContainerfor React Navigation v7 compatibility
Minimal provider setup:
import PostHog, { PostHogProvider } from 'posthog-react-native';
import Config from 'react-native-config';
const posthogClient = new PostHog(Config.POSTHOG_PROJECT_TOKEN, {
host: Config.POSTHOG_HOST,
});
// Inside your App component, wrap content within NavigationContainer:
<NavigationContainer>
<PostHogProvider client={posthogClient}>
{/* app content */}
</PostHogProvider>
</NavigationContainer>
Identifying users
Identify users during login and signup events. Pass the client-side session and distinct ID using X-POSTHOG-DISTINCT-ID and X-POSTHOG-SESSION-ID headers to maintain frontend/backend correlation. Refer to references/identify-users.md and references/EXAMPLE.md for the correct pattern.
Error tracking
Add PostHog error tracking around critical user flows and API boundaries. Capture errors with posthog.capture('$exception', { $exception_message: error.message }).
Verification
After completing the integration:
- Run the app and trigger a test event
- Confirm the event appears in the PostHog project dashboard within 60 seconds
- Verify user identification by checking the "Persons" tab for the identified user
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 117k | Updated | Claude CodeCodex | Verified | Install |
| Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 117k | Updated | Claude CodeCodex | Verified | Install |