nidhinjs/prompt-master
Prompt Master 是 nidhinjs 发布的 Claude skill,用于为 Claude、ChatGPT、Cursor、Midjourney 等 AI tool 生成或改写 prompt。其 pipeline 包括 tool 检测、9 个意图维度提取、最多 3 个澄清问题、template 路由、token efficiency audit 和 Memory Block。MIT License。

一个能为任何 AI tool 编写准确 prompt 的 Claude skill。不会浪费 token 或 credits。完整保留上下文和记忆。不需要反复 re-prompt 才得到本该第一次就拿到的答案。
适用于: Claude、ChatGPT、Gemini、o1/o3、MiniMax、Cursor、Claude Code、GitHub Copilot、Windsurf、Bolt、v0、Lovable、Devin、Perplexity、Midjourney、DALL-E、Stable Diffusion、ComfyUI、Sora、Runway、ElevenLabs、Zapier、Make,以及你使用的任何 AI tool。
🚀 安装
推荐方式 - Claude.ai(浏览器)
- 将此 repo 下载为 ZIP
- 前往 claude.ai → Sidebar → Customize → Skills → Upload a Skill
或直接 Clone 到 Claude Code skills 目录(不建议)
mkdir -p ~/.claude/skills
git clone https://github.com/nidhinjs/prompt-master.git ~/.claude/skills/prompt-master
🔥 它解决的问题
每个 AI 用户都以同样的方式浪费 credits:
写一个模糊的 prompt → 得到错误输出 → re-prompt → 更接近一点 → 再次 re-prompt → 终于在第 4 次尝试得到想要的结果
这就是 3 次浪费的 API 调用。每天 50 个 prompt 乘起来,就是真金白银和真实时间的损耗。
关键洞察
“最好的 prompt 不是最长的,而是每个词都承担作用的那个。”
大多数“prompt generators”会把 prompt 变长。这个 skill 会让它们更锋利。
🎯 用法
在 Claude 中,你可以自然地调用这个 skill:
Write me a prompt for Cursor to refactor my auth module
I need a prompt for Claude Code to build a REST API — ask me what you need to know
Here's a bad prompt I wrote for GPT-4o, fix it: [paste prompt]
Generate a Midjourney prompt for a cyberpunk city at night
I have a reference image — help me write a prompt to edit just the head angle
Break this prompt down and adapt it for Stable Diffusion
也可以显式调用:
/prompt-master
I want to ask Claude Code to build a todo app with React and Supabase
工作原理
Prompt Master 会对每个请求运行一个结构化 pipeline:
- 检测目标 tool — 判断 prompt 面向哪个 AI system,并静默路由到正确方法
- 提取 9 个意图维度 — task、input、output、constraints、context、audience、memory、success criteria、examples
- 提出有针对性的澄清问题 — 如果缺少关键信息,最多问 3 个问题,绝不更多
- 路由到正确 framework — 自动选择并应用正确的 prompt architecture,不会展示给用户
- 只应用安全技术 — 按需使用 role assignment、few-shot examples、XML structure、grounding anchors、memory block
- 运行 token efficiency audit — 移除所有不会改变输出的词
- 交付 prompt — 一个干净、可复制的代码块,附一行 strategy note
完整示例 #1:生成图像 prompt
用户输入
Write me a midjourney prompt for a realistic samurai standing in the rain at night
生成的 Prompt
lone samurai standing in heavy rain at night, traditional armor,
neon reflections on wet cobblestone street, cinematic lighting,
dramatic shadows, fog, ultra detailed, photorealistic,
shallow depth of field --ar 16:9 --v 6 --style raw
negative: blurry, low quality, watermark, cartoon, anime, extra limbs
🎯 目标: Midjourney · ⚡ Framework: Visual Descriptor · 💰 Tokens: 轻量(~60) · 💡 策略: 用逗号分隔的 descriptors 替代 prose,提前固定 lighting 和 mood,锁定 aspect ratio 和 version,negative prompt 防止风格漂移。
完整示例 #2:生成 Coding prompt
用户输入
Build a claude code prompt for a landing page for a business
dashboard that looks and feels exactly like notion - smooth animations,
clean ui
生成的 Prompt
Objective:
Build a fully detailed, production-quality static landing page for a
business dashboard product. Design must match Notion's exact aesthetic —
clean, minimal, typographic, with smooth animations throughout.
Stack:
Single HTML file with embedded CSS and vanilla JS. No frameworks.
No external dependencies except Google Fonts (Inter).
Design Spec — match these exactly:
- Background: #ffffff
- Primary text: #1a1a1a
- Secondary text: #6b7280
- Border color: #e5e7eb
- Accent: #000000
- Font: Inter, weights 400 / 500 / 600 / 700
- Base spacing unit: 8px
- Border radius: 6px on cards, 4px on buttons
- Box shadows: 0 1px 3px rgba(0,0,0,0.08) only — no dramatic shadows
- Buttons: black fill, white text, no border radius above 6px
Sections to build in order:
1. Navbar — logo left, nav links center, "Get started free" CTA right.
Sticky on scroll, adds subtle border-bottom on scroll with JS.
2. Hero — large left-aligned heading (max 3 lines), subtext, two CTAs
(primary black + secondary outlined), hero screenshot mockup
placeholder (gray rounded card, 16:9 ratio).
3. Logos bar — "Trusted by teams at..." with 5 placeholder company names
in muted gray, centered.
4. Features — 3-column grid. Each card: icon (use emoji), bold title,
2-line description. Hover state: border darkens to #d1d5db,
translateY(-2px), transition 200ms ease.
5. How it works — alternating left/right layout, 3 steps. Number badge,
heading, description, placeholder screenshot card.
6. Pricing — 2 tiers side by side. Free tier: outlined card. Pro tier:
black background, white text, "Most popular" badge. List 4 features
each with checkmarks.
7. CTA banner — full-width dark section, centered heading, subtext,
single CTA button.
8. Footer — 4-column links, copyright line, minimal.
Animations — implement all of these:
- Fade-in + translateY(20px) to translateY(0) on scroll for every section,
using IntersectionObserver. Threshold 0.15. Duration 500ms ease-out.
- Staggered animation on feature cards: 100ms delay between each card.
- Navbar CTA button: background transitions from black to #333 on hover,
200ms ease.
- Hero CTA primary: same hover transition. Secondary: background goes from
transparent to #f3f4f6 on hover.
- Smooth scroll on all anchor links.
- Navbar border-bottom fades in on scroll past 60px using JS scroll event.
Constraints:
- Single file only — all CSS and JS embedded, no external files
- No dependencies except Google Fonts via CDN link tag
- All placeholder images replaced with styled gray div elements
- Must be pixel-perfect at 375px mobile and 1440px desktop
- No CSS frameworks, no utility classes from external sources
Done When:
- All 8 sections render correctly at both breakpoints
- All animations trigger on scroll without layout shift
- Navbar sticks and border appears on scroll
- Hover states work on all interactive elements
- Opens in browser with zero console errors
🎯 目标: Claude Code · 💰 Tokens: 中等(~380) · 💡 策略: 将所有模糊的 Notion aesthetic cue 转换为精确的 hex value 和 pixel spec——Claude Code 不会猜错。Animations 用准确的 timing、method 和 trigger 定义,避免任何解释空间。
🤝 适用于任何 AI Tool
Prompt Master 包含 20+ 个 tool 的特定 profiles。对于列表之外的任何 tool,它会使用 Universal Fingerprint:4 个问题,让它能为从未见过的任何 AI system 编写高质量 prompt。
| Tool | 类别 | Prompt Master 修复什么 |
|---|---|---|
| Claude | Reasoning LLM | 移除填充内容,添加 XML structure,指定长度 |
| ChatGPT / GPT-5.x | Reasoning LLM | Output contract、verbosity control、completion criteria |
| Gemini 2.x | Reasoning LLM | Grounding anchors、citation rules、format locks |
| o3 / o4-mini | Thinking LLM | 只使用简短、干净的 instructions——绝不添加 CoT(它们会内部思考) |
| Ollama | Local LLM | 询问加载的是哪个 model,为 Modelfile 包含 system prompt |
| Qwen 2.5 / Qwen3 | Open-weight LLM | Chat template format、thinking vs non-thinking mode detection |
| Local models (Llama, Mistral) | Open-weight LLM | 更短的 prompts、更简单的 structure、无复杂嵌套 |
| DeepSeek-R1 | Reasoning LLM | 简短、干净的 instructions,移除 CoT,必要时抑制 thinking output |
| MiniMax (M2.7 / M2.5) | Reasoning LLM | Temperature clamping、thinking tag control、structured output optimization |
| Claude Code | Agentic AI | Stop conditions、file scope、checkpoint output |
| Cursor / Windsurf | IDE AI | File path、function name、do-not-touch list、sequential prompt guidance |
| Cline(原 Claude Dev) | Agentic IDE | File scope、approval gates、stop conditions、task breakdown |
| GitHub Copilot | Autocomplete AI | 将精确的 function contract 写成 docstring |
| Antigravity | Agentic IDE | Task-based prompting、Artifact verification、autonomy level |
| Bolt / v0 / Lovable | Full-stack generator | Stack spec、version、不要 scaffold 的内容 |
| Figma Make | Full-stack generator | Component name references、frame-to-code scope |
| Google Stitch | Full-stack generator | 用 interface goal 替代 implementation,Material Design 3 spec |
| Devin / SWE-agent | Autonomous agent | Starting state、target state、stop conditions |
| Manus | Autonomous agent | Task outcome focus、permission scope、memory anchors |
| OpenAI Computer Use | Computer-use agent | Screen state、allowed apps、在不可逆操作前停止 |
| Perplexity Computer | Computer-use agent | Artifact-first prompting、scoped permissions、verification steps |
| OpenClaw | Computer-use agent | Conversational precision、persistent memory、security constraints |
| Perplexity / SearchGPT | Search AI | Mode spec:search vs analyze vs compare |
| Midjourney | Image AI | 逗号分隔的 descriptors、parameters、negative prompts |
| DALL-E 3 | Image AI | Prose description、text exclusion——检测 edit vs generate |
| Stable Diffusion | Image AI | Weight syntax (word:1.3)、CFG guidance、强制 negative prompt |
| SeeDream | Image AI | Art style 优先,mood 和 atmosphere descriptors,negative prompt |
| ComfyUI | Image AI | Positive/negative node split、checkpoint-specific syntax |
| Meshy / Tripo / Rodin | 3D AI | Style + export format + polygon budget + rig requirements |
| BlenderGPT | 3D AI | Python script output、Blender version、scene context |
| Unity AI | 3D / Game AI | Game genre、platform target,用 mechanic description 替代 code |
| Sora / Runway | Video AI | Camera movement、duration、cut style |
| LTX / Dream Machine / Kling | Video AI | Cinematic language、motion intensity、style reference |
| ElevenLabs | Voice AI | Emotion、pacing、emphasis、speech rate |
| Zapier / Make / n8n | Workflow automation | Trigger app + event、action app + field mapping |
📐 12 个 Prompt Templates(自动选择)
Prompt Master 会自动为每个 task 选择正确的 architecture 并静默路由——你不会看到 framework name,只会看到 prompt。
| Template | 最适合 |
|---|---|
| RTF (Role, Task, Format) | 快速 one-shot tasks |
| CO-STAR (Context, Objective, Style, Tone, Audience, Response) | 专业文档、报告、商业写作 |
| RISEN (Role, Instructions, Steps, End Goal, Narrowing) | 复杂多步骤项目 |
| CRISPE (Capacity, Role, Insight, Statement, Personality, Experiment) | 创意工作、品牌语气、迭代内容 |
| Chain of Thought | 数学、逻辑、debugging、多步骤分析 |
| Few-Shot | 一致的结构化输出、模式复刻 |
| File-Scope Template | Cursor、Windsurf、Copilot——任何 code editing AI |
| ReAct + Stop Conditions | Claude Code、Devin、AutoGPT——任何 autonomous agent |
| Visual Descriptor | Midjourney、DALL-E、Stable Diffusion、Sora——generation |
| Reference Image Editing | 编辑现有图像——自动检测 edit vs generate |
| ComfyUI | Node-based image workflows——按 checkpoint 拆分 positive/negative |
| Prompt Decompiler | 拆解、改写、简化或拆分现有 prompts |
🛡️ 5 种安全技术,按需应用
Prompt Master 只使用效果可靠、边界明确的技术。已知会产生 hallucinations 或不可预测输出的方法(Tree of Thought、Graph of Thought、Universal Self-Consistency、prompt chaining)被明确排除。
| Technique | 作用 |
|---|---|
| Role Assignment | 指定具体 expert identity,以校准深度和词汇 |
| Few-Shot Examples | 当 format consistency 比 instructions 更重要时,添加 2-5 个 examples |
| XML Structural Tags | 为能可靠解析 XML 的 Claude-based tools 包装 sections |
| Grounding Anchors | 为事实和 citation tasks 添加 anti-hallucination rules |
| Chain of Thought | 强制 logic tasks 进行 step-by-step reasoning——绝不应用于 o1/o3 |
🚫 检测 35 种消耗 credits 的模式(含 Before/After 示例)
| # | Pattern | Before | After |
|---|---|---|---|
| 1 | 模糊的 task verb | “help me with my code” | “Refactor getUserData() to use async/await and handle null returns” |
| 2 | 一个 prompt 里放两个 tasks | “explain AND rewrite this function” | 拆分:先 explain,再 rewrite |
| 3 | 没有 success criteria | “make it better” | “Done when function passes existing unit tests and handles null input” |
| 4 | 过度授权的 agent | “do whatever it takes” | 明确 allowed + forbidden actions list |
| 5 | 情绪化的 task description | “it's totally broken, fix everything” | “Throws uncaught TypeError on line 43 when user is null” |
| 6 | Build-the-whole-thing | “build my entire app” | 拆成 Prompt 1(scaffold)、Prompt 2(feature)、Prompt 3(polish) |
| 7 | 隐式引用 | “now add the other thing we discussed” | 始终重述完整 task,不要引用“the thing we discussed” |
Context Patterns
| # | Pattern | Before | After |
|---|---|---|---|
| 8 | 假定已有先验知识 | “continue where we left off” | 加入包含所有 prior decisions 的 Memory Block |
| 9 | 没有 project context | “write a cover letter” | “PM role at B2B fintech, 2yr SWE experience, shipped 3 features as tech lead” |
| 10 | 忘记 stack | 新 prompt 与先前技术选择矛盾 | 始终包含 Memory Block |
| 11 | 诱发 hallucination | “what do experts say about X?” | “Cite only sources you are certain of. If uncertain, say so.” |
| 12 | 未定义 audience | “write something for users” | “Non-technical B2B buyers, no coding knowledge, decision-maker level” |
| 13 | 不提先前失败 | (空白) | “I already tried X and it failed because Y. Do not suggest X.” |
| # | Pattern | Before | After |
|---|---|---|---|
| 14 | 缺少 output format | “explain this concept” | “3 bullet points, each under 20 words, one-sentence summary at top” |
| 15 | 隐含长度 | “write a summary” | “Write a summary in exactly 3 sentences” |
| 16 | 没有 role assignment | (空白) | “You are a senior backend engineer specializing in Node.js and PostgreSQL” |
| 17 | 模糊的 aesthetic adjectives | “make it look professional” | “Monochrome palette, 16px base font, 24px line height, no decorative elements” |
| 18 | 没有 negative prompts(image AI) | “a portrait of a woman” | 添加:“no watermark, no blur, no extra fingers, no distortion, no text” |
| 19 | 给 Midjourney 用 prose prompt | 完整描述句 | “subject, style, mood, lighting, --ar 16:9 --v 6” |
| # | Pattern | Before | After |
|---|---|---|---|
| 20 | 没有 scope boundary | “fix my app” | “Fix only login form validation in src/auth.js. Touch nothing else.” |
| 21 | 没有 stack constraints | “build a React component” | “React 18, TypeScript strict, no external libraries, Tailwind only” |
| 22 | 没有 agent stop condition | “build the whole feature” | 明确 stop conditions + 每一步后的 checkpoint |
| 23 | 没有 IDE AI 的 file path | “update the login function” | “Update handleLogin() in src/pages/Login.tsx only” |
| 24 | 对 tool 使用了错误 template | 在 Cursor 中使用 GPT-style prose | 改写为包含 path + scope 的 File-Scope Template |
| 25 | 粘贴整个 codebase | 每个 prompt 都给出完整 repo context | 只限定到相关 function 和 file |
| # | Pattern | Before | After |
|---|---|---|---|
| 26 | logic task 没有 CoT | “which approach is better?” | “Think through both approaches step by step before recommending” |
| 27 | 给 reasoning models 添加 CoT | 给 o1/o3 发送 “think step by step” | 移除;reasoning models 会内部思考,CoT instructions 会降低输出质量 |
| 28 | 复杂输出没有 self-check | (无) | “Before finishing, verify output against the constraints above” |
| 29 | 期待跨 session memory | “you already know my project” | 始终重新提供 Memory Block |
| 30 | 与先前决策矛盾 | 新 prompt 忽略早期 architecture | 包含所有既定事实的 Memory Block |
| # | Pattern | Before | After |
|---|---|---|---|
| 31 | 没有 starting state | “build me a REST API” | “Empty Node.js project, Express installed, src/app.js exists” |
| 32 | 没有 target state | “add authentication” | “/src/middleware/auth.js with JWT verify. POST /login and POST /register in /src/routes/auth.js” |
| 33 | 沉默的 agent | 没有 progress output | “After each step output: ✅ [what was completed]” |
| 34 | 未锁定 filesystem | 没有 file restrictions | “Only edit files inside src/. Do not touch package.json, .env, or any config file.” |
| 35 | 没有 human review trigger | Agent 自行决定一切 | “Stop and ask before: deleting any file, adding any dependency, or touching the database schema” |
🧠 Memory Block System
当对话有历史时,Prompt Master 会提取先前决策,并在前面添加 Memory Block,确保 AI 不会与早期工作相矛盾:
## Memory (Carry Forward from Previous Context)
- Stack: React 18 + TypeScript + Supabase
- Auth uses JWT stored in httpOnly cookies, not localStorage
- Component naming convention: PascalCase, no default exports
- Design system: Tailwind only, no custom CSS files
- Architecture: no Redux, context API only
这是长 session 中最重要的修复。大多数浪费的 re-prompts 都源于 AI 忘记你已经决定过的内容。
ℹ️ 版本历史
- 1.6.0 — Opus 4.7 更新。添加 Template M(Opus 4.7 Task Brief)。更新 Claude 和 Claude Code routing,以支持 literalism、adaptive thinking、xhigh effort 和 session hygiene。添加 patterns 36–37。
- 1.5.0 — 添加更多 tool routing。新增 Agentic AI 和 3D Model AI routing。将 description 修正为 189 个字符。移除输出中的 token estimate。添加 instruction layer 和 copywriting placeholders
- 1.4.0 — 添加 reference image editing detection、ComfyUI support、Prompt Decompiler mode。修复 trigger description,使其在 Claude Code 中正确调用。向 references folder 添加 3 个新 templates
- 1.3.0 — 基于 PAC2026 positional structure(30/55/15)重建。Silent routing 替代面向用户的 framework selection。引入 references folder
- 1.2.0 — 为 attention architecture 重构。移除易导致 fabrication 的技术(ToT、GoT、USC、prompt chaining)。Templates 和 patterns 移至 references folder
- 1.1.0 — 扩展 tool coverage,添加 memory block system、35 个 credit killing patterns
- 1.0.0 — 初始发布
📄 License
MIT:详见 LICENSE。