prompt-engineering-patterns

Optimize LLM prompts with few-shot selection, reasoning patterns, and structured JSON outputs.

6|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/archibate/archibate-skills --skill prompt-engineering-patterns-archibate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prompt-engineering-patterns
Source: https://github.com/archibate/archibate-skills/tree/main/old-skills/minor-skills/prompt-engineering-patterns
Command: npx skills add https://github.com/archibate/archibate-skills --skill prompt-engineering-patterns-archibate

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Prompt engineering patterns reduce brittle, inconsistent, and unstructured LLM outputs by providing repeatable templates, selection strategies, and verification steps so models behave reliably in production workflows.

Core Features & Use Cases

  • Few-Shot & Example Selection: Techniques for semantic selection, diversity sampling, and difficulty-based example curation.
  • Structured Outputs & Validation: JSON mode, Pydantic schemas, and verification/fallback strategies to ensure type-safe, parseable results.
  • Reasoning Patterns: Chain-of-thought, self-consistency, least-to-most, and tree-of-thought approaches for complex multi-step tasks.
  • Prompt Optimization & Testing: A/B testing, metric tracking (accuracy, latency, token use), and iterative refinement with automation scripts.
  • Template Systems & System Prompts: Modular templates, conditional sections, and role-based system prompt design for specialized assistants.

Quick Start

Use this skill to create a prompt that returns validated JSON with fields 'answer', 'confidence', and 'sources' for a given user question.

Frequently Asked Questions about prompt-engineering-patterns

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

FAQPage Schema
How do I get an LLM to reliably return structured JSON outputs?

Structured JSON outputs are enforced using Pydantic schemas and verification strategies to ensure type-safe, parseable results. This prevents brittle responses by validating fields dynamically before returning them to production workflows.

What is the best way to select few-shot examples for prompt engineering?

Few-shot example selection uses semantic retrieval via embeddings, diversity sampling, and difficulty-based curation. This approach dynamically matches examples to the input query, improving response accuracy and consistency.

How do I implement chain-of-thought and self-consistency for complex reasoning?

Chain-of-thought and self-consistency are reasoning patterns applied for complex multi-step tasks. They generate multiple reasoning paths and aggregate answers to improve controllability and reliability.

Can I use numpy for dynamic example retrieval in prompt optimization?

Numpy supports the underlying mathematical operations for dynamic example retrieval via embeddings. It enables semantic selection and diversity sampling to curate optimal few-shot prompts.

How do I manage token budgets and track metrics during prompt A/B testing?

Token-budget management and metric tracking are handled through automation scripts for A/B testing. These scripts monitor accuracy, latency, and token use to iteratively refine prompts.

When should I use template systems and conditional sections in LLM prompts?

Template systems with conditional sections and role-based system prompts are used for specialized assistants. They provide modular, repeatable structures that reduce inconsistent outputs in production environments.