You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,11 +36,12 @@ This automated setup includes:
36
36
- 🔧 Comprehensive Python developer system prompt
37
37
- 🚀 Convenience launchers for quick startup
38
38
39
-
**⚠️ IMPORTANT: After setup, use the simple command:**
39
+
**✅ After setup, use the simple command:**
40
40
```bash
41
-
claude-python
41
+
claude-python# Works in all Windows shells (PowerShell, CMD, Git Bash)
42
42
```
43
-
That's it! The setup script registers this command globally.
43
+
44
+
The setup automatically creates properly escaped wrappers for each Windows shell, ensuring the Python developer system prompt loads correctly regardless of which shell you use.
44
45
45
46
---
46
47
@@ -205,12 +206,14 @@ After running the Python setup script:
205
206
claude doctor
206
207
207
208
# 2. Start Claude with Python configuration - just run:
208
-
claude-python
209
+
claude-python# Windows: Git Bash ONLY!
209
210
210
211
# That's it! The command is registered globally during setup
211
212
```
212
213
213
-
**⚠️ Common Mistake:** Running `claude` directly won't load the Python system prompt! Always use `claude-python` command.
214
+
**⚠️ Common Mistakes:**
215
+
- Running `claude` directly won't load the Python system prompt!
216
+
- On Windows: `claude-python` ONLY works in Git Bash, NOT in PowerShell or CMD!
214
217
215
218
For IDE integration:
216
219
-**VS Code**: Configure terminal to use the launcher script
In `cmd.exe`, double quotes group a path with spaces into a single token, so the program launched is Git Bash. Inside a quoted argument for a Windows program, backslash-quote `\"` is the standard way to embed a literal double quote in the same argument, per the Microsoft C runtime command-line parsing rules that most Windows programs use. ([Microsoft Learn][1])
11
+
12
+
***Everything after that becomes arguments to `bash.exe`**
13
+
`-l` asks Bash to run as a login shell, and `-c "…"` tells Bash to execute the given command string. CMD passes that entire string as one argument because it is wrapped in double quotes. Also note that characters like `&` and `|` are special in CMD, which is why wrapping the `-c` payload in quotes is required to avoid CMD’s own metacharacter parsing. ([Microsoft Learn][2])
14
+
15
+
***Command-line length caveat**
16
+
CMD itself imposes about **8191** characters as the maximum command-line length. Your line stays far under that, so it executes reliably, but it is a useful limit to remember when you embed long data. The underlying Win32 `CreateProcess` API allows up to **32767** characters, however when you invoke via CMD you are bound by CMD’s lower limit. ([Microsoft Learn][3], [Microsoft for Developers][4])
17
+
18
+
# 2) What Bash does with `-lc "…"`
19
+
20
+
The string given to `-c` is parsed by Bash, not by CMD. Inside that string:
21
+
22
+
***`~/.claude/prompts/python-developer.md`**
23
+
Tilde expansion happens in Bash, `~` becomes the current user’s home. In Git Bash, home maps to your Windows profile directory and POSIX-style drive prefixing is used, for example `/c/Users/<name>`. ([GNU][5], [MSYS2][6])
24
+
25
+
***`< file` input redirection**
26
+
The `<` operator redirects the named file to the standard input of the command on its left. Here it feeds the prompt file into `tr`. ([GNU][7])
27
+
28
+
***`tr -d '\r'`**
29
+
`tr` is run from GNU coreutils. With `-d`, `tr` deletes every occurrence of the characters listed, so `'\r'` strips Windows carriage returns, leaving clean LF line endings. That prevents odd parsing issues when multi-line text later becomes a single shell argument. ([GNU][8])
30
+
31
+
***`p=$( … )` command substitution**
32
+
`$( … )` runs the command and substitutes its standard output. Bash captures all bytes from `tr` and assigns them to the variable `p`. Trailing newlines are removed, embedded newlines are preserved, which is exactly what you want for a multi-line system prompt. ([GNU][9])
33
+
34
+
***`exec claude --append-system-prompt="$p"`**
35
+
`exec` replaces the current Bash process with the `claude` CLI, so you do not keep an extra shell in the foreground. The value expansion is **double-quoted**, which is the critical part. In Bash, double quotes suppress word splitting and globbing, so the entire multi-line value in `p` is passed to `--append-system-prompt` as one argument, even if the first line begins with `---`. This avoids the classic “unknown option '---'” failure that happens when a multi-line value is accidentally split into separate argv tokens. ([GNU][10])
36
+
37
+
# 3) Why this pattern succeeds where others fail
38
+
39
+
***CMD’s quoting and metacharacters are tricky**
40
+
Without the outer double quotes, CMD would try to interpret `&`, `|`, `(`, and `)` in your Bash payload, which would corrupt the command. Quoting once at the CMD layer hands one opaque argument to `bash.exe`, and all further parsing is done by Bash, which is what you want here. ([Microsoft Learn][2])
41
+
42
+
***The value is bound to the flag as a single argv element**
43
+
The combination of Bash variable assignment, quoting, and `exec` ensures `claude` receives exactly two things for this feature, the flag name and one value string. Because the value is already the next argv item, the CLI parser treats it as data, not as another option, even if its first characters are `---`. The “single argument” property comes from Bash’s word-splitting rules, which say that expansions enclosed in double quotes are not split. ([GNU][11])
44
+
45
+
***CRLF normalization prevents stray `\r` from leaking**
46
+
CR characters in Windows-created files can sneak into an argument and confuse downstream parsers. Removing `\r` with `tr -d '\r'` is a simple, POSIX-friendly way to normalize the text before it becomes an argument. ([GNU][8])
47
+
48
+
# 4) Micro-timeline of execution
49
+
50
+
1.`cmd.exe` launches `bash.exe` with `-lc "<payload>"`. The quotes make the payload one argument, and embedded `\"` sequences survive as literal quotes inside that argument per the CRT argument rules. ([Microsoft Learn][1])
51
+
2. Bash, as a login shell due to `-l`, executes the `-c` string. It expands `~`, redirects the file into `tr`, deletes `\r`, and captures the result in `p` via command substitution. ([GNU][5])
52
+
3. Bash runs `exec claude --append-system-prompt="$p"`. Because `$p` is double-quoted, it is passed as one multi-line value. The shell process is replaced by the CLI, so the terminal is attached directly to `claude`. ([GNU][10])
53
+
54
+
That is the complete mechanics behind your working CMD line.
55
+
56
+
[1]: https://learn.microsoft.com/en-us/cpp/c-language/parsing-c-command-line-arguments?view=msvc-170&utm_source=chatgpt.com"Parsing C command-line arguments"
[3]: https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation?utm_source=chatgpt.com"Command prompt line string limitation - Windows Client"
59
+
[4]: https://devblogs.microsoft.com/oldnewthing/20031210-00/?p=41553&utm_source=chatgpt.com"What is the command line length limit? - The Old New Thing"
0 commit comments