prompt-engineering-patterns

Design, optimize, and secure prompts for large language models.

2|Updated Mar 15, 2025
One-click install
npx skills add https://github.com/dandudzi/dotfiles --skill prompt-engineering-patterns-dandudzi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prompt-engineering-patterns
Source: https://github.com/dandudzi/dotfiles/tree/main/dot_claude/skills/prompt-engineering-patterns
Command: npx skills add https://github.com/dandudzi/dotfiles --skill prompt-engineering-patterns-dandudzi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the challenge of crafting effective prompts for Large Language Models (LLMs), ensuring optimal performance, structured outputs, and robust interactions.

Core Features & Use Cases

  • System Prompt Design: Create clear, effective role-based instructions for LLMs.
  • Output Structuring: Generate outputs in specific formats like JSON, XML, or via tool/function calls.
  • Chain-of-Thought (CoT): Implement reasoning patterns like step-by-step thinking and self-consistency for complex tasks.
  • Context Management: Optimize prompt length and content using techniques like sliding windows and summarization.
  • Prompt Injection Defense: Secure prompts against malicious manipulation.
  • Cost Optimization: Strategies for efficient model usage and prompt caching.
  • Use Case: Develop a customer support chatbot that can accurately categorize user issues, extract relevant details, and format responses in JSON for downstream processing, all while minimizing API costs and preventing prompt injection attacks.

Quick Start

Use the prompt-engineering-patterns skill to generate a system prompt for a customer support agent that prioritizes security and structured JSON output.

Frequently Asked Questions about prompt-engineering-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure an LLM system prompt for reliable JSON output?

To structure an LLM system prompt for reliable JSON output, define clear role-based instructions and specify the exact output formatting required. This Skill provides patterns for generating structured JSON, XML, or tool calls to ensure robust downstream processing.

What is the best way to prevent prompt injection attacks in LLM applications?

Preventing prompt injection attacks requires implementing specific defense patterns within your LLM prompts. This Skill provides comprehensive guidance on securing system prompts against malicious manipulation and ensuring robust interactions.

How does chain of thought prompting improve complex LLM tasks?

Chain of thought prompting improves complex LLM tasks by implementing step-by-step reasoning and self-consistency techniques. This Skill covers reasoning patterns like CoT and ReAct to enhance model performance on difficult operations.

How can I optimize LLM API costs through prompt engineering?

You can optimize LLM API costs through prompt engineering by applying model routing and prompt caching strategies. This Skill addresses cost optimization techniques alongside context window management using sliding windows and summarization.

How do I manage the context window when designing prompts for large language models?

Managing the context window when designing prompts involves optimizing prompt length and content through techniques like sliding windows and summarization. This Skill provides patterns for context management to maintain optimal LLM performance.

Can I use few-shot examples to improve LLM output accuracy?

Yes, you can use few-shot examples to improve LLM output accuracy by carefully selecting examples within your prompt. This Skill covers few-shot example selection techniques to guide the model toward desired responses.