Help us improve
Share bugs, ideas, or general feedback.
From optimizely-exp
Optimizely Experimentation Full Stack SDK patterns
npx claudepluginhub twofoldtech-dakota/claude-marketplace --plugin optimizely-experimentation-analyzerHow this skill is triggered — by the user, by Claude, or both
Slash command
/optimizely-exp:skills/optimizely-experimentationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill covers Optimizely Full Stack SDK patterns for feature flags, A/B testing, and event tracking.
Implements PostHog feature flags, A/B experiments, and cohorts using posthog-js (browser) and posthog-node (server) in TypeScript/JavaScript apps.
Guides you through designing, creating, and running A/B experiments in LaunchDarkly—configuring metrics, treatments, flag rules, starting iterations, swapping treatments, and declaring a winner.
Integrates OpenFeature SDK for vendor-agnostic feature flags with standardized API, covering Node.js installation, evaluation, providers, and hooks for A/B testing and canary releases.
Share bugs, ideas, or general feedback.
This skill covers Optimizely Full Stack SDK patterns for feature flags, A/B testing, and event tracking.
import { createInstance } from '@optimizely/optimizely-sdk';
const optimizelyClient = createInstance({
sdkKey: process.env.NEXT_PUBLIC_OPTIMIZELY_SDK_KEY,
datafileOptions: {
autoUpdate: true,
updateInterval: 60000, // 1 minute
},
eventBatchSize: 10,
eventFlushInterval: 1000,
});
export default optimizelyClient;
import { OptimizelyProvider, createInstance } from '@optimizely/react-sdk';
const optimizely = createInstance({
sdkKey: process.env.NEXT_PUBLIC_OPTIMIZELY_SDK_KEY,
});
function App() {
return (
<OptimizelyProvider
optimizely={optimizely}
user={{
id: getUserId(),
attributes: getUserAttributes(),
}}
timeout={500}
>
<YourApp />
</OptimizelyProvider>
);
}
import { useDecision } from '@optimizely/react-sdk';
function FeatureComponent() {
const [decision, clientReady] = useDecision('feature_key');
if (!clientReady) {
return <Skeleton />;
}
if (!decision.enabled) {
return null;
}
return <NewFeature variables={decision.variables} />;
}
interface PricingVariables {
discount: number;
currency: string;
showBadge: boolean;
}
function usePricingFeature() {
const [decision, clientReady] = useDecision('pricing_feature');
return {
isReady: clientReady,
isEnabled: decision.enabled,
discount: decision.variables.discount as number,
currency: decision.variables.currency as string,
showBadge: decision.variables.showBadge as boolean,
};
}
function CheckoutExperiment() {
const [decision, clientReady] = useDecision('checkout_experiment');
if (!clientReady) {
return <CheckoutSkeleton />;
}
switch (decision.variationKey) {
case 'single_page':
return <SinglePageCheckout />;
case 'express':
return <ExpressCheckout />;
default:
return <StandardCheckout />;
}
}
// pages/api/checkout.ts or app/api/checkout/route.ts
export async function getServerSideProps({ req }) {
const userId = getUserId(req);
const decision = optimizelyClient.decide('checkout_experiment', userId);
return {
props: {
variation: decision.variationKey,
userId,
},
};
}
const userContext = optimizelyClient.createUserContext(userId, {
membershipTier: user.tier,
country: user.country,
});
userContext.trackEvent('purchase_completed', {
revenue: 9900, // In cents
currency: 'USD',
itemCount: 3,
});
import { useTrackEvent } from '@optimizely/react-sdk';
function PurchaseButton({ amount }: { amount: number }) {
const track = useTrackEvent();
const handlePurchase = async () => {
const result = await processPayment();
if (result.success) {
track('purchase_completed', {
revenue: amount * 100,
currency: 'USD',
});
}
};
return <button onClick={handlePurchase}>Purchase</button>;
}