flipswitch-setup
npx skills add https://github.com/flipswitch-io/skills --skill flipswitch-setup
Agent 安装分布
Skill 文档
Set up the Flipswitch feature flag SDK in this project.
IMPORTANT: Execute these steps directly
Do NOT create helper tasks, spawn subagents, or delegate work. Execute each step in sequence, calling the MCP tools directly and handling results inline.
Step 0: Verify MCP Server Configuration
Call the authenticate MCP tool immediately to test connectivity.
- If it succeeds (returns auth status or URL+code): â MCP server is configured. Proceed to Step 1.
- If it fails with “tool not found” or “unknown tool”: â MCP server is NOT configured. Provide these instructions:
Stop here. User must configure and retry.To configure the Flipswitch MCP server, run this command in your terminal: claude mcp add --scope user --transport http flipswitch https://mcp.flipswitch.io/mcp This will add the MCP server to your ~/.claude.json configuration file (user scope). After running this command, restart Claude Code or run: /mcp reload - If it fails with a network error: â ï¸ MCP server is configured but unreachable. Ask user to check internet connection.
Step 1: Check Authentication Status
After successful authenticate call, check the result:
- Already authenticated: Display the auth status and proceed to Step 2.
- Device code provided: Show the user the URL and device code. Tell them to visit the URL, enter the code, and authorize. Then immediately call
authenticateagain to confirm.
Step 2: Detect Project Language
Use Glob to find language markers in the project root:
- Check for
package.jsonortsconfig.jsonâ javascript - Check for
requirements.txt,pyproject.toml,setup.py, orPipfileâ python - Check for
go.modâ go - Check for
pom.xml,build.gradle, orbuild.gradle.ktsâ java
If you find files for multiple languages or none, ask the user to specify using AskUserQuestion with options: “JavaScript”, “Python”, “Go”, “Java”, “Other”.
For JavaScript projects only: Also determine if it’s a web or server (Node.js) project:
- If
next.config.js,vite.config.js,webpack.config.js, or similar build config exists â web - If it’s a Next.js/Remix/similar full-stack framework â ask the user if they want snippets for web, server, or both
- If
Dockerfileordocker-compose.ymlexists and no obvious web build config â likely server - If uncertain, ask the user: “Is this a web app (browser), Node.js server, or full-stack?”. Use
AskUserQuestionwith options: “Web browser”, “Node.js server”, “Both (I’ll use both snippets)”
Save the selected language and JS environment (if applicable).
Step 3: Get Organizations and Projects
Call list_organizations MCP tool with no arguments.
- If only 1 org: Use it automatically.
- If multiple orgs: Use
AskUserQuestionto let user pick one.
Save the selected org ID.
Then call list_projects MCP tool with organizationId set to the saved org ID.
- If only 1 project: Use it automatically.
- If multiple projects: Use
AskUserQuestionto let user pick one.
Save the selected project ID.
Step 4: Get Environments
Call list_environments MCP tool with organizationId and projectId set to saved values.
- If an environment named “Development” exists: Use it automatically.
- Otherwise: Use
AskUserQuestionto let user pick an environment.
Save the selected environment ID.
Step 5: Get SDK API Key
Call get_sdk_api_key MCP tool with organizationId, projectId, and environmentId set to saved values.
The tool will return an API key. Save this key â you’ll need it in the next step.
Step 6: Create Example Flag (Optional)
Call create_flag MCP tool with:
-
organizationId: saved org ID -
projectId: saved project ID -
key: “my-feature” -
name: “My Feature” -
flagValueType: “Boolean” -
If successful: â Flag created.
-
If it fails with “key already exists” or similar: That’s fine, the flag already exists. Continue to next step.
-
If it fails for another reason: Report the error but continue.
Step 7: Get SDK Setup Snippet
Call get_sdk_setup_snippet MCP tool with:
language: saved language from Step 2apiKey: saved API key from Step 5flagKey: “my-feature”- If language is javascript: also set
jsEnvironmentbased on detection from Step 2 (e.g., “web” or “server”)
The tool will return install command, init code, and evaluation code. Display these to the user.
Step 8: Install SDK
Tell the user to run the install command returned from Step 7:
- javascript (web):
npm install @flipswitch-io/sdk @openfeature/web-sdk - javascript (server):
npm install @flipswitch-io/sdk @openfeature/js-sdk - python:
pip install flipswitch-sdk - go:
go get github.com/flipswitch-io/go-sdk - java: Show the Maven/Gradle dependency from the snippet
Then ask the user to run the command and confirm when done.
Step 9: Write Initialization Code
Get the init code from Step 7’s result. Based on the language, create a file:
- javascript:
src/flipswitch.ts(or.jsif not TypeScript) - python:
flipswitch_config.py - go:
flipswitch.go - java:
FlipswitchConfig.java
Use the Write tool to create the file with the init code from Step 7.
Display the file path to the user.
Step 10: Summary
Show the user:
- â SDK installed
- â
Initialization code written to
<file_path> - â
Example flag
my-featurecreated - Link: https://app.flipswitch.io
- Next steps: Enable the flag in the dashboard, then use the evaluation code from Step 7 in your application