No Heredoc File Operations
No Heredoc File Operations是一款code方向的AI技能,核心价值是Prevents terminal heredoc file corruption in VS Code Copilot by enforcing use of file editing tools instead of shell redirections,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。
Prevents terminal heredoc file corruption in VS Code Copilot by enforcing use of file editing tools instead of shell redirections
mkdir -p ./skills/no-heredoc && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/no-heredoc/SKILL.md -o ./skills/no-heredoc/SKILL.md Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).
Skill Content
# MANDATORY: File Operation Override
This instruction applies to ALL agents and ALL file operations. It takes precedence over any other learned behavior.
The Problem
Terminal heredoc operations are BROKEN in VS Code's Copilot integration. They cause:
- File corruption from tab characters triggering shell completion
- Mangled content from quote/backtick escaping failures
- Truncated files from exit code 130 interruptions
- Garbage output from special character interpretation
The Rule
**BEFORE writing ANY terminal command that creates or modifies a file, STOP.**
Ask yourself: "Am I about to use `cat`, `echo`, `printf`, `tee`, or `>>`/`>` to write content to a file?"
If YES → **DO NOT EXECUTE.** Use file editing tools instead.
Forbidden Patterns
# ALL OF THESE CORRUPT FILES - NEVER USE THEM
cat > file << EOF
cat > file << 'EOF'
cat > file <<EOF
cat > file <<'EOF'
cat > file <<-EOF
cat >> file << EOF
echo "multi
line" > file
printf '%s\n' "line1" "line2" > file
tee file << EOF
tee file << 'EOF'Required Approach
Instead of terminal commands for file content:
- **New files** → Use the file creation/editing tool provided by your environment
- **Modify files** → Use the file editing tool provided by your environment
- **Delete files** → Use the file deletion tool or `rm` command
Terminal IS Allowed For
- `npm install`, `pip install`, `cargo add` (package management)
- `npm run build`, `make`, `cargo build` (builds)
- `npm test`, `pytest`, `go test` (testing)
- `git add`, `git commit`, `git push` (version control)
- `node script.js`, `python app.py` (running existing code)
- `ls`, `cd`, `mkdir`, `pwd`, `rm` (filesystem navigation)
- `curl`, `wget` (downloading, but not piping to files with content manipulation)
Terminal is FORBIDDEN For
- ANY file creation with content
- ANY file modification with content
- ANY heredoc syntax (`<<`)
- ANY multi-line string redirection
Enforcement
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.
When you need to create or edit a file:
1. Stop before typing any terminal command
2. Use the appropriate file editing tool
3. The tool will handle the content correctly without corruption
🎯 Best For
- Claude users
- GitHub Copilot users
- Software engineers
- Development teams
- Tech leads
💡 Use Cases
- Code quality improvement
- Best practice enforcement
📖 How to Use This Skill
- 1
Install the Skill
Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.
- 2
Load into Your AI Assistant
Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.
- 3
Apply No Heredoc File Operations to Your Work
Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.
- 4
Review and Refine
Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.
❓ Frequently Asked Questions
Is No Heredoc File Operations compatible with Cursor and VS Code?
Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.
Do I need specific dependencies for No Heredoc File Operations?
Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.
How do I install No Heredoc File Operations?
Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/no-heredoc/SKILL.md, ready to use.
Can I customize this skill for my team?
Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.
⚠️ Common Mistakes to Avoid
Skipping validation
Always test AI-generated code changes, even for simple refactors.
Missing dependency updates
Check if the skill requires updated dependencies or new packages.