بنقرة واحدة
operating-shell-platforms
Platform-specific shell command considerations for Windows PowerShell and Unix shells
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Platform-specific shell command considerations for Windows PowerShell and Unix shells
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Automated governance, hook installation, pre-commit validation, branch isolation, and safe commit operations.
Enforcement of safety guardrails, axiom verification, secret scanning, and mutability protections.
Building and managing premium statistical dashboards, RAG explorer UIs, warehouse log monitors, and real-time visualization centers.
Integration of agent systems with blockchain protocols, contracts, event stores, reputation networks, and collective verification engines.
AI model configuration, LLM memoization, agentic RAG search, and vector library maintenance.
Catalog generation, reference link verification, workshop documentation building, and knowledge gap analysis.
| agents | ["python-ai-specialist"] |
| category | chain |
| description | Platform-specific shell command considerations for Windows PowerShell and Unix shells |
| knowledge | ["powershell-patterns"] |
| name | operating-shell-platforms |
| related_skills | ["none"] |
| templates | ["none"] |
| tools | ["none"] |
| type | skill |
| version | 1.1.0 |
| references | ["none"] |
| settings | {"auto_approve":false,"retry_limit":3,"timeout_seconds":300,"safe_to_parallelize":false,"orchestration_pattern":"routing"} |
Platform-specific shell command considerations for Windows PowerShell and Unix shells
Handle platform-specific shell syntax differences when executing commands.
Handle platform-specific shell syntax differences when executing commands.
NEVER USE
&&IN WINDOWS POWERSHELL 5.x!The following pattern DOES NOT WORK and will ALWAYS fail:
cd "path" && git pullError:
Das Token "&&" ist in dieser Version kein gültiges AnweisungstrennzeichenUSE THIS INSTEAD:
cd "path"; & "C:\Program Files\Git\cmd\git.exe" pullThe
&&operator only works in PowerShell 7+ (pwsh.exe), NOT in Windows PowerShell 5.x (powershell.exe).
This is a recurring error - check user_info.Shell to detect PowerShell version.
> cd "path" && git pull
>
> cd "path"; & "C:\Program Files\Git\cmd\git.exe" pull
>
NEVER USE HEREDOC SYNTAX IN POWERSHELL!
The following pattern DOES NOT WORK and will ALWAYS fail:
git commit -m "$(cat <<'EOF' message EOF )"USE THIS INSTEAD:
git commit -m "Single line message"Or for multi-line:
git commit -m "Title" -m "Body paragraph"
This is a recurring error - always use simple string syntax on Windows.
> git commit -m "$(cat <<'EOF'
> message
> EOF
> )"
>
> git commit -m "Single line message"
>
> git commit -m "Title" -m "Body paragraph"
>
ALWAYS USE CONDA RUN WITH THE CORRECT ENVPATH!
The factory environment is strictly managed. For Python execution, use:
conda run -p D:\Anaconda\envs\cursor-factory python <script.py>Or the absolute interpreter path:
D:\Anaconda\envs\cursor-factory\python.exe <script.py>Mandatory Grounding: Before executing any shell-based task, agents MUST ground themselves in
.agent/knowledge/tech/powershell-patterns.json. This skill is LOCAL to this machine only. Do not apply automatically - always ask the user before applying platform-specific command adjustments.
Placeholder content for Process to satisfy validation.
Check user_info.OS to determine if running on Windows (win32), macOS (darwin), or Linux (linux).
If on Windows, check user_info.Shell to determine if using PowerShell 5.x (powershell.exe) or PowerShell 7+ (pwsh.exe).
&& with ;, avoid heredoc syntax, use multiple -m flags for git commits&& works, but prefer ; for compatibilityRead .cursor/cache/session-paths.json first to get verified tool paths before executing commands.
Run the platform-adapted command with appropriate syntax and tool paths.
First-time activation only: If this skill has not been confirmed yet, ask the user:
"I notice you're on Windows/PowerShell. Should I enable PowerShell-compatible syntax for shell commands? This setting will persist in your Cursor configuration."
Once the user confirms:
Status: ✅ ACTIVE (confirmed by user)
Check the user's OS from user_info:
win32 → Windows (PowerShell)darwin → macOS (zsh/bash)linux → Linux (bash)PowerShell does NOT support bash-style heredoc syntax:
# THIS DOES NOT WORK IN POWERSHELL:
git commit -m "$(cat <<'EOF'
Multi-line
commit message
EOF
)"
Option 1: Multiple -m flags (recommended for git commits)
git commit -m "Title line" -m "Body paragraph 1" -m "Body paragraph 2"
Option 2: Backtick for line continuation
git commit -m "Title line`n`nBody with newlines"
Option 3: Here-string (PowerShell native)
$message = @"
Title line
Body paragraph
"@
git commit -m $message
PowerShell uses different operators:
| Bash | PowerShell | Purpose |
||||
| && | ; or -and | Run if previous succeeds |
| || | -or | Run if previous fails |
| \| | \| | Pipe (same) |
Note: && and || work in PowerShell 7+ but NOT in Windows PowerShell 5.x.
# THIS DOES NOT WORK IN POWERSHELL:
git commit -m "$(cat <<'EOF'
Multi-line
commit message
EOF
)"
git commit -m "Title line" -m "Body paragraph 1" -m "Body paragraph 2"
git commit -m "Title line`n`nBody with newlines"
$message = @"
Title line
Body paragraph
"@
git commit -m $message
For cross-platform compatibility, use multiple -m flags:
git commit -m "feat: Short title" -m "Longer description of the change." -m "Additional details if needed."
This works on all platforms and produces proper multi-paragraph commit messages.
git commit -m "feat: Short title" -m "Longer description of the change." -m "Additional details if needed."
Tool paths are configurable via .cursor/config/tools.json with environment variable fallbacks.
See Configuration Guide for full details.
ALWAYS read the session cache first before running commands:
.cursor/cache/session-paths.json
This file contains verified working paths for the current machine. Reading this file ONCE at session start prevents repeated path resolution failures.
Resolution Priority:
.cursor/cache/session-paths.json) - FASTEST, already verified$env:PYTHON_PATH).cursor/config/tools.json)Agent Behavior:
session-paths.json to get working paths{
"paths": {
"python": "{PYTHON_PATH}",
"pip": "{PIP_PATH}",
"conda": "{CONDA_PATH}",
"pytest": "{PYTEST_PATH}",
"git": null
},
"workspace": {
"root": "{WORKSPACE_ROOT}",
"shell": "powershell"
}
}
Usage in Commands:
# Read from cache - path is already verified
{PYTHON_PATH} scripts/validation/validate_yaml_frontmatter.py
| Tool | Default Path | Env Variable | Notes |
||--|--|-|
| Python | {PYTHON_PATH} | PYTHON_PATH | Anaconda installation |
| Pip | {PIP_PATH} | PIP_PATH | Anaconda pip |
| Conda | {CONDA_PATH} | CONDA_PATH | Anaconda conda |
| GitHub CLI | {GH_CLI_PATH} | GH_CLI_PATH | CONFIGURABLE |
| Pytest | {PYTEST_PATH} | PYTEST_PATH | Anaconda pytest |
The GitHub CLI (gh) is installed at {GH_CLI_DIR} on this machine.
Usage:
# Full path (always works)
{GH_CLI_PATH} pr list
# Or via environment variable
& $env:GH_CLI_PATH pr list
Common Commands:
# List recent workflow runs
{GH_CLI_PATH} run list --limit 5
# View specific run
{GH_CLI_PATH} run view <run-id> --json jobs
# Create pull request
{GH_CLI_PATH} pr create --title "Title" --body "Description"
# List issues
{GH_CLI_PATH} issue list
# Create repository
{GH_CLI_PATH} repo create my-repo --public
When a path is verified to work, update the cache:
# After verifying {PYTHON_PATH} works, update cache
# The agent should read_file, modify, and write back
# Using environment variable (recommended)
& $env:GH_CLI_PATH run list --limit 5
# Or with default path
{GH_CLI_PATH} run list --limit 5
# View specific run details
{GH_CLI_PATH} run view <run-id> --json jobs
# Check job status
{GH_CLI_PATH} run view <run-id> --json jobs --jq ".jobs[] | {name, conclusion}"
# Create a pull request
{GH_CLI_PATH} pr create --title "Title" --body "Description"
# List open issues
{GH_CLI_PATH} issue list
For Linux/macOS, paths typically use forward slashes and may be simpler:
| Tool | Linux/macOS Path |
|||
| Python | python3 or /usr/bin/python3 |
| Pip | pip3 or /usr/bin/pip3 |
| GitHub CLI | gh or /usr/local/bin/gh |
.cursor/cache/session-paths.json
{
"paths": {
"python": "{PYTHON_PATH}",
"pip": "{PIP_PATH}",
"conda": "{CONDA_PATH}",
"pytest": "{PYTEST_PATH}",
"git": null
},
"workspace": {
"root": "{WORKSPACE_ROOT}",
"shell": "powershell"
}
}
# Read from cache - path is already verified
{PYTHON_PATH} scripts/validation/validate_yaml_frontmatter.py
# Full path (always works)
{GH_CLI_PATH} pr list
# Or via environment variable
& $env:GH_CLI_PATH pr list
# List recent workflow runs
{GH_CLI_PATH} run list --limit 5
# View specific run
{GH_CLI_PATH} run view <run-id> --json jobs
# Create pull request
{GH_CLI_PATH} pr create --title "Title" --body "Description"
# List issues
{GH_CLI_PATH} issue list
# Create repository
{GH_CLI_PATH} repo create my-repo --public
# After verifying {PYTHON_PATH} works, update cache
# The agent should read_file, modify, and write back
# Using environment variable (recommended)
& $env:GH_CLI_PATH run list --limit 5
# Or with default path
{GH_CLI_PATH} run list --limit 5
# View specific run details
{GH_CLI_PATH} run view <run-id> --json jobs
# Check job status
{GH_CLI_PATH} run view <run-id> --json jobs --jq ".jobs[] | {name, conclusion}"
# Create a pull request
{GH_CLI_PATH} pr create --title "Title" --body "Description"
# List open issues
{GH_CLI_PATH} issue list
&& in Windows PowerShell 5.x - use ; instead (e.g., cd path; git pull)<<EOF) in PowerShell - it ALWAYS failsgit commit -m "message"-m "Title" -m "Body"powershell.exe, apply Windows PowerShell 5.x rules# CORRECT - Simple message
git commit -m "feat: Add new feature"
# CORRECT - Multi-line with multiple -m
git commit -m "feat: Add new feature" -m "Detailed description here"
# WRONG - NEVER DO THIS IN POWERSHELL
git commit -m "$(cat <<'EOF'
message
EOF
)"
# CORRECT - Simple message
git commit -m "feat: Add new feature"
# CORRECT - Multi-line with multiple -m
git commit -m "feat: Add new feature" -m "Detailed description here"
# WRONG - NEVER DO THIS IN POWERSHELL
git commit -m "$(cat <<'EOF'
message
EOF
)"
[!IMPORTANT] Requirements:
Placeholder content for When to Use.
Placeholder content for Best Practices.