Hacker

Kritika Khatri

@kritikakhatri

Joined Nov 2026Student at Newton school od technology,puneIndia

Projects

  • flagsmith-run-experiment: an Agent Skill that runs a whole A/B test, safely

    Flagsmith Experimentation HackathonNov 2026

    I built flagsmith-run-experiment, an Agent Skill that lets a coding agent run a complete Flagsmith A/B test correctly, from planning to rollout, using the Flagsmith CLI. Creating a flag takes an agent one command. Running an experiment correctly is much harder, and the mistakes are silent: nothing crashes, the data is just wrong. A variant without a key records zero exposures. The code sends Look_Saved while the metric is look_saved, so no conversions are counted. An agent sees an early lead after 40 visitors and declares a winner. A variant is quietly hurting users and nobody notices. A rollout is ignored on older Flagsmith versions. The skill prevents all of these. It plans the sample size before starting, checks the code wiring offline, splits traffic with a real check, decides with a rule fixed in advance (including its own sample-ratio-mismatch test), stops early only to protect users, rolls out the winner, verifies the rollout, always gives an undo command, and writes an experiment report. Every step that changes production needs human approval. The whole job takes about 2,850 tokens. Who: developers and product teams who use Flagsmith and want their coding agent (Claude Code, GitHub Copilot or any agent that supports Agent Skills) to run experiments without supervising every step, and without risking bad decisions or harm to users. How it works: the user says something like "A/B test sample outfits on FitCheck's first screen". The agent loads SKILL.md and follows 7 steps using small bash scripts built on the Flagsmith CLI (flagsmith api, feature, flag, eval): Plan: works out the visitors needed per version and the expected duration from the baseline rate, the minimum lift worth detecting, and daily traffic. Set up: creates the flag, keyed variants, primary and guardrail metrics, and the experiment, but doesn't start it. Check wiring: scans the app code offline for the exposure call, enableEvents, exact event names and SDK version. Start (approval gate): starts the experiment and verifies the traffic split with eval. Watch: reads results and gives one decision: KEEP RUNNING, ROLL OUT, TRADE-OFF, KEEP CONTROL, STOP, or PROTECT USERS if a guardrail is clearly harmed early. Protect mode sets enrolment to 0% and pauses, with a one-command undo. Finish (approval gate): completes the experiment with the decision, verifies the rollout (20/20 identities get the right version), and detects older Flagsmith versions that ignore it. Report: writes EXPERIMENT_REPORT.md with the plan, results, decision and undo command. It comes with a demo app (FitCheck) and a traffic simulator, and 55 offline tests run in CI on Linux and macOS. While building it I found and reported a CLI bug (Flagsmith/flagsmith-cli#129) and added a workaround to the skill.