[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71V3RDWY8PNM62219M9CC8M":3,"skill-same:01M71V3RDWY8PNM62219M9CC8M":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":28,"linkOnly":29,"markdownContent":30,"markdownBody":31,"frontMatter":32,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":14,"repositoryHtmlUrl":38,"repositoryHomepageUrl":6,"ownerHtmlUrl":39,"ownerBlogUrl":6,"ownerDescription":40,"updatedAt":41,"install":42,"resources":55},"01M71V3RDWY8PNM62219M9CC8M","flowtools-add-cli",null,"Transform an existing Flow Tools plugin into a CLI-callable plugin by adding `run()` and `inputSchema`.","FlowToolsOrg\u002Fflowtools-skills","FlowToolsOrg","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F262546067?v=4","01M71V3Q4CZV4EWD2ME4G5K3AH","Flow Tools","01M71V3Q4ZQYQ0S93Z47C10351",0,"MIT","https:\u002F\u002Fgithub.com\u002FFlowToolsOrg\u002Fflowtools-skills\u002Fblob\u002Fmain\u002Fskills\u002Fflowtools-add-cli\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27],"cli","add","flowtools add cli","plugin","run","flow","Tools","transform","Existing","2026-11-10 13:02:02",false,"---\nname: flowtools-add-cli\ndescription: Transform an existing Flow Tools plugin into a CLI-callable plugin by adding `run()` and `inputSchema`.\nmetadata: \n  version: 0.0.1\n  authors: FlowToolsOrg\n---\n\n# Add CLI Compatibility Skill\n\nTransform an existing Flow Tools plugin into a CLI-callable plugin by adding `run()` and `inputSchema`.\n\n## When to Use\n\n- Plugin only has `setup()` (UI) but needs CLI invocation\n- Want to enable AI agent integration via command line\n- Need structured input validation for headless execution\n\n## Prerequisites\n\n- Existing plugin with `setup()` method\n- Understanding of plugin's input requirements\n- Plugin already uses `definePlugin()` from `@flowtools\u002Fsdk`\n\n## Step-by-Step Workflow\n\n### 1. Analyze Plugin Inputs\n\nIdentify what inputs your plugin needs:\n\n- Form fields in UI\n- Configuration options\n- User inputs that affect behavior\n\n### 2. Define Input Schema\n\nCreate Zod schema for input validation:\n\n```ts\nimport { z } from 'zod'\n\u002F\u002F or: import { z } from '@flowtools\u002Fsdk'\n\nconst inputSchema = z.object({\n  \u002F\u002F Define each input with type, default, and description\n  text: z.string().default('').describe('Input text'),\n  count: z.number().default(1).describe('Number of items'),\n  format: z.enum(['json', 'text']).default('json').describe('Output format'),\n})\n```\n\n### 3. Extract Core Logic\n\nMove shared logic into standalone functions:\n\n```ts\n\u002F\u002F Shared between UI and CLI\nfunction processInput(text: string, count: number): string[] {\n  return Array.from({ length: count }, () => text.toUpperCase())\n}\n```\n\n### 4. Implement run() Method\n\nAdd `run()` to plugin definition:\n\n```ts\nexport default definePlugin({\n  type: 'app',\n  meta: {\n    id: 'my-plugin',\n    name: 'My Plugin',\n    version: '0.1.0',\n    permissions: ['storage'],\n  },\n  inputSchema,\n  async run(ctx, input) {\n    \u002F\u002F Use shared logic\n    const results = processInput(input.text, input.count)\n    \n    \u002F\u002F Log for debugging\n    ctx.log('info', 'Plugin executed', { input })\n    \n    \u002F\u002F Return structured result\n    return result.json({ results })\n  },\n  setup() {\n    \u002F\u002F Existing UI implementation\n  },\n})\n```\n\n### 5. Update setup() to Use Shared Logic\n\nModify UI to use the same core functions:\n\n```ts\nsetup() {\n  return function Panel() {\n    const [text, setText] = useState('')\n    const [count, setCount] = useState(1)\n    \n    const handleRun = () => {\n      const results = processInput(text, count)\n      \u002F\u002F Update UI with results\n    }\n    \n    return (\n      \u003Cdiv>\n        \u003Cinput value={text} onChange={e => setText(e.target.value)} \u002F>\n        \u003Cinput type=\"number\" value={count} onChange={e => setCount(Number(e.target.value))} \u002F>\n        \u003Cbutton onClick={handleRun}>Run\u003C\u002Fbutton>\n      \u003C\u002Fdiv>\n    )\n  }\n}\n```\n\n### 6. Test CLI Execution\n\nVerify the plugin works via CLI:\n\n```bash\n# List plugins to confirm it appears\nbun run packages\u002Fcli\u002Fsrc\u002Fcli.ts list\n\n# Test with schema flags\nbun run packages\u002Fcli\u002Fsrc\u002Fcli.ts run my-plugin --text \"hello\" --count 3\n\n# Test with JSON input\nbun run packages\u002Fcli\u002Fsrc\u002Fcli.ts run my-plugin --input '{\"text\":\"hello\",\"count\":3}'\n\n# Test text output format\nbun run packages\u002Fcli\u002Fsrc\u002Fcli.ts run my-plugin --text \"hello\" --format text\n```\n\n## Result Helpers\n\nUse `result.*` for structured output:\n\n```ts\nimport { result } from '@flowtools\u002Fsdk\u002Fresult'\n\n\u002F\u002F Plain text\nresult.text('Hello World')\n\n\u002F\u002F JSON data\nresult.json({ items: ['a', 'b', 'c'] })\n\n\u002F\u002F Table format\nresult.table(\n  ['Name', 'Value'],\n  [['key1', 'value1'], ['key2', 'value2']]\n)\n\n\u002F\u002F Open link\u002Ffile\nresult.open('https:\u002F\u002Fexample.com')\n\n\u002F\u002F Multiple results\nresult.multi([\n  result.text('Step 1 complete'),\n  result.json({ data: [1, 2, 3] })\n])\n```\n\n## Validation Checklist\n\n- [ ] `inputSchema` defined with Zod\n- [ ] All inputs have `.describe()` for CLI help text\n- [ ] Default values provided where appropriate\n- [ ] `run()` returns `result.*` structured response\n- [ ] Core logic shared between `setup()` and `run()`\n- [ ] Plugin appears in `bun run packages\u002Fcli\u002Fsrc\u002Fcli.ts list`\n- [ ] CLI execution produces expected output\n\n## Common Issues\n\n### Plugin Not Listed\n\n**Problem**: Plugin doesn't appear in `flowtools list`\n\n**Solution**: Ensure `run()` method is implemented and exported\n\n### Input Validation Errors\n\n**Problem**: CLI reports validation failures\n\n**Solution**: Check Zod schema matches expected input format\n\n### Missing Capabilities\n\n**Problem**: `MissingCapabilityError` during CLI execution\n\n**Solution**: Declare required permissions in `meta.permissions`\n\n## Example: Complete Transformation\n\n**Before** (UI only):\n\n```tsx\nexport default definePlugin({\n  type: 'app',\n  meta: { id: 'greeter', name: 'Greeter', version: '0.1.0', permissions: [] },\n  setup() {\n    return function Panel() {\n      const [name, setName] = useState('')\n      return (\n        \u003Cdiv>\n          \u003Cinput value={name} onChange={e => setName(e.target.value)} \u002F>\n          \u003Cp>Hello, {name}!\u003C\u002Fp>\n        \u003C\u002Fdiv>\n      )\n    }\n  },\n})\n```\n\n**After** (UI + CLI):\n\n```tsx\nimport { definePlugin } from '@flowtools\u002Fsdk'\nimport { result } from '@flowtools\u002Fsdk\u002Fresult'\nimport { z } from 'zod'\n\nconst inputSchema = z.object({\n  name: z.string().default('World').describe('Name to greet'),\n})\n\nexport default definePlugin({\n  type: 'app',\n  meta: { id: 'greeter', name: 'Greeter', version: '0.1.0', permissions: [] },\n  inputSchema,\n  async run(_ctx, input) {\n    return result.text(`Hello, ${input.name}!`)\n  },\n  setup() {\n    return function Panel() {\n      const [name, setName] = useState('')\n      return (\n        \u003Cdiv>\n          \u003Cinput value={name} onChange={e => setName(e.target.value)} \u002F>\n          \u003Cp>Hello, {name}!\u003C\u002Fp>\n        \u003C\u002Fdiv>\n      )\n    }\n  },\n})\n```\n","# Add CLI Compatibility Skill\n\nTransform an existing Flow Tools plugin into a CLI-callable plugin by adding `run()` and `inputSchema`.\n\n## When to Use\n\n- Plugin only has `setup()` (UI) but needs CLI invocation\n- Want to enable AI agent integration via command line\n- Need structured input validation for headless execution\n\n## Prerequisites\n\n- Existing plugin with `setup()` method\n- Understanding of plugin's input requirements\n- Plugin already uses `definePlugin()` from `@flowtools\u002Fsdk`\n\n## Step-by-Step Workflow\n\n### 1. Analyze Plugin Inputs\n\nIdentify what inputs your plugin needs:\n\n- Form fields in UI\n- Configuration options\n- User inputs that affect behavior\n\n### 2. Define Input Schema\n\nCreate Zod schema for input validation:\n\n```ts\nimport { z } from 'zod'\n\u002F\u002F or: import { z } from '@flowtools\u002Fsdk'\n\nconst inputSchema = z.object({\n  \u002F\u002F Define each input with type, default, and description\n  text: z.string().default('').describe('Input text'),\n  count: z.number().default(1).describe('Number of items'),\n  format: z.enum(['json', 'text']).default('json').describe('Output format'),\n})\n```\n\n### 3. Extract Core Logic\n\nMove shared logic into standalone functions:\n\n```ts\n\u002F\u002F Shared between UI and CLI\nfunction processInput(text: string, count: number): string[] {\n  return Array.from({ length: count }, () => text.toUpperCase())\n}\n```\n\n### 4. Implement run() Method\n\nAdd `run()` to plugin definition:\n\n```ts\nexport default definePlugin({\n  type: 'app',\n  meta: {\n    id: 'my-plugin',\n    name: 'My Plugin',\n    version: '0.1.0',\n    permissions: ['storage'],\n  },\n  inputSchema,\n  async run(ctx, input) {\n    \u002F\u002F Use shared logic\n    const results = processInput(input.text, input.count)\n    \n    \u002F\u002F Log for debugging\n    ctx.log('info', 'Plugin executed', { input })\n    \n    \u002F\u002F Return structured result\n    return result.json({ results })\n  },\n  setup() {\n    \u002F\u002F Existing UI implementation\n  },\n})\n```\n\n### 5. Update setup() to Use Shared Logic\n\nModify UI to use the same core functions:\n\n```ts\nsetup() {\n  return function Panel() {\n    const [text, setText] = useState('')\n    const [count, setCount] = useState(1)\n    \n    const handleRun = () => {\n      const results = processInput(text, count)\n      \u002F\u002F Update UI with results\n    }\n    \n    return (\n      \u003Cdiv>\n        \u003Cinput value={text} onChange={e => setText(e.target.value)} \u002F>\n        \u003Cinput type=\"number\" value={count} onChange={e => setCount(Number(e.target.value))} \u002F>\n        \u003Cbutton onClick={handleRun}>Run\u003C\u002Fbutton>\n      \u003C\u002Fdiv>\n    )\n  }\n}\n```\n\n### 6. Test CLI Execution\n\nVerify the plugin works via CLI:\n\n```bash\n# List plugins to confirm it appears\nbun run packages\u002Fcli\u002Fsrc\u002Fcli.ts list\n\n# Test with schema flags\nbun run packages\u002Fcli\u002Fsrc\u002Fcli.ts run my-plugin --text \"hello\" --count 3\n\n# Test with JSON input\nbun run packages\u002Fcli\u002Fsrc\u002Fcli.ts run my-plugin --input '{\"text\":\"hello\",\"count\":3}'\n\n# Test text output format\nbun run packages\u002Fcli\u002Fsrc\u002Fcli.ts run my-plugin --text \"hello\" --format text\n```\n\n## Result Helpers\n\nUse `result.*` for structured output:\n\n```ts\nimport { result } from '@flowtools\u002Fsdk\u002Fresult'\n\n\u002F\u002F Plain text\nresult.text('Hello World')\n\n\u002F\u002F JSON data\nresult.json({ items: ['a', 'b', 'c'] })\n\n\u002F\u002F Table format\nresult.table(\n  ['Name', 'Value'],\n  [['key1', 'value1'], ['key2', 'value2']]\n)\n\n\u002F\u002F Open link\u002Ffile\nresult.open('https:\u002F\u002Fexample.com')\n\n\u002F\u002F Multiple results\nresult.multi([\n  result.text('Step 1 complete'),\n  result.json({ data: [1, 2, 3] })\n])\n```\n\n## Validation Checklist\n\n- [ ] `inputSchema` defined with Zod\n- [ ] All inputs have `.describe()` for CLI help text\n- [ ] Default values provided where appropriate\n- [ ] `run()` returns `result.*` structured response\n- [ ] Core logic shared between `setup()` and `run()`\n- [ ] Plugin appears in `bun run packages\u002Fcli\u002Fsrc\u002Fcli.ts list`\n- [ ] CLI execution produces expected output\n\n## Common Issues\n\n### Plugin Not Listed\n\n**Problem**: Plugin doesn't appear in `flowtools list`\n\n**Solution**: Ensure `run()` method is implemented and exported\n\n### Input Validation Errors\n\n**Problem**: CLI reports validation failures\n\n**Solution**: Check Zod schema matches expected input format\n\n### Missing Capabilities\n\n**Problem**: `MissingCapabilityError` during CLI execution\n\n**Solution**: Declare required permissions in `meta.permissions`\n\n## Example: Complete Transformation\n\n**Before** (UI only):\n\n```tsx\nexport default definePlugin({\n  type: 'app',\n  meta: { id: 'greeter', name: 'Greeter', version: '0.1.0', permissions: [] },\n  setup() {\n    return function Panel() {\n      const [name, setName] = useState('')\n      return (\n        \u003Cdiv>\n          \u003Cinput value={name} onChange={e => setName(e.target.value)} \u002F>\n          \u003Cp>Hello, {name}!\u003C\u002Fp>\n        \u003C\u002Fdiv>\n      )\n    }\n  },\n})\n```\n\n**After** (UI + CLI):\n\n```tsx\nimport { definePlugin } from '@flowtools\u002Fsdk'\nimport { result } from '@flowtools\u002Fsdk\u002Fresult'\nimport { z } from 'zod'\n\nconst inputSchema = z.object({\n  name: z.string().default('World').describe('Name to greet'),\n})\n\nexport default definePlugin({\n  type: 'app',\n  meta: { id: 'greeter', name: 'Greeter', version: '0.1.0', permissions: [] },\n  inputSchema,\n  async run(_ctx, input) {\n    return result.text(`Hello, ${input.name}!`)\n  },\n  setup() {\n    return function Panel() {\n      const [name, setName] = useState('')\n      return (\n        \u003Cdiv>\n          \u003Cinput value={name} onChange={e => setName(e.target.value)} \u002F>\n          \u003Cp>Hello, {name}!\u003C\u002Fp>\n        \u003C\u002Fdiv>\n      )\n    }\n  },\n})\n```\n",{"name":5,"metadata":33,"description":7},{"authors":9,"version":34},"0.0.1","main","dfe039c55eab64c2528567a681edc9db437a6040","skills\u002Fflowtools-add-cli","https:\u002F\u002Fgithub.com\u002FFlowToolsOrg\u002Fflowtools-skills","https:\u002F\u002Fgithub.com\u002FFlowToolsOrg","An extensible, cross-platform toolbox powered by a plugin runtime. Desktop-first, capability-based architecture with unified React UI.","2026-05-15 15:50:00",{"source":8,"skillName":5,"commands":43,"prompt":53,"zipAvailable":54},[44,47,50],{"tool":45,"command":46},"npx","npx skills add FlowToolsOrg\u002Fflowtools-skills --skill flowtools-add-cli",{"tool":48,"command":49},"bunx","bunx skills add FlowToolsOrg\u002Fflowtools-skills --skill flowtools-add-cli",{"tool":51,"command":52},"pnpm","pnpm dlx skills add FlowToolsOrg\u002Fflowtools-skills --skill flowtools-add-cli","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FFlowToolsOrg\u002Fflowtools-skills\u002Fblob\u002Fmain\u002Fskills\u002Fflowtools-add-cli\u002FSKILL.md",true,[],[57,71],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":28},"01M71V3X3ERHHG64GB72AF5V9K","flowtools-ui","A React UI for FlowTools Plugin Development","https:\u002F\u002Fgithub.com\u002FFlowToolsOrg\u002Fflowtools-skills\u002Fblob\u002Fmain\u002Fskills\u002Fflowtools-ui\u002FSKILL.md",[],[64,65,66,22,67,68,69,70],"ui","flowtools ui","react","development","react ui","plugin development","for",{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":28},"01M71V3T6PJ60NE3B0Y4S97CH4","flowtools-description-to-plugin","Convert natural language descriptions into Flow Tools plugin implementations.","https:\u002F\u002Fgithub.com\u002FFlowToolsOrg\u002Fflowtools-skills\u002Fblob\u002Fmain\u002Fskills\u002Fflowtools-description-to-plugin\u002FSKILL.md",[],[22,78,24,25,79,80,81],"flowtools description to plugin","convert","language","natural language"]