No Heredoc File Operations

No Heredoc File Operations

Forbids a coding agent from writing files through shell heredocs and redirections, requiring its file editing tools instead to avoid corrupted files.

Skill files1 file
SKILL.md79 lines
1
---
2
name: 'No Heredoc File Operations'
3
description: 'Prevents terminal heredoc file corruption in VS Code Copilot by enforcing use of file editing tools instead of shell redirections'
4
applyTo: '**'
5
---
6
7
# MANDATORY: File Operation Override
8
9
This instruction applies to ALL agents and ALL file operations. It takes precedence over any other learned behavior.
10
11
## The Problem
12
13
Terminal heredoc operations are BROKEN in VS Code's Copilot integration. They cause:
14
15
- File corruption from tab characters triggering shell completion
16
- Mangled content from quote/backtick escaping failures
17
- Truncated files from exit code 130 interruptions
18
- Garbage output from special character interpretation
19
20
## The Rule
21
22
**BEFORE writing ANY terminal command that creates or modifies a file, STOP.**
23
24
Ask yourself: "Am I about to use `cat`, `echo`, `printf`, `tee`, or `>>`/`>` to write content to a file?"
25
26
If YES → **DO NOT EXECUTE.** Use file editing tools instead.
27
28
## Forbidden Patterns
29
30
```bash
31
# ALL OF THESE CORRUPT FILES - NEVER USE THEM
32
cat > file << EOF
33
cat > file << 'EOF'
34
cat > file <<EOF
35
cat > file <<'EOF'
36
cat > file <<-EOF
37
cat >> file << EOF
38
echo "multi
39
line" > file
40
printf '%s\n' "line1" "line2" > file
41
tee file << EOF
42
tee file << 'EOF'
43
```
44
45
## Required Approach
46
47
Instead of terminal commands for file content:
48
49
- **New files** → Use the file creation/editing tool provided by your environment
50
- **Modify files** → Use the file editing tool provided by your environment
51
- **Delete files** → Use the file deletion tool or `rm` command
52
53
## Terminal IS Allowed For
54
55
- `npm install`, `pip install`, `cargo add` (package management)
56
- `npm run build`, `make`, `cargo build` (builds)
57
- `npm test`, `pytest`, `go test` (testing)
58
- `git add`, `git commit`, `git push` (version control)
59
- `node script.js`, `python app.py` (running existing code)
60
- `ls`, `cd`, `mkdir`, `pwd`, `rm` (filesystem navigation)
61
- `curl`, `wget` (downloading, but not piping to files with content manipulation)
62
63
## Terminal is FORBIDDEN For
64
65
- ANY file creation with content
66
- ANY file modification with content
67
- ANY heredoc syntax (`<<`)
68
- ANY multi-line string redirection
69
70
## Enforcement
71
72
This is not a suggestion. This is a hard technical requirement due to VS Code terminal integration bugs. Ignoring this instruction will result in corrupted files that the user must manually fix.
73
74
When you need to create or edit a file:
75
76
1. Stop before typing any terminal command
77
2. Use the appropriate file editing tool
78
3. The tool will handle the content correctly without corruption
79

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…