thesoftwarehouse/copilot-collections/tsh-engineering-prompts
Claude Code and agent skill by thesoftwarehouse/copilot-collections
- community
Checking that the SKILL.md file is still in the repository.
LLM prompt engineering patterns: structure, optimization, security, templates, evaluation, and anti-patterns. Use when designing, writing, optimizing, or reviewing prompts for LLM applications (system prompts, user prompts, RAG templates, agent instructions, chatbot personas). NOT for Copilot customization — use tsh-creating-prompts for that.
Install
npx vskill@latest install thesoftwarehouse/copilot-collections/tsh-engineering-promptsSKILL.md
Prompt Engineering Patterns
Technology-agnostic patterns for designing, optimizing, and securing LLM application prompts. Applies to any LLM provider or framework.
<principles>
<scope> This skill covers prompts consumed by LLM APIs at runtime — system prompts, user prompt templates, few-shot examples, RAG context injection templates, agent tool-calling instructions, and classification/extraction prompts.
It does NOT cover Copilot customization files (.prompt.md, .agent.md, SKILL.md). Those belong to the tsh-creating-prompts, tsh-creating-agents, and tsh-creating-skills skills. </scope>
<determinism> Prompts are code. They deserve the same rigor as application code: version control, review, testing, and iteration. A prompt that "works sometimes" is a bug. Optimize for consistent, predictable outputs across runs. </determinism>
<defense-in-depth> Never trust user input inserted into prompts. Always treat prompt injection as a real threat — apply delimiter separation, input sanitization, and output validation as non-negotiable defaults, not optional hardening. </defense-in-depth>
</principles>
1. Prompt Structure Patterns
Role-Based Structure
The most reliable prompt structure separates concerns into distinct sections:
System prompt — defines who the model is, what it can and cannot do, and the rules it must follow. Set once per conversation or per request.
Context section — injected dynamically. RAG results, user metadata, or prior conversation turns. Always delimited from other sections.
User input — the variable part. Never mix user input into the system prompt without sanitization.
Output format — explicit instructions on response shape (JSON schema, markdown structure, specific fields).
Few-Shot Prompting
Provide 2–5 examples of input → output pairs to demonstrate the expected behavior:
Guidelines:
- Include edge cases in examples, not just happy paths
- Order examples from simple to complex
- Keep examples representative of real production data
- Use the exact output format you expect in each example
Chain-of-Thought
When the task requires reasoning, instruct the model to show its work:
Use chain-of-thought when: multi-step math, logical reasoning, code analysis, complex classification with justification. Skip it for: simple extraction, translation, formatting.
Delimiter Separation
Use consistent delimiters to separate sections, especially when injecting dynamic content:
Delimiter options: XML tags (<context>...</context>), markdown headings (### Section), triple backticks, or separator lines (---). Pick one style and use it consistently across all prompts in the application.
2. Optimization Techniques
Clarity and Specificity
| Weak | Strong | |
|---|---|---|
| "Summarize this" | "Summarize this article in 3 bullet points, each under 20 words, focusing on financial impact" | |
| "Extract the data" | "Extract: company_name (string), revenue (number in USD), fiscal_year (YYYY). Return as JSON." | |
| "Be helpful" | "Answer the user's question using only the provided context. If the context doesn't contain the answer, say 'I don't have enough information to answer that.'" | |
| "Write good code" | "Write a Python function that takes a list of integers and returns the top-k elements. Use a min-heap for O(n log k) complexity. Include type hints and a docstring." |
Constraint Specification
Explicitly state what the model should and should not do:
Output Format Control
Always specify the exact output format when downstream code will parse the response:
For structured outputs, prefer schemas over prose descriptions. Many LLM APIs support structured output modes (JSON mode, tool calling) — use them instead of relying on prompt instructions alone when available.
Token Efficiency
- Remove filler words and redundant instructions
- Use tables and lists instead of paragraphs for reference data
- Move static reference data to system prompts (cached across requests) and keep user prompts dynamic
- Split large contexts into chunks and summarize before injection when context window is a constraint
Negative Prompting
Tell the model what NOT to do — this often works better than only describing desired behavior:
Temperature and Sampling Guidance
| Task Type | Temperature | Use Case | |
|---|---|---|---|
| Extraction / Classification | 0.0–0.2 | Deterministic, factual outputs | |
| Summarization / Q&A | 0.3–0.5 | Balanced accuracy and fluency | |
| Creative Writing / Brainstorming | 0.7–1.0 | Diverse, creative outputs | |
| Code Generation | 0.0–0.3 | Consistent, correct code |
Set temperature in the API call, not in the prompt. The prompt should be designed to work well at the intended temperature.
3. Security Patterns
Prompt Injection Defense
Prompt injection occurs when user input manipulates the model into ignoring system instructions. Defense is mandatory — not optional.
Layer 1 — Delimiter separation: Always separate user input from instructions with clear delimiters:
Layer 2 — Input sanitization: Before inserting user input into the prompt template, sanitize it:
- Strip or escape delimiter characters that match your prompt structure
- Truncate to a maximum length
- Reject or flag inputs that contain instruction-like patterns ("ignore previous", "you are now", "system:")
Layer 3 — Output validation: Never trust raw LLM output for security-critical decisions:
- Parse structured outputs into typed models (Pydantic, Zod, etc.)
- Validate that outputs conform to expected schemas before passing downstream
- Reject responses that contain unexpected fields or content patterns
Jailbreak Resistance
Design system prompts to resist common manipulation:
Secrets in Prompts
- Never hardcode API keys, passwords, or secrets in prompt templates
- Load sensitive values from environment variables or secret managers at runtime
- If the prompt references external services, use placeholder tokens replaced at runtime
PII Handling
- Minimize Personally Identifiable Information (PII) in prompts — only include what's necessary for the task
- If the model's response may contain PII, apply output filtering before displaying to other users
- Log prompts and responses with PII redacted
4. Prompt Templates
RAG (Retrieval-Augmented Generation)
Agent Tool-Calling
Classification / Extraction
Summarization
Evaluation / Scoring
5. Evaluation Approaches
A/B Testing Prompts
Compare prompt variants systematically:
- Fix one variable — change only one aspect per test (wording, structure, examples, constraints)
- Use the same test set — run both variants against identical inputs
- Measure objectively — define metrics before testing (accuracy, format compliance, latency, token usage)
- Sample size — test against 20+ diverse inputs minimum; edge cases must be represented
Metric-Based Comparison
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/tsh-engineering-prompts/SKILL.md
Popularity
- Repository stars
- 266
- Repository forks
- 18
- 7-day trend score
- 28
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/thesoftwarehouse/copilot-collections/tsh-engineering-prompts)