prompt-optimizer by affaan-m/everything-claude-code
npx skills add https://github.com/affaan-m/everything-claude-code --skill prompt-optimizer分析草稿提示,进行批判性评估,匹配 ECC 生态系统组件,并输出一个完整的优化提示,供用户复制粘贴并运行。
/prompt-optimizeconfigure-ecc)skill-stocktake)仅提供建议 —— 不执行用户的任务。
请勿编写代码、创建文件、运行命令或采取任何实施操作。你的唯一输出是分析加上一个优化后的提示。
如果用户说"直接做"、"just do it"或"不要优化,直接执行",请勿在此技能内切换到实施模式。告知用户此技能仅生成优化提示,并指导他们如果想要执行,请提出正常的任务请求。
按顺序运行这个 6 阶段流程。使用下面的输出格式呈现结果。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
在分析提示之前,检测当前项目上下文:
CLAUDE.md —— 读取它以了解项目约定package.json → Node.js / TypeScript / React / Next.jsgo.mod → Gopyproject.toml / requirements.txt → PythonCargo.toml → Rustbuild.gradle / pom.xml → Java / Kotlin / Spring BootPackage.swift → SwiftGemfile → Rubycomposer.json → PHP*.csproj / *.sln → .NETMakefile / CMakeLists.txt → C / C++cpanfile / Makefile.PL → Perl如果未找到项目文件(例如,提示是抽象的或用于新项目),则跳过检测,并在阶段 4 中标记"技术栈未知"。
将用户的任务分类到一个或多个类别中:
| 类别 | 信号词 | 示例 |
|---|---|---|
| 新功能 | build, create, add, implement, 创建, 实现, 添加 | "构建一个登录页面" |
| Bug 修复 | fix, broken, not working, error, 修复, 报错 | "修复认证流程" |
| 重构 | refactor, clean up, restructure, 重构, 整理 | "重构 API 层" |
| 研究 | how to, what is, explore, investigate, 怎么, 如何 | "如何添加 SSO" |
| 测试 | test, coverage, verify, 测试, 覆盖率 | "为购物车添加测试" |
| 审查 | review, audit, check, 审查, 检查 | "审查我的 PR" |
| 文档 | document, update docs, 文档 | "更新 API 文档" |
| 基础设施 | deploy, CI, docker, database, 部署, 数据库 | "设置 CI/CD 流水线" |
| 设计 | design, architecture, plan, 设计, 架构 | "设计数据模型" |
如果阶段 0 检测到项目,则使用代码库大小作为信号。否则,仅根据提示描述进行估算,并将估算标记为不确定。
| 范围 | 启发式方法 | 编排 |
|---|---|---|
| 微小 | 单个文件,< 50 行 | 直接执行 |
| 低 | 单个组件或模块 | 单个命令或技能 |
| 中等 | 多个组件,同一领域 | 命令链 + /verify |
| 高 | 跨领域,5+ 个文件 | 先 /plan,然后分阶段执行 |
| 史诗级 | 多会话,多 PR,架构变更 | 使用蓝图技能进行多会话规划 |
将意图 + 范围 + 技术栈(来自阶段 0)映射到特定的 ECC 组件。
| 意图 | 命令 | 技能 | 代理 |
|---|---|---|---|
| 新功能 | /plan, /tdd, /code-review, /verify | tdd-workflow, verification-loop | planner, tdd-guide, code-reviewer |
| Bug 修复 | /tdd, /build-fix, /verify | tdd-workflow | tdd-guide, build-error-resolver |
| 重构 | /refactor-clean, /code-review, /verify | verification-loop | refactor-cleaner, code-reviewer |
| 研究 | /plan | search-first, iterative-retrieval | — |
| 测试 | /tdd, /e2e, /test-coverage | tdd-workflow, e2e-testing | tdd-guide, e2e-runner |
| 审查 | /code-review | security-review | code-reviewer, security-reviewer |
| 文档 | /update-docs, /update-codemaps | — | doc-updater |
| 基础设施 | /plan, /verify | docker-patterns, deployment-patterns, database-migrations | architect |
| 设计(中等-高) | /plan | — | planner, architect |
| 设计(史诗级) | — | blueprint (作为技能调用) | planner, architect |
| 技术栈 | 要添加的技能 | 代理 |
|---|---|---|
| Python / Django | django-patterns, django-tdd, django-security, django-verification, python-patterns, python-testing | python-reviewer |
| Go | golang-patterns, golang-testing | go-reviewer, go-build-resolver |
| Spring Boot / Java | springboot-patterns, springboot-tdd, springboot-security, springboot-verification, java-coding-standards, jpa-patterns | code-reviewer |
| Kotlin / Android | kotlin-coroutines-flows, compose-multiplatform-patterns, android-clean-architecture | kotlin-reviewer |
| TypeScript / React | frontend-patterns, backend-patterns, coding-standards | code-reviewer |
| Swift / iOS | swiftui-patterns, swift-concurrency-6-2, swift-actor-persistence, swift-protocol-di-testing | code-reviewer |
| PostgreSQL | postgres-patterns, database-migrations | database-reviewer |
| Perl | perl-patterns, perl-testing, perl-security | code-reviewer |
| C++ | cpp-coding-standards, cpp-testing | code-reviewer |
| 其他 / 未列出 | coding-standards (通用) | code-reviewer |
扫描提示中缺失的关键信息。检查每个项目,并标记是阶段 0 自动检测到的,还是用户必须提供的:
如果缺少 3 个或更多关键项,在生成优化提示之前,向用户提出最多 3 个澄清问题。然后将答案整合到优化提示中。
确定此提示在开发生命周期中的位置:
研究 → 规划 → 实施 (TDD) → 审查 → 验证 → 提交
对于中等及以上范围的任务,始终从 /plan 开始。对于史诗级任务,使用蓝图技能。
模型推荐(包含在输出中):
| 范围 | 推荐模型 | 理由 |
|---|---|---|
| 微小-低 | Sonnet 4.6 | 快速,对简单任务成本效益高 |
| 中等 | Sonnet 4.6 | 标准工作的最佳编码模型 |
| 高 | Sonnet 4.6 (主) + Opus 4.6 (规划) | Opus 用于架构,Sonnet 用于实施 |
| 史诗级 | Opus 4.6 (蓝图) + Sonnet 4.6 (执行) | 用于多会话规划的深度推理 |
多提示拆分(针对高/史诗级范围):
对于超出单个会话的任务,拆分为顺序提示:
按照此确切结构呈现你的分析。使用与用户输入相同的语言进行回复。
优势: 列出原始提示做得好的地方。
问题:
| 问题 | 影响 | 建议修复 |
|---|---|---|
| (问题) | (后果) | (如何修复) |
需要澄清: 用户应回答的问题编号列表。如果阶段 0 自动检测到了答案,请说明而不是提问。
| 类型 | 组件 | 目的 |
|---|---|---|
| 命令 | /plan | 编码前规划架构 |
| 技能 | tdd-workflow | TDD 方法论指导 |
| 代理 | code-reviewer | 实施后审查 |
| 模型 | Sonnet 4.6 | 针对此范围的推荐 |
在单个代码块内呈现完整的优化提示。提示必须是自包含的,可以直接复制粘贴。包括:
对于引用蓝图的项目,请写:"使用蓝图技能来..."(而不是 /blueprint,因为蓝图是技能,不是命令)。
为有经验的 ECC 用户提供的紧凑版本。根据意图类型变化:
| 意图 | 快速模式 |
|---|---|
| 新功能 | /plan [功能]。/tdd 实施。/code-review。/verify。 |
| Bug 修复 | /tdd —— 为 [bug] 编写失败测试。修复使其通过。/verify。 |
| 重构 | /refactor-clean [范围]。/code-review。/verify。 |
| 研究 | 使用 search-first 技能研究 [主题]。根据发现 /plan。 |
| 测试 | /tdd [模块]。关键流程使用 /e2e。/test-coverage。 |
| 审查 | /code-review。然后使用 security-reviewer 代理。 |
| 文档 | /update-docs。/update-codemaps。 |
| 史诗级 | 使用蓝图技能规划 "[目标]"。使用 /verify 门控分阶段执行。 |
| 增强项 | 理由 |
|---|---|
| (添加了什么) | (为什么重要) |
不符合你的需求?告诉我需要调整什么,或者如果你想要执行而不是提示优化,请提出正常的任务请求。
用户输入:
帮我写一个用户登录页面
阶段 0 检测到: package.json 包含 Next.js 15, TypeScript, Tailwind CSS
优化提示(完整):
使用项目现有技术栈(Next.js 15 + TypeScript + Tailwind CSS)实现用户登录页面。
技术要求:
- 沿用项目现有的组件结构和路由约定
- 表单验证使用项目中已有的验证方案(检查是否已用 Zod/Yup/其他)
- 认证方式:沿用项目现有认证方案(如无,默认 JWT)
- 包含:邮箱/密码登录表单、表单验证、错误提示、加载状态、响应式布局
工作流:
1. /plan 先规划组件结构和认证流程,参考现有页面的模式
2. /tdd 测试先行:编写登录表单的单元测试和认证流程的集成测试
3. 实现登录页面和认证逻辑
4. /code-review 审查实现
5. /verify 验证所有测试通过且页面正常渲染
安全要求:
- 密码不明文传输
- 防止暴力破解(rate limiting)
- XSS 防护
- CSRF token
验收标准:
- 所有测试通过,覆盖率 80%+
- 页面在移动端和桌面端正常渲染
- 登录成功跳转到 dashboard,失败显示错误信息
不要做:
- 不要实现注册页面
- 不要实现忘记密码功能
- 不要修改现有的路由结构
用户输入:
Add a REST API endpoint for user profile updates with validation
阶段 0 检测到: go.mod 包含 Go 1.22, Chi router
优化提示(完整):
Add a REST API endpoint for user profile updates (PATCH /api/users/:id).
Tech stack: Go 1.22 + Chi router (detected from project)
Requirements:
- PATCH /api/users/:id — partial update of user profile
- Input validation for fields: name, email, avatar_url, bio
- Auth: require valid token, users can only update own profile
- Return 200 with updated user on success
- Return 400 with validation errors on invalid input
- Return 401/403 for auth failures
- Follow existing API patterns in the codebase
Workflow:
1. /plan the endpoint structure, middleware chain, and validation logic
2. /tdd — write table-driven tests for success, validation failure, auth failure, not-found
3. Implement following existing handler patterns
4. /go-review
5. /verify — run full test suite, confirm no regressions
Do not:
- Modify existing endpoints
- Change the database schema (use existing user table)
- Add new dependencies without checking existing ones first (use search-first skill)
用户输入:
Migrate our monolith to microservices
优化提示(完整):
Use the blueprint skill to plan: "Migrate monolith to microservices architecture"
Before executing, answer these questions in the blueprint:
1. Which domain boundaries exist in the current monolith?
2. Which service should be extracted first (lowest coupling)?
3. Communication pattern: REST APIs, gRPC, or event-driven (Kafka/RabbitMQ)?
4. Database strategy: shared DB initially or database-per-service from start?
5. Deployment target: Kubernetes, Docker Compose, or serverless?
The blueprint should produce phases like:
- Phase 1: Identify service boundaries and create domain map
- Phase 2: Set up infrastructure (API gateway, service mesh, CI/CD per service)
- Phase 3: Extract first service (strangler fig pattern)
- Phase 4: Verify with integration tests, then extract next service
- Phase N: Decommission monolith
Each phase = 1 PR, with /verify gates between phases.
Use /save-session between phases. Use /resume-session to continue.
Use git worktrees for parallel service extraction when dependencies allow.
Recommended: Opus 4.6 for blueprint planning, Sonnet 4.6 for phase execution.
| 组件 | 何时引用 |
|---|---|
configure-ecc | 用户尚未设置 ECC |
skill-stocktake | 审计安装了哪些组件(使用此而非硬编码目录) |
search-first | 优化提示中的研究阶段 |
blueprint | 史诗级范围的优化提示(作为技能调用,而非命令) |
strategic-compact | 长会话上下文管理 |
cost-aware-llm-pipeline | 令牌优化推荐 |
每周安装数
452
仓库
GitHub Stars
102.1K
首次出现
11 天前
安全审计
安装于
codex431
cursor380
gemini-cli376
amp376
cline376
github-copilot376
Analyze a draft prompt, critique it, match it to ECC ecosystem components, and output a complete optimized prompt the user can paste and run.
/prompt-optimizeconfigure-ecc instead)skill-stocktake instead)Advisory only — do not execute the user's task.
Do NOT write code, create files, run commands, or take any implementation action. Your ONLY output is an analysis plus an optimized prompt.
If the user says "just do it", "直接做", or "don't optimize, just execute", do not switch into implementation mode inside this skill. Tell the user this skill only produces optimized prompts, and instruct them to make a normal task request if they want execution instead.
Run this 6-phase pipeline sequentially. Present results using the Output Format below.
Before analyzing the prompt, detect the current project context:
CLAUDE.md exists in the working directory — read it for project conventionspackage.json → Node.js / TypeScript / React / Next.jsgo.mod → Gopyproject.toml / requirements.txt → PythonCargo.toml → Rustbuild.gradle / pom.xml → Java / Kotlin / Spring BootPackage.swift → SwiftGemfile → RubyIf no project files are found (e.g., the prompt is abstract or for a new project), skip detection and flag "tech stack unknown" in Phase 4.
Classify the user's task into one or more categories:
| Category | Signal Words | Example |
|---|---|---|
| New Feature | build, create, add, implement, 创建, 实现, 添加 | "Build a login page" |
| Bug Fix | fix, broken, not working, error, 修复, 报错 | "Fix the auth flow" |
| Refactor | refactor, clean up, restructure, 重构, 整理 | "Refactor the API layer" |
| Research | how to, what is, explore, investigate, 怎么, 如何 | "How to add SSO" |
| Testing | test, coverage, verify, 测试, 覆盖率 | "Add tests for the cart" |
| Review | review, audit, check, 审查, 检查 | "Review my PR" |
| Documentation | document, update docs, 文档 | "Update the API docs" |
| Infrastructure | deploy, CI, docker, database, 部署, 数据库 | "Set up CI/CD pipeline" |
| Design | design, architecture, plan, 设计, 架构 |
If Phase 0 detected a project, use codebase size as a signal. Otherwise, estimate from the prompt description alone and mark the estimate as uncertain.
| Scope | Heuristic | Orchestration |
|---|---|---|
| TRIVIAL | Single file, < 50 lines | Direct execution |
| LOW | Single component or module | Single command or skill |
| MEDIUM | Multiple components, same domain | Command chain + /verify |
| HIGH | Cross-domain, 5+ files | /plan first, then phased execution |
| EPIC | Multi-session, multi-PR, architectural shift | Use blueprint skill for multi-session plan |
Map intent + scope + tech stack (from Phase 0) to specific ECC components.
| Intent | Commands | Skills | Agents |
|---|---|---|---|
| New Feature | /plan, /tdd, /code-review, /verify | tdd-workflow, verification-loop | planner, tdd-guide, code-reviewer |
| Bug Fix | /tdd, /build-fix, /verify | tdd-workflow | tdd-guide, build-error-resolver |
| Refactor | /refactor-clean, /code-review, /verify | verification-loop | refactor-cleaner, code-reviewer |
| Research | /plan | search-first, iterative-retrieval | — |
| Testing | /tdd, /e2e, /test-coverage | tdd-workflow, e2e-testing | tdd-guide, e2e-runner |
| Review | /code-review | security-review | code-reviewer, security-reviewer |
| Documentation | /update-docs, /update-codemaps |
| Tech Stack | Skills to Add | Agent |
|---|---|---|
| Python / Django | django-patterns, django-tdd, django-security, django-verification, python-patterns, python-testing | python-reviewer |
| Go | golang-patterns, golang-testing | go-reviewer, go-build-resolver |
| Spring Boot / Java | springboot-patterns, springboot-tdd, springboot-security, springboot-verification, java-coding-standards, jpa-patterns | code-reviewer |
| Kotlin / Android | kotlin-coroutines-flows, compose-multiplatform-patterns, android-clean-architecture | kotlin-reviewer |
| TypeScript / React | frontend-patterns, backend-patterns, coding-standards | code-reviewer |
| Swift / iOS | swiftui-patterns, swift-concurrency-6-2, swift-actor-persistence, swift-protocol-di-testing | code-reviewer |
| PostgreSQL | postgres-patterns, database-migrations | database-reviewer |
| Perl | perl-patterns, perl-testing, perl-security |
Scan the prompt for missing critical information. Check each item and mark whether Phase 0 auto-detected it or the user must supply it:
If 3+ critical items are missing , ask the user up to 3 clarification questions before generating the optimized prompt. Then incorporate the answers into the optimized prompt.
Determine where this prompt sits in the development lifecycle:
Research → Plan → Implement (TDD) → Review → Verify → Commit
For MEDIUM+ tasks, always start with /plan. For EPIC tasks, use blueprint skill.
Model recommendation (include in output):
| Scope | Recommended Model | Rationale |
|---|---|---|
| TRIVIAL-LOW | Sonnet 4.6 | Fast, cost-efficient for simple tasks |
| MEDIUM | Sonnet 4.6 | Best coding model for standard work |
| HIGH | Sonnet 4.6 (main) + Opus 4.6 (planning) | Opus for architecture, Sonnet for implementation |
| EPIC | Opus 4.6 (blueprint) + Sonnet 4.6 (execution) | Deep reasoning for multi-session planning |
Multi-prompt splitting (for HIGH/EPIC scope):
For tasks that exceed a single session, split into sequential prompts:
Present your analysis in this exact structure. Respond in the same language as the user's input.
Strengths: List what the original prompt does well.
Issues:
| Issue | Impact | Suggested Fix |
|---|---|---|
| (problem) | (consequence) | (how to fix) |
Needs Clarification: Numbered list of questions the user should answer. If Phase 0 auto-detected the answer, state it instead of asking.
| Type | Component | Purpose |
|---|---|---|
| Command | /plan | Plan architecture before coding |
| Skill | tdd-workflow | TDD methodology guidance |
| Agent | code-reviewer | Post-implementation review |
| Model | Sonnet 4.6 | Recommended for this scope |
Present the complete optimized prompt inside a single fenced code block. The prompt must be self-contained and ready to copy-paste. Include:
For items that reference blueprint, write: "Use the blueprint skill to..." (not /blueprint, since blueprint is a skill, not a command).
A compact version for experienced ECC users. Vary by intent type:
| Intent | Quick Pattern |
|---|---|
| New Feature | /plan [feature]. /tdd to implement. /code-review. /verify. |
| Bug Fix | /tdd — write failing test for [bug]. Fix to green. /verify. |
| Refactor | /refactor-clean [scope]. /code-review. /verify. |
| Research | Use search-first skill for [topic]. /plan based on findings. |
| Testing | /tdd [module]. /e2e for critical flows. /test-coverage. |
| Review |
| Enhancement | Reason |
|---|---|
| (what was added) | (why it matters) |
Not what you need? Tell me what to adjust, or make a normal task request if you want execution instead of prompt optimization.
User input:
帮我写一个用户登录页面
Phase 0 detects: package.json with Next.js 15, TypeScript, Tailwind CSS
Optimized Prompt (Full):
使用项目现有技术栈(Next.js 15 + TypeScript + Tailwind CSS)实现用户登录页面。
技术要求:
- 沿用项目现有的组件结构和路由约定
- 表单验证使用项目中已有的验证方案(检查是否已用 Zod/Yup/其他)
- 认证方式:沿用项目现有认证方案(如无,默认 JWT)
- 包含:邮箱/密码登录表单、表单验证、错误提示、加载状态、响应式布局
工作流:
1. /plan 先规划组件结构和认证流程,参考现有页面的模式
2. /tdd 测试先行:编写登录表单的单元测试和认证流程的集成测试
3. 实现登录页面和认证逻辑
4. /code-review 审查实现
5. /verify 验证所有测试通过且页面正常渲染
安全要求:
- 密码不明文传输
- 防止暴力破解(rate limiting)
- XSS 防护
- CSRF token
验收标准:
- 所有测试通过,覆盖率 80%+
- 页面在移动端和桌面端正常渲染
- 登录成功跳转到 dashboard,失败显示错误信息
不要做:
- 不要实现注册页面
- 不要实现忘记密码功能
- 不要修改现有的路由结构
User input:
Add a REST API endpoint for user profile updates with validation
Phase 0 detects: go.mod with Go 1.22, Chi router
Optimized Prompt (Full):
Add a REST API endpoint for user profile updates (PATCH /api/users/:id).
Tech stack: Go 1.22 + Chi router (detected from project)
Requirements:
- PATCH /api/users/:id — partial update of user profile
- Input validation for fields: name, email, avatar_url, bio
- Auth: require valid token, users can only update own profile
- Return 200 with updated user on success
- Return 400 with validation errors on invalid input
- Return 401/403 for auth failures
- Follow existing API patterns in the codebase
Workflow:
1. /plan the endpoint structure, middleware chain, and validation logic
2. /tdd — write table-driven tests for success, validation failure, auth failure, not-found
3. Implement following existing handler patterns
4. /go-review
5. /verify — run full test suite, confirm no regressions
Do not:
- Modify existing endpoints
- Change the database schema (use existing user table)
- Add new dependencies without checking existing ones first (use search-first skill)
User input:
Migrate our monolith to microservices
Optimized Prompt (Full):
Use the blueprint skill to plan: "Migrate monolith to microservices architecture"
Before executing, answer these questions in the blueprint:
1. Which domain boundaries exist in the current monolith?
2. Which service should be extracted first (lowest coupling)?
3. Communication pattern: REST APIs, gRPC, or event-driven (Kafka/RabbitMQ)?
4. Database strategy: shared DB initially or database-per-service from start?
5. Deployment target: Kubernetes, Docker Compose, or serverless?
The blueprint should produce phases like:
- Phase 1: Identify service boundaries and create domain map
- Phase 2: Set up infrastructure (API gateway, service mesh, CI/CD per service)
- Phase 3: Extract first service (strangler fig pattern)
- Phase 4: Verify with integration tests, then extract next service
- Phase N: Decommission monolith
Each phase = 1 PR, with /verify gates between phases.
Use /save-session between phases. Use /resume-session to continue.
Use git worktrees for parallel service extraction when dependencies allow.
Recommended: Opus 4.6 for blueprint planning, Sonnet 4.6 for phase execution.
| Component | When to Reference |
|---|---|
configure-ecc | User hasn't set up ECC yet |
skill-stocktake | Audit which components are installed (use instead of hardcoded catalog) |
search-first | Research phase in optimized prompts |
blueprint | EPIC-scope optimized prompts (invoke as skill, not command) |
strategic-compact | Long session context management |
cost-aware-llm-pipeline |
Weekly Installs
452
Repository
GitHub Stars
102.1K
First Seen
11 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex431
cursor380
gemini-cli376
amp376
cline376
github-copilot376
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
138,300 周安装
Flutter Riverpod 2025 最佳实践:状态管理、代码生成与性能优化指南
404 周安装
Node.js最佳实践指南:构建健壮、高性能应用的核心技能
404 周安装
智能多引擎搜索技能 - 整合Tavily/DuckDuckGo/Bing API,自动切换最佳搜索引擎
404 周安装
竞争分析框架:方法论、信息传递比较与内容差距分析指南
405 周安装
iOS 17+ SwiftUI MapKit 与 CoreLocation 开发指南:地图、定位、地理围栏
405 周安装
FastMCP Python框架:快速构建MCP服务器,为Claude等大模型提供工具与资源
405 周安装
composer.json → PHP*.csproj / *.sln → .NETMakefile / CMakeLists.txt → C / C++cpanfile / Makefile.PL → Perl| "Design the data model" |
| — |
| doc-updater |
| Infrastructure | /plan, /verify | docker-patterns, deployment-patterns, database-migrations | architect |
| Design (MEDIUM-HIGH) | /plan | — | planner, architect |
| Design (EPIC) | — | blueprint (invoke as skill) | planner, architect |
| code-reviewer |
| C++ | cpp-coding-standards, cpp-testing | code-reviewer |
| Other / Unlisted | coding-standards (universal) | code-reviewer |
/code-review. Then use security-reviewer agent. |
| Docs | /update-docs. /update-codemaps. |
| EPIC | Use blueprint skill for "[objective]". Execute phases with /verify gates. |
| Token optimization recommendations |