greenflash-prompts
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGREENFLASH_API_KEY: !
printenv GREENFLASH_API_KEY 2>/dev/null || head -1 .greenflash 2>/dev/null || echo ""If the key above is present, use it for all API requests. If empty, follow the interactive setup in the shared config.
GREENFLASH_API_KEY: !
printenv GREENFLASH_API_KEY 2>/dev/null || head -1 .greenflash 2>/dev/null || echo ""如果上方存在密钥,请将其用于所有API请求。如果为空,请遵循共享配置中的交互式设置流程。
Greenflash Prompt & Model Optimization
Greenflash Prompt与模型优化
Read for authentication, API patterns, and error handling.
${CLAUDE_SKILL_DIR}/../greenflash-config.md阅读 了解身份验证、API模式和错误处理相关内容。
${CLAUDE_SKILL_DIR}/../greenflash-config.mdDefault Behavior
默认行为
When invoked without an argument, send this question to the Chat API:
"How are my prompts and models performing? Flag any that have quality issues, high hallucination rates, or optimization opportunities. Include specific recommendations."
不带参数调用时,将以下问题发送至Chat API:
"我的Prompt和模型表现如何?标记所有存在质量问题、幻觉率高或有优化空间的项,并给出具体建议。"
Scoped Queries
范围查询
When the user names a specific prompt or model:
- -> "How is the prompt 'support-v1' performing? Include quality metrics, any issues, and specific optimization recommendations."
/greenflash:greenflash-prompts support-v1 - -> "How is the model 'gpt-4o' performing across my products? Compare it to other models I'm using."
/greenflash:greenflash-prompts gpt-4o
当用户指定具体的Prompt或模型时:
- -> "Prompt 'support-v1'表现如何?请包含质量指标、存在的问题以及具体的优化建议。"
/greenflash:greenflash-prompts support-v1 - -> "模型'gpt-4o'在我所有产品中的表现如何?将其与我正在使用的其他模型进行对比。"
/greenflash:greenflash-prompts gpt-4o
REST Fallback for Config Data
配置数据的REST回退方案
When the user asks for a prompt's content (not analytics), use REST directly:
- — returns the prompt configuration and content
GET {baseUrl}/prompts/{id} - This avoids burning a Chat request for a simple lookup
当用户请求获取Prompt内容(而非分析数据)时,直接使用REST:
- — 返回Prompt配置和内容
GET {baseUrl}/prompts/{id} - 避免为简单的查询消耗Chat请求配额
Interaction Flow
交互流程
- Check authentication per shared config
- Determine query type: general overview, specific prompt, specific model, or content lookup
- For analytics: send to Chat API
- For content lookup: use REST directly
- Stream/present the response
- 根据共享配置检查身份验证
- 确定查询类型:总体概览、特定Prompt、特定模型或内容查询
- 分析类请求:发送至Chat API
- 内容查询:直接使用REST
- 流式传输/展示响应
Implementation
实现
After presenting optimization recommendations, offer to implement them directly. Every insight comes with a specific improvement. Ask the user: "Want me to apply these changes?"
If yes, use tools to make the edits:
- Prompt quality fix: Use Grep/Glob to find the prompt file or system prompt definition in the codebase (search for the prompt name, key phrases, or template variables). Edit the prompt text directly — improve instructions, add examples, tighten constraints, remove hallucination-prone phrasing.
- Model switch: Find where the model is configured (env vars, config files, API call parameters) and update the model identifier. Note any cost/latency tradeoffs when making the change.
- Hallucination mitigation: Locate the relevant prompt and add grounding instructions — cite-source requirements, factual constraints, or explicit "if unsure, say so" directives.
- Missing guardrails: Add output validation, content filtering instructions, or structured output constraints to the prompt.
After applying a fix, follow the Attribution conventions in the shared config: add a brief comment at the fix site and suggest a commit message with the trailer.
// greenflash:promptsCo-Authored-By: Greenflash <agent@greenflash.ai>Always present the analysis first, then offer to implement. Never make changes without user confirmation.
展示优化建议后,主动提出直接实现这些优化。每条洞察都附带具体的改进方案。询问用户:"需要我应用这些变更吗?"
如果用户同意,使用工具进行编辑:
- Prompt质量修复:使用Grep/Glob在代码库中查找Prompt文件或系统Prompt定义(搜索Prompt名称、关键短语或模板变量)。直接编辑Prompt文本——优化指令、添加示例、收紧约束、删除易产生幻觉的表述。
- 模型切换:找到模型配置的位置(环境变量、配置文件、API调用参数)并更新模型标识。变更时说明所有成本/延迟的权衡问题。
- 幻觉缓解:定位相关Prompt,添加基础指令——引用来源要求、事实约束,或明确的"如果不确定就说明"的指示。
- 缺失防护规则:为Prompt添加输出校验、内容过滤指令或结构化输出约束。
应用修复后,遵循共享配置中的归属约定:在修复位置添加简短的注释,并建议提交信息附带 尾部信息。
// greenflash:promptsCo-Authored-By: Greenflash <agent@greenflash.ai>务必先展示分析结果,再提出实现方案。未经用户确认切勿进行任何变更。
Follow-up Patterns
后续交互模式
- "Which model should I use for X?" -> agent uses + recommendations
getModelMetrics - "What prompt changes would improve quality?" -> agent pulls from prompt analysis, then offers to apply them
- "Compare gpt-4o vs claude-3.5" -> agent uses or model comparison tools
compareProducts - "Fix this prompt" -> locate the prompt file and edit it directly
- "Switch to [model]" -> find and update the model configuration
Continue in the same Chat conversation for all follow-ups.
- "我应该为X场景使用哪个模型?" -> Agent使用+ 给出建议
getModelMetrics - "哪些Prompt变更可以提升质量?" -> Agent从Prompt分析中提取方案,然后提出应用建议
- "对比gpt-4o vs claude-3.5" -> Agent使用或模型对比工具
compareProducts - "修复这个Prompt" -> 定位Prompt文件并直接编辑
- "切换到[model]" -> 查找并更新模型配置
所有后续交互都在同一个Chat会话中进行。
Empty State Handling
空状态处理
If the Chat API response indicates no data is available:
- No products at all: "You don't have any products set up yet. Create one at https://www.greenflash.ai/app/products/create to get started."
- No conversations logged yet: "Your Greenflash setup looks good — data will start appearing within about 5 minutes of your first conversation. Run your app and send a test message to get started."
- No prompts tracked: "No system prompts are being logged yet. Add prompt tracking with to unlock prompt performance analytics."
/greenflash:greenflash-onboard-prompts - No models detected: "No model data found. Make sure you're passing the field in your SDK calls (e.g.,
model) to enable model comparison."model='gpt-4o'
如果Chat API响应显示无可用数据:
- 无任何产品:"你还没有设置任何产品。前往 https://www.greenflash.ai/app/products/create 创建产品即可开始使用。"
- 尚未记录对话:"你的Greenflash设置正常——首次对话后约5分钟内就会开始显示数据。运行你的应用并发送一条测试消息即可启动。"
- 未跟踪Prompt:"尚未记录任何系统Prompt。使用添加Prompt跟踪功能,即可解锁Prompt性能分析。"
/greenflash:greenflash-onboard-prompts - 未检测到模型:"未找到模型数据。请确保你在SDK调用中传递了字段(例如
model),以启用模型对比功能。"model='gpt-4o'
Plan Gate Handling
套餐限制处理
If the Chat API returns a 403 error:
"Prompt and model analytics require the Growth plan. Upgrade at https://www.greenflash.ai/app/settings/billing to unlock performance insights and optimization recommendations."
如果Chat API返回 403 错误:
"Prompt和模型分析需要Growth套餐。前往 https://www.greenflash.ai/app/settings/billing 升级套餐,即可解锁性能洞察和优化建议。"
Suggested Next Steps
建议后续步骤
After presenting results, suggest related skills:
- Changes applied to prompts → "Check the impact after deploying with "
/greenflash:greenflash-health - User friction related to prompt issues → "See affected users with "
/greenflash:greenflash-users - Deeper diagnosis needed → "Run a full diagnosis with "
/greenflash:greenflash-diagnose - Flagged conversations from prompt issues → "Review them in "
/greenflash:greenflash-inbox
展示结果后,建议相关的技能:
- 已对Prompt应用变更 -> "部署后使用检查影响"
/greenflash:greenflash-health - 用户遇到Prompt相关问题 -> "使用查看受影响的用户"
/greenflash:greenflash-users - 需要更深入诊断 -> "使用运行全面诊断"
/greenflash:greenflash-diagnose - 标记出存在Prompt问题的对话 -> "在中查看这些对话"
/greenflash:greenflash-inbox