prompt-engineering-patterns

sickn33/antigravity-awesome-skills · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill prompt-engineering-patterns
0 commentsdiscussion
summary

Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability.

skill.md

Prompt Engineering Patterns

Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability.

Do not use this skill when

  • The task is unrelated to prompt engineering patterns
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.
  • If detailed examples are required, open resources/implementation-playbook.md.

Use this skill when

  • Designing complex prompts for production LLM applications
  • Optimizing prompt performance and consistency
  • Implementing structured reasoning patterns (chain-of-thought, tree-of-thought)
  • Building few-shot learning systems with dynamic example selection
  • Creating reusable prompt templates with variable interpolation
  • Debugging and refining prompts that produce inconsistent outputs
  • Implementing system prompts for specialized AI assistants

Core Capabilities

1. Few-Shot Learning

  • Example selection strategies (semantic similarity, diversity sampling)
  • Balancing example count with context window constraints
  • Constructing effective demonstrations with input-output pairs
  • Dynamic example retrieval from knowledge bases
  • Handling edge cases through strategic example selection

2. Chain-of-Thought Prompting

  • Step-by-step reasoning elicitation
  • Zero-shot CoT with "Let's think step by step"
  • Few-shot CoT with reasoning traces
  • Self-consistency techniques (sampling multiple reasoning paths)
  • Verification and validation steps

3. Prompt Optimization

  • Iterative refinement workflows
  • A/B testing prompt variations
  • Measuring prompt performance metrics (accuracy, consistency, latency)
  • Reducing token usage while maintaining quality
  • Handling edge cases and failure modes

4. Template Systems

  • Variable interpolation and formatting
  • Conditional prompt sections
  • Multi-turn conversation templates
  • Role-based prompt composition
  • Modular prompt components

5. System Prompt Design

  • Setting model behavior and constraints
  • Defining output formats and structure
  • Establishing role and expertise
  • Safety guidelines and content policies
  • Context setting and background information

Quick Start

from prompt_optimizer import PromptTemplate, FewShotSelector

# Define a structured prompt template
template = PromptTemplate(
    system="You are an expert SQL developer. Generate efficient, secure SQL queries.",
    instruction="Convert the following natural language query to SQL:\n{query}",
    few_shot_examples=True,
    output_format="SQL code block with explanatory comments"
)

# Configure few-shot learning
selector = FewShotSelector(
    examples_db="sql_examples.jsonl",
    selection_strategy="semantic_similarity",
    max_examples=3
)

# Generate optimized prompt
prompt = template.render(
    query="Find all users who registered in the last 30 days",
    examples=selector.select(query="user registration date filter")
)

Key Patterns

Progressive Disclosure

Start with simple prompts, add complexity only when needed:

  1. Level 1: Direct instruction

    • "Summarize this article"
  2. Level 2: Add constraints

    • "Summarize this article in 3 bullet points, focusing on key findings"
  3. Level 3: Add reasoning

    • "Read this article, identify the main findings, then summarize in 3 bullet points"
  4. Level 4: Add examples

    • Include 2-3 example summaries with input-output pairs

Instruction Hierarchy

[System Context] → [Task Instruction] → [Examples] → [Input Data] → [Output Format]

Error Recovery

Build prompts that gracefully handle failures:

  • Include fallback instructions
  • Request confidence scores
  • Ask for alternative interpretations when uncertain
  • Specify how to indicate missing information

Best Practices

  1. Be Specific: Vague prompts produce inconsistent results
  2. Show, Don't Tell: Examples are more effective than descriptions
  3. Test Extensively: Evaluate on diverse, representative inputs
  4. Iterate Rapidly: Small changes can have large impacts
  5. Monitor Performance: Track metrics in production
  6. Version Control: Treat prompts as code with proper versioning
  7. Document Intent: Explain why prompts are structured as they are

Common Pitfalls

  • Over-engineering: Starting with complex prompts before trying simple ones
  • Example pollution: Using examples that don't match the target task
  • Context overflow: Exceeding token limits with excessive examples
  • Ambiguous instructions: Leaving room for multiple interpretations
  • Ignoring edge cases: Not testing on unusual or boundary inputs

Integration Patterns

With RAG Systems

# Combine retrieved context with prompt engineering
prompt = f"""Given the following context:
{retrieved_context}

{few_shot_examples}

Question: {user_question}

Provide a detailed answer based solely on the context above. If the context doesn't contain enough information, explicitly state what's missing."""

With Validation

# Add self-verification step
prompt = f"""{main_task_prompt}

After generating your response, verify it meets these criteria:
1. Answers the question directly
2. Uses only information from provided context
3. Cites specific sources
4. Acknowledges any uncertainty

If verification fails, revise your response."""

Performance Optimization

Token Efficiency

  • Remove redundant words and phrases
  • Use abbreviations consistently after first definition
  • Consolidate similar instructions
  • Move stable content to system prompts

Latency Reduction

  • Minimize prompt length without sacrificing quality
  • Use streaming for long-form outputs
  • Cache common prompt prefixes
  • Batch similar requests when possible

Resources

  • references/few-shot-learning.md: Deep dive on example selection and construction
  • references/chain-of-thought.md: Advanced reasoning elicitation techniques
  • references/prompt-optimization.md: Systematic refinement workflows
  • references/prompt-templates.md: Reusable template patterns
  • references/system-prompts.md: System-level prompt design
  • assets/prompt-template-library.md: Battle-tested prompt templates
  • assets/few-shot-examples.json: Curated example datasets
  • scripts/optimize-prompt.py: Automated prompt optimization tool

Success Metrics

Track these KPIs for your prompts:

  • Accuracy: Correctness of outputs
  • Consistency: Reproducibility across similar inputs
  • Latency: Response time (P50, P95, P99)
  • Token Usage: Average tokens per request
  • Success Rate: Percentage of valid outputs
  • User Satisfaction: Ratings and feedback

Next Steps

  1. Review the prompt template library for common patterns
  2. Experiment with few-shot learning for your specific use case
  3. Implement prompt versioning and A/B testing
  4. Set up automated evaluation pipelines
  5. Document your prompt engineering decisions and learnings
how to use prompt-engineering-patterns

How to use prompt-engineering-patterns on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add prompt-engineering-patterns
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill prompt-engineering-patterns

The skills CLI fetches prompt-engineering-patterns from GitHub repository sickn33/antigravity-awesome-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/prompt-engineering-patterns

Reload or restart Cursor to activate prompt-engineering-patterns. Access the skill through slash commands (e.g., /prompt-engineering-patterns) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.558 reviews
  • Luis Perez· Dec 16, 2024

    Keeps context tight: prompt-engineering-patterns is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Shikha Mishra· Dec 12, 2024

    Useful defaults in prompt-engineering-patterns — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Advait Johnson· Dec 12, 2024

    I recommend prompt-engineering-patterns for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Jin Desai· Dec 4, 2024

    We added prompt-engineering-patterns from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Valentina Verma· Dec 4, 2024

    Useful defaults in prompt-engineering-patterns — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Carlos Srinivasan· Nov 23, 2024

    prompt-engineering-patterns reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Luis Sanchez· Nov 23, 2024

    prompt-engineering-patterns is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Nikhil Choi· Nov 15, 2024

    Solid pick for teams standardizing on skills: prompt-engineering-patterns is focused, and the summary matches what you get after install.

  • Valentina Bhatia· Nov 7, 2024

    I recommend prompt-engineering-patterns for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Rahul Santra· Nov 3, 2024

    prompt-engineering-patterns is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

showing 1-10 of 58

1 / 6