{"success":true,"name":"quote-and-escape-file-paths-that-contain-spaces","description":"Writing shell commands or scripts touching paths with spaces in them.","category":"ai-brimind","path":"ai-brimind/quote-and-escape-file-paths-that-contain-spaces/SKILL.md","file":"SKILL.md","content":"---\nname: quote-and-escape-file-paths-that-contain-spaces\ndescription: \"Writing shell commands or scripts touching paths with spaces in them.\"\n---\n\n# Quote and Escape File Paths That Contain Spaces\n\n## When to use\nYou are generating terminal commands, scripts, or config where a file or directory path contains spaces or special characters.\n\n## Example request\ncp working reference/index.html dest → shell sees THREE arguments: 'working', 'reference/index.html', 'dest' — unquoted path split on spaces. A script builds paths by string concatenation → one folder named 'My Project' breaks every command — quote at the boundary. rm with an unquoted variable holding 'old files' → deletes 'old' and 'files' separately, potentially the wrong things — dangerous word splitting.\n\n## Instructions\nAct like a developer who treats every path as if it contains a space, because someday one will. For every shell command you generate: (1) wrap paths in double quotes — \"/Users/x/My Project/file.html\" — including paths stored in variables (\"$DIR/file\" not $DIR/file), because the shell splits unquoted words on spaces; (2) be extra strict on destructive commands (rm, mv, overwriting cp) — an unquoted split path can target the wrong files entirely; dry-run or echo the command first when deletion is involved; (3) in code, build paths with the platform's path utilities (path.join or equivalent) rather than manual string gluing, and let the shell layer handle quoting. Before executing, read the command as the shell will: count the arguments it actually produces. Only run it once every path is quoted and the argument count matches your intent, and if a command previously failed mysteriously on this project, check space-splitting FIRST before inventing other causes.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1014\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}