prompt_engineering

Design and optimize LLM prompts using zero-shot, few-shot, chain-of-thought, and structured output techniques.

Updated Jan 14, 2026
One-click install
npx skills add https://github.com/jvsandhu/agentic-skills --skill prompt-engineering-jvsandhu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prompt_engineering
Source: https://github.com/jvsandhu/agentic-skills/tree/main/skills/prompt_engineering
Command: npx skills add https://github.com/jvsandhu/agentic-skills --skill prompt-engineering-jvsandhu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires openai, anthropic, langchain, llama-index, dspy-ai, ai, zod, and includes scripts (resource) and references (resource) components.

What problem does it solve? LLM outputs are often unreliable, inconsistent, or hallucinated when prompts are written through trial and error. This Skill replaces guesswork with proven prompting patterns so you get consistent, structured, and cost-efficient responses from models like GPT-4, Claude, and Gemini. ## Core Features & Use Cases - Technique Decision Framework: Choose between zero-shot, few-shot, chain-of-thought, JSON mode, tool calling, prompt chaining, and RAG based on task requirements, token cost, and reliability. - Structured Output Generation: Produce validated JSON using OpenAI JSON mode, Anthropic tool use, and Zod schemas with the Vercel AI SDK. - Production Practices: Prompt versioning, token cost monitoring, retry logic, injection sanitization, and A/B testing workflows. - Use Case: You are building a RAG question-answering feature and the model keeps returning malformed JSON. Use this Skill to switch to tool calling with a schema, add validation, and reduce hallucination with cited sources. ## Quick Start Ask the AI to design a chain-of-thought prompt with structured JSON output for your classification task using the prompt engineering skill.

Frequently Asked Questions about prompt_engineering

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

FAQPage Schema
How do I get reliable structured JSON output from an LLM?

Use native JSON mode or tool calling instead of parsing free text. OpenAI supports response_format json_object, Anthropic uses tool input schemas, and the Vercel AI SDK validates outputs with Zod schemas.

When should I use chain-of-thought prompting?

Use chain-of-thought for complex reasoning tasks like math, logic, and multi-hop analysis. Adding step-by-step reasoning improves accuracy by 20-50% on reasoning benchmarks, though it increases token cost.

LangChain vs Vercel AI SDK for LLM applications?

LangChain suits complex Python workflows, RAG pipelines, and agents. Vercel AI SDK is better for Next.js and React apps needing streaming, type safety, and multi-provider support with less overhead.

How do I prevent prompt injection attacks?

Sanitize user input by detecting injection phrases, wrap user content in delimiters like XML tags, and instruct the model in the system prompt to ignore instructions embedded in user text.

How many few-shot examples should I include in a prompt?

Two to five diverse, representative examples is the sweet spot. Quality matters more than quantity; keep formatting consistent and randomize example order to avoid position bias.

Why does my prompt work on GPT-4 but fail on Claude or Llama?

Models respond to different prompt styles. Claude performs better with XML-structured prompts, Llama needs more explicit instructions and few-shot examples, and GPT-4 handles concise system messages well.