Copy-Paste Via File
Chat-rendered code blocks can hard-wrap inside string literals and regex bodies when copied, producing SyntaxError: Invalid or unexpected token or silent corruption. Especially common when pasting into a browser DevTools Console, an SSH terminal, or a form field that doesn't normalize whitespace.
When to Use
Trigger this skill whenever the assistant is about to ask the user to copy-paste any of:
- A DevTools Console one-liner (especially with regex literals like
/\s+/g).
- A multi-quote, multi-escape shell command.
- A long URL with query parameters that may wrap.
- A multi-paragraph prompt body (system prompt, debate brief, email draft) where chat may add hanging indents.
- Any JSON literal embedded in a JS expression.
Skip when the snippet is short, single-token, and contains no escapes (e.g. a single CLI flag, a path, a 2-3 word answer). Trust the user's chat copy for those.
How to Apply
- Pick a stable, descriptive file path under the active project's working area, e.g.
~/projects/<project>/scratch/<short-name>.<ext>. Reuse an existing path if the same kind of probe is being repeated.
- Use the file extension that matches the destination (
.js for DevTools, .sh for shell, .txt for prompts, .sql for queries).
- Write the content with the
Write tool. Do not add wrapping fences, language tags, or "copy this:" preamble. The file content is exactly what gets pasted.
- Open the file in a plain-text editor via the shell (e.g.
open -a TextEdit <path> on macOS) so the user can select-all / copy cleanly.
- Tell the user the file path (one line), that the open command was run (one line), and what to do with the copied text (one line). No more.
Example
User says: "I need to inspect every input on this signup page."
Assistant action:
Write(~/projects/my-app/scratch/devtools-form-audit-probe.js, <one-line JS>)
Bash(open -a TextEdit <path>)
- Reply: "Saved to
<path>. Opened in TextEdit. Select all, copy, paste into the DevTools Console, Enter."
Why
- No mangling. A plain-text editor preserves exact bytes; chat copy can fold lines.
- Auditable. The exact pasted command stays on disk for replay or to share with another agent.
- Faster on retries. If the first paste fails, the user doesn't re-format from chat — they re-copy from the same file.
Standing Authorization
Once you've validated this pattern works for your own workflow, treat it as standing permission — don't re-ask each time. Just do it whenever the trigger conditions match.
1---2name: copy-paste-via-file3description: Whenever the assistant needs the user to copy-paste a command, code snippet, prompt, or any text where chat-rendered formatting could mangle line wrapping, regex literals, or string contents (e.g. DevTools console one-liners, terminal commands with quoted JSON, long URLs, multi-line prompts), write the exact text to a file and open it so the user can copy it clean. Use whenever the assistant is about to say "paste this command into..." or similar, especially for browser DevTools console pastes, complex shell commands, or anything containing regex literals, escaped quotes, or backticks.4---56# Copy-Paste Via File78Chat-rendered code blocks can hard-wrap inside string literals and regex bodies when copied, producing `SyntaxError: Invalid or unexpected token` or silent corruption. Especially common when pasting into a browser DevTools Console, an SSH terminal, or a form field that doesn't normalize whitespace.910## When to Use1112Trigger this skill whenever the assistant is about to ask the user to copy-paste any of:1314- A DevTools Console one-liner (especially with regex literals like `/\s+/g`).15- A multi-quote, multi-escape shell command.16- A long URL with query parameters that may wrap.17- A multi-paragraph prompt body (system prompt, debate brief, email draft) where chat may add hanging indents.18- Any JSON literal embedded in a JS expression.1920Skip when the snippet is short, single-token, and contains no escapes (e.g. a single CLI flag, a path, a 2-3 word answer). Trust the user's chat copy for those.2122## How to Apply23241. Pick a stable, descriptive file path under the active project's working area, e.g. `~/projects/<project>/scratch/<short-name>.<ext>`. Reuse an existing path if the same kind of probe is being repeated.252. Use the file extension that matches the destination (`.js` for DevTools, `.sh` for shell, `.txt` for prompts, `.sql` for queries).263. Write the content with the `Write` tool. **Do not** add wrapping fences, language tags, or "copy this:" preamble. The file content is exactly what gets pasted.274. Open the file in a plain-text editor via the shell (e.g. `open -a TextEdit <path>` on macOS) so the user can select-all / copy cleanly.285. Tell the user the file path (one line), that the open command was run (one line), and what to do with the copied text (one line). No more.2930## Example3132User says: "I need to inspect every input on this signup page."3334Assistant action:351. `Write(~/projects/my-app/scratch/devtools-form-audit-probe.js, <one-line JS>)`362. `Bash(open -a TextEdit <path>)`373. Reply: "Saved to `<path>`. Opened in TextEdit. Select all, copy, paste into the DevTools Console, Enter."3839## Why4041- **No mangling.** A plain-text editor preserves exact bytes; chat copy can fold lines.42- **Auditable.** The exact pasted command stays on disk for replay or to share with another agent.43- **Faster on retries.** If the first paste fails, the user doesn't re-format from chat — they re-copy from the same file.4445## Standing Authorization4647Once you've validated this pattern works for your own workflow, treat it as standing permission — don't re-ask each time. Just do it whenever the trigger conditions match.