Powerful coding guide - no snytax errors anymore

Hello guys,

I have created an md file. you can always attach it to your prompts, and the models wont make any stupid snytax or terminal errors anymore. By using it, the agents effectiveness and efficiency have increased DRAMATICALLY and will also save a lot of tokens!!

Just create a md file of it: (changes might apply based on what stack you use. I use render for my deployment).

I have installed the windows cli mcp because cursors terminal often gets stuck… :

:robot: AGENT QUICK RULES – UNIVERSAL RULES
Only universal terminal/syntax rules for any prompt – specific workflows have separate files

:high_voltage: EMERGENCY FIXES
bash
copy
edit

Terminal is frozen

taskkill /F /IM python.exe

Git pager freeze (black “END” terminal)

git --no-pager log --oneline -3

ModuleNotFoundError in scripts/

import sys, os
sys.path.append(os.path.join(os.path.dirname(file), ‘..’, ‘..’))
:desktop_computer: TERMINAL SYNTAX
bash
Kopieren
Bearbeiten

:cross_mark: NEVER – PowerShell && chaining doesn’t work

cd “path” && python script.py

:white_check_mark: ALWAYS – Use Microsoft CLI MCP directly

python script.py # with workingDir parameter

:cross_mark: NEVER – Wildcards freeze the terminal

ls *.xlsx | dir *.py | Get-ChildItem *

:white_check_mark: ALWAYS – Use specific filenames

ls specific_file.xlsx
:wrench: TOOL CHOICE
Microsoft CLI MCP: For scripts <30s, status checks, debugging

Cursor Terminal: For scripts >30s, use run_safe.py for risky commands

workingDir: Microsoft CLI MCP starts in C:/Users/L490 → use workingDir param

:snake: PYTHON ENCODING
python
Kopieren
Bearbeiten

:cross_mark: NEVER – UnicodeDecodeError on German Windows systems

subprocess.run(cmd, shell=True, capture_output=True, text=True)

:white_check_mark: ALWAYS – Unicode-safe

subprocess.run(cmd, shell=True, capture_output=True, text=True,
encoding=‘utf-8’, errors=‘ignore’)
:prohibited: UNICODE PREVENTION (PROACTIVE)
python
Kopieren
Bearbeiten

:cross_mark: NEVER – Emojis crash PowerShell

print(“:white_check_mark: Import successful! :tada:”)
print(f":bar_chart: {count} new drivers imported")

:white_check_mark: ALWAYS – ASCII-only output for agent scripts

print(“[SUCCESS] Import successful!”)
print(f"[STATS] {count} new drivers imported")

:cross_mark: NEVER – Unicode in script output

status_icons = {“success”: “:white_check_mark:”, “error”: “:cross_mark:”, “info”: “:bar_chart:”}

:white_check_mark: ALWAYS – ASCII status markers

status_markers = {“success”: “[OK]”, “error”: “[ERROR]”, “info”: “[INFO]”}
AGENT SCRIPT STANDARDS:

Agent scripts: ASCII-only output

Human-only scripts: Emojis allowed (use run_safe.py)

New scripts: Always test Unicode output via Microsoft CLI MCP before commit

:brain: COMPLEX PROBLEMS
For complex issues, always run the sequential thinking MCP before making changes.

:clipboard: DOCUMENT RULE
:warning: ONLY UNIVERSAL TERMINAL/SYNTAX RULES – no specific feature notes!
:locked: CHANGES: Add new content only after user approval.

:file_folder: SCRIPT MANAGEMENT
:white_check_mark: Always load the script overview before any coding task (prevents duplicates)

:white_check_mark: Move one-time scripts to archive/legacy/ after success

:magnifying_glass_tilted_left: WEB SEARCH CHOICE
Tavily: Quick tech facts, API syntax, specific metrics (<3min research)

Cursor WebSearch: Problem-solving, current 2025 practices, full guides

:hammer_and_wrench: TOOL DEVELOPMENT
MCP Tool: For agents used frequently (>5x/week), performance-critical

Python Script: For one-time or rare use, human-triggered

:globe_with_meridians: RENDER DEPLOYMENT (CRITICAL)
:cross_mark: Manual scripts (e.g., check_render_db.py)

:white_check_mark: Render CLI MCP (direct service access, logs)

:police_car_light: AFTER GIT PUSH: End the chat! User must verify deployment manually

:hourglass_not_done: DEPLOYMENT TIME: 2–3 minutes – NEVER test immediately

:counterclockwise_arrows_button: PATTERN: Push → End chat → User tests → New chat if issues arise

:prohibited: UNIVERSAL DON’TS
:cross_mark: PowerShell && command chaining

:cross_mark: Deleting files without user permission

:cross_mark: Scripts from subfolders without sys.path.append

:cross_mark: subprocess without encoding=‘utf-8’, errors=‘ignore’

:white_check_mark: UNIVERSAL DO’S
:white_check_mark: Use Microsoft CLI MCP for short commands

:white_check_mark: Use sys.path.append() in scripts/ subfolders

:white_check_mark: Use Unicode-safe subprocess on German Windows

:white_check_mark: Use sequential thinking for complex problems

:light_bulb: Always follow these universal rules for any prompt

1 Like

```md
insert text here please
```

2 Likes