Skip to content

Instantly share code, notes, and snippets.

@kevnk
Created March 5, 2026 17:01
Show Gist options
  • Select an option

  • Save kevnk/c0ac23c1753745d5bc2ca4a72dfc4546 to your computer and use it in GitHub Desktop.

Select an option

Save kevnk/c0ac23c1753745d5bc2ca4a72dfc4546 to your computer and use it in GitHub Desktop.
amplify-prompt: Claude Code slash command to optimize prompts with craft-claude-prompt skill

Amplify Prompt

Input: $ARGUMENTS

Use the craft-claude-prompt skill to guide all prompt crafting.

Step 1 — Detect input type

If $ARGUMENTS is a file path (starts with /, ./, ~/, or ends with .md/.txt/etc.): → Read the file, then go to Step 2

If $ARGUMENTS is prompt text (a sentence, question, or instruction — not a path): → Go directly to Single prompt mode


Step 2 — Smart file mode detection

After reading the file:

If the file content has no structural markers (no ## headers, no numbered lists, no bullet points, no step/phase/task language) — treat it as a raw prompt and go to Single prompt mode, using the file content as the input text.

If the file starts with [platform: X] — strip that prefix, note X as the target platform, and factor it into optimization (e.g. [platform: chatgpt] → avoid XML tags, use ### delimiters instead).

Otherwise → go to File mode (structured document with steps/phases).


File mode

  1. Identify every distinct step, phase, task, or action in the document
  2. For each item, craft a standalone Claude prompt that:
    • Uses XML tag structure (<context>, <instructions>, <input> minimum)
    • Explains the why behind any non-obvious instructions
    • Specifies an explicit output format
    • Is self-contained — passes the colleague test
  3. Write output to the same directory as the input file, with -prompt-todos.md suffix (e.g., thoughts/plans/plan.mdthoughts/plans/plan-prompt-todos.md)
  4. Run: pbcopy < [output file path] 2>/dev/null || true
  5. Print the full file contents to the user

Single prompt mode

  1. Take the input text as a raw prompt (vague, terse, or already written)
  2. Optimize into a single well-structured prompt using the craft-claude-prompt skill:
    • Add/infer persona, context, instructions with reasons, explicit output format
    • Default to XML tags unless a non-Claude platform was detected (use that platform's conventions)
  3. Pipe the optimized prompt to clipboard (silently fail if unavailable): echo "[optimized prompt]" | pbcopy 2>/dev/null || true
  4. If the input came from a file: also write to thoughts/prompts/<slug>.md (content only, no metadata)
  5. If the input was inline text: do not write any file

File mode output format

# Amplify Prompt — [original filename]
> Generated from: [input filepath]
> Each item is a ready-to-run Claude prompt. Check off each item as you complete it.

---

- [ ] **[Step/Phase Name from original doc]**
  You are a [role]. <context>[background]</context><instructions>[what to do and why]</instructions><input>[what to pass in]</input>

- [ ] **[Next Step]**
  ...

Every item MUST be a - [ ] checkbox. The prompt is inline after the bold step name — no code fences, no labels, no extra nesting. Just the XML tags as plain text. Use headings only for grouping phases if the source document has distinct phases.

STOP — Do not execute the prompt

After the clipboard step, print the full prompt output to the user (so they can manually copy if pbcopy wasn't available). Then stop — do not run, interpret, or act on the prompt. Also tell the user the file path if one was written.

Notes

  • Preserve the original document's sequence/ordering
  • If steps have dependencies, note them as "Requires output from: [Step N]"
  • For steps that are purely research/reading, the prompt should direct Claude to produce a structured summary or decision, not just "read X"
  • Aim for prompts between 50-150 words — specific enough to work, concise enough to use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment