Trending open-source projects · updated daily

AI Prompt Engineering Projects

Prompt engineering stopped being about clever wording and became a loop: draft a prompt, run it against a set of cases, measure the result, change one variable, repeat. This board follows the tooling that loop depends on — prompt compression and pruning, automated prompt optimisation, libraries and templates, tuning methods and evaluation harnesses. It is assembled from GitHub topic pages for prompt engineering, prompt optimisation, prompt compression and prompt tuning, ranked by stars, which is why a two-week-old optimiser can outrank a template collection that has existed for years. Each card shows language, stars and forks and opens a page with description, license, activity dates, README and related prompt projects. If your goal is cutting token cost or making an agent follow instructions reliably, the sections below split the board into optimisation, libraries, tuning and structured-output tooling.

Trending Prompt Engineering Projects

1

dair-ai / Prompt-Engineering-Guide

🐙 Guides, papers, lessons, notebooks and resources for prompt engineering, context engineering, RAG, and AI Agents.

MDX★ 78,513⑂ 8,631
View dair-ai/Prompt-Engineering-Guide
→
2

asgeirtj / system_prompts_leaks

Extracted system prompts from Anthropic - Claude Fable 5.1, Opus 5, Claude Design, Claude Code. OpenAI - ChatGPT GPT-6-Astra, Codex. Google - Gemini 3.8 Flash, 3.1 Pro, Antigravity.

JavaScript★ 67,903⑂ 11,033
View asgeirtj/system_prompts_leaks
→
3

elder-plinius / CL4R1T4S

LEAKED SYSTEM PROMPTS FOR CHATGPT, CLAUDE, GEMINI, GROK, PERPLEXITY, CURSOR, LOVABLE, REPLIT, AND MORE! - AI SYSTEMS TRANSPARENCY FOR ALL! 👐

★ 50,087⑂ 10,279
View elder-plinius/CL4R1T4S
→
4

linshenkx / prompt-optimizer

An AI prompt optimizer for writing better prompts and getting better AI results.

TypeScript★ 35,260⑂ 4,115
View linshenkx/prompt-optimizer
→
5

promptfoo / promptfoo

Test your prompts, agents, and RAGs. Red teaming/pentesting/vulnerability scanning for AI. Compare performance of GPT, Claude, Gemini, DeepSeek, and more.

TypeScript★ 25,319⑂ 2,349
View promptfoo/promptfoo
→
6

nidhinjs / prompt-master

A Claude skill that writes the accurate prompts for any AI tool. Zero tokens or credits wasted. Full context and memory retention

★ 13,440⑂ 1,563
View nidhinjs/prompt-master
→
7

langgptai / LangGPT

LangGPT: Empowering everyone to become a prompt expert! 🚀 📌 结构化提示词(Structured Prompt)提出者 📌 元提示词(Meta-Prompt)发起者 📌 最流行的提示词落地范式 | Language of GPT The pioneering framework for structured & meta-prompt

Jupyter Notebook★ 12,542⑂ 947
View langgptai/LangGPT
→
8

cobusgreyling / loop-engineering

Practical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny).

TypeScript★ 11,270⑂ 1,512
View cobusgreyling/loop-engineering
→
9

microsoft / promptflow

Build high-quality LLM apps - from prototyping, testing to production deployment and monitoring.

Python★ 11,244⑂ 1,123
View microsoft/promptflow
→
10

mufeedvh / code2prompt

A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting.

Rust★ 7,682⑂ 447
View mufeedvh/code2prompt
→
11

NeoVertex1 / SuperPrompt

SuperPrompt is an attempt to engineer prompts that might help us understand AI agents.

★ 6,433⑂ 572
View NeoVertex1/SuperPrompt
→
12

langgptai / wonderful-prompts

🔥中文 prompt 精选🔥,ChatGPT 使用指南,提升 ChatGPT 可玩性和可用性!🚀

★ 6,316⑂ 537
View langgptai/wonderful-prompts
→
13

trigaten / Learn_Prompting

Prompt Engineering, Generative AI, and LLM Guide by Learn Prompting | Join our discord for the largest Prompt Engineering learning community

MDX★ 4,736⑂ 666
View trigaten/Learn_Prompting
→
14

liquidprompt / liquidprompt

A full-featured & carefully designed adaptive prompt for Bash & Zsh

Shell★ 4,678⑂ 419
View liquidprompt/liquidprompt
→
15

promptslab / Promptify

Prompt Engineering | Prompt Versioning | Use GPT or other prompt based models to get structured output. Join our discord for Prompt-Engineering, LLMs and other latest research

Python★ 4,635⑂ 364
View promptslab/Promptify
→
16

Hunyuan-PromptEnhancer / PromptEnhancer

[CVPR 2026] PromptEnhancer is a prompt-rewriting tool, refining prompts into clearer, structured versions for better image generation.

Python★ 3,773⑂ 326
View Hunyuan-PromptEnhancer/PromptEnhancer
→
17

DSXiangLi / DecryptPrompt

总结Prompt&LLM论文,开源数据&模型,AIGC应用

★ 3,440⑂ 318
View DSXiangLi/DecryptPrompt
→
18

pezzolabs / pezzo

🕹️ Open-source, developer-first LLMOps platform designed to streamline prompt design, version management, instant delivery, collaboration, troubleshooting, observability and more.

TypeScript★ 3,273⑂ 279
View pezzolabs/pezzo
→
19

phodal / prompt-patterns

Prompt 编写模式:如何将思维框架赋予机器,以设计模式的形式来思考 prompt

★ 3,091⑂ 198
View phodal/prompt-patterns
→
20

KhazP / vibe-coding-prompt-template

Templates and workflow for generating PRDs, Tech Designs, and MVP and more using LLMs for AI IDEs

TypeScript★ 3,090⑂ 381
View KhazP/vibe-coding-prompt-template
→
21

hegelai / prompttools

Open-source tools for prompt testing and experimentation, with support for both LLMs (e.g. OpenAI, LLaMA) and vector databases (e.g. Chroma, Weaviate, LanceDB).

Python★ 3,055⑂ 256
View hegelai/prompttools
→
22

ianarawjo / ChainForge

An open-source visual programming environment for battle-testing prompts to LLMs.

TypeScript★ 3,030⑂ 257
View ianarawjo/ChainForge
→
23

Eladlev / AutoPrompt

A framework for prompt tuning using Intent-based Prompt Calibration

Python★ 3,019⑂ 264
View Eladlev/AutoPrompt
→
24

OpenPipe / OpenPipe

Turn expensive prompts into cheap fine-tuned models

TypeScript★ 2,830⑂ 177
View OpenPipe/OpenPipe
→
25

microsoftarchive / promptbench

A unified evaluation framework for large language models

Python★ 2,821⑂ 222
View microsoftarchive/promptbench
→
26

yaojingang / yao-open-prompts

Practical bilingual AI prompt library for prompt engineering, work, learning, content, marketing, and everyday use.

Python★ 2,817⑂ 461
View yaojingang/yao-open-prompts
→
27

prompt-engineering / click-prompt

ClickPrompt - Streamline your prompt design, with ClickPrompt, you can easily view, share, and run these prompts with just one click. ClickPrompt 用于一键轻松查看、分享和执行您的 Prompt。

TypeScript★ 2,389⑂ 202
View prompt-engineering/click-prompt
→
28

YiVal / YiVal

Your Automatic Prompt Engineering Assistant for GenAI Applications

Python★ 2,134⑂ 328
View YiVal/YiVal
→
29

THUDM / P-tuning-v2

An optimized deep prompt tuning strategy comparable to fine-tuning across scales and tasks

Python★ 2,077⑂ 212
View THUDM/P-tuning-v2
→
30

character-ai / prompt-poet

Streamlines and simplifies prompt design for both developers and non-technical users with a low code approach.

Python★ 1,154⑂ 94
View character-ai/prompt-poet
→
31

ferrislucas / promptr

Promptr is a CLI tool that applies plain language instructions to the filesystem. Instructions can utilize a liquidjs based templating system.

JavaScript★ 950⑂ 36
View ferrislucas/promptr
→
32

microsoft / sammo

A library for prompt engineering and optimization (SAMMO = Structure-aware Multi-Objective Metaprompt Optimization)

Python★ 779⑂ 52
View microsoft/sammo
→
33

google-research / prompt-tuning

Original Implementation of Prompt Tuning from Lester, et al, 2021

Python★ 699⑂ 64
View google-research/prompt-tuning
→
34

teilomillet / gollm

Unified Go interface for Language Model (LLM) providers. Simplifies LLM integration with flexible prompt management and common task functions.

Go★ 674⑂ 67
View teilomillet/gollm
→
35

clue-ai / PromptCLUE

PromptCLUE, 全中文任务支持零样本学习模型

Jupyter Notebook★ 663⑂ 63
View clue-ai/PromptCLUE
→
36

madaan / memprompt

A method to fix GPT-3 after deployment with user feedback, without re-training.

Python★ 331⑂ 15
View madaan/memprompt
→
37

jia-gao / leanctx

Drop-in prompt compression for production LLM apps. Cut your token bill 40-60% without changing your code. Python SDK, LLMLingua-2, MIT.

Python★ 326⑂ 5
View jia-gao/leanctx
→
38

shobrook / promptimal

A very fast, very minimal prompt optimizer

Python★ 299⑂ 15
View shobrook/promptimal
→
39

ckelsoe / prompt-architect

Agent skill for analyzing and improving prompts using 31 frameworks across 7 intent categories. Works with Claude Code, Gemini CLI, Cursor, Copilot, and 30+ Agent Skills compatible tools.

JavaScript★ 299⑂ 32
View ckelsoe/prompt-architect
→
40

hjbahng / visual_prompting

Exploring Visual Prompts for Adapting Large-Scale Models

Python★ 290⑂ 33
View hjbahng/visual_prompting
→
41

ZhangYuanhan-AI / NOAH

[TPAMI] Searching prompt modules for parameter-efficient transfer learning.

Python★ 241⑂ 11
View ZhangYuanhan-AI/NOAH
→
42

Birfy / agentdescent

Gradient descent, but the parameters are agents — a parallel, asynchronous framework for self-evolving agents (skills, prompts, harnesses). Diffs are the gradients; the aggregator is the optimizer.

Python★ 239⑂ 18
View Birfy/agentdescent
→
43

fkiene / llmtrim

Local proxy that compresses your LLM API requests so you pay less, with no change to the answers. Trims wasted tokens from prompts, history, tool output

Rust★ 236⑂ 23
View fkiene/llmtrim
→
44

tsinghua-fib-lab / UniST

Official implementation for "UniST: A Prompt-Empowered Universal Model for Urban Spatio-Temporal Prediction" (KDD 2024)

Python★ 230⑂ 23
View tsinghua-fib-lab/UniST
→
45

XBigRoad / prompt-optimizer-studio

可同时输入多个初版提示词,开启多轮自动优化,连续得到高分后得到最终结果。

TypeScript★ 217⑂ 18
View XBigRoad/prompt-optimizer-studio
→
46

zjunlp / KnowPrompt

[WWW 2022] KnowPrompt: Knowledge-aware Prompt-tuning with Synergistic Optimization for Relation Extraction

Python★ 207⑂ 35
View zjunlp/KnowPrompt
→
47

holarissun / PanelGPT

We introduce new zero-shot prompting magic words that improves the reasoning ability of language models: panel discussion!

Python★ 174⑂ 12
View holarissun/PanelGPT
→
48

BeierZhu / Prompt-align

[ICCV 2023] Prompt-aligned Gradient for Prompt Tuning

Python★ 171⑂ 10
View BeierZhu/Prompt-align
→
49

shinpr / mcp-image

MCP server for AI image generation and editing with automatic prompt optimization and quality presets. Supports Nano Banana (Gemini), OpenAI GPT Image, and BytePlus Seedream.

TypeScript★ 166⑂ 37
View shinpr/mcp-image
→
50

gepromptet / promptolution

A unified, modular framework for prompt optimization

Python★ 158⑂ 12
View gepromptet/promptolution
→
51

Alisa0808 / vibe-creating-skill

Open-source, bilingual AI video-prompt skill — rewrite ideas into model-ready text-to-video prompts. A portable Agent Skill (Claude Code, Codex, OpenClaw

JavaScript★ 144⑂ 21
View Alisa0808/vibe-creating-skill
→
52

zjunlp / DART

[ICLR 2022] Differentiable Prompt Makes Pre-trained Language Models Better Few-shot Learners

Python★ 131⑂ 17
View zjunlp/DART
→
53

edvardgrishin27 / nativeprompt

Переписывает промпт под правила той модели, где вы работаете: GPT-6 Astra, Claude Fable 5.1, Opus 5, Codex. Каждая правка со ссылкой на офиц. док.

Python★ 126⑂ 12
View edvardgrishin27/nativeprompt
→
54

AgustiPuigserver / opus-prompt-architect

Best Prompt Engineering Tools for 2026 AI Workflow Optimization

HTML★ 125⑂ 0
View AgustiPuigserver/opus-prompt-architect
→
55

heavenaruba / codified-prompt-rule-engine

Top 10 Claude Prompt Optimization Frameworks 2026

HTML★ 123⑂ 1
View heavenaruba/codified-prompt-rule-engine
→
56

sauradip / STALE

[ECCV 2022] Official Pytorch Implementation of the paper : " Zero-Shot Temporal Action Detection via Vision-Language Prompting "

Python★ 117⑂ 11
View sauradip/STALE
→
57

changdaeoh / BlackVIP

Official implementation for CVPR'23 paper "BlackVIP: Black-Box Visual Prompting for Robust Transfer Learning"

Python★ 107⑂ 9
View changdaeoh/BlackVIP
→
58

WecoAI / weco-cli

Production-Grade Autoresearch. Ideal for agent harness engineering, prompt engineering, ML model development, GPU kernels, and other optimizable code.

Python★ 105⑂ 15
View WecoAI/weco-cli
→
59

ShiZhengyan / DePT

[ICLR 2024] This is the repository for the paper titled "DePT: Decomposed Prompt Tuning for Parameter-Efficient Fine-tuning"

Python★ 101⑂ 15
View ShiZhengyan/DePT
→
60

promptdesk / promptdesk

Promptdesk is a tool designed for effectively creating, organizing, and evaluating prompts and large language models (LLMs).

TypeScript★ 100⑂ 15
View promptdesk/promptdesk
→
61

thunlp / Prompt-Transferability

On Transferability of Prompt Tuning for Natural Language Processing

Python★ 98⑂ 9
View thunlp/Prompt-Transferability
→
62

arazd / ProgressivePrompts

Progressive Prompts: Continual Learning for Language Models

Python★ 97⑂ 14
View arazd/ProgressivePrompts
→
63

Hainrixz / claude-banana

AI agent that turns your rough ideas into perfect image generation prompts. 7-component formula, 70+ creative techniques, 9 domain modes.

Python★ 96⑂ 27
View Hainrixz/claude-banana
→
64

HKUDS / FlashST

[ICML'2024] "FlashST: A Simple and Universal Prompt-Tuning Framework for Traffic Prediction"

Python★ 93⑂ 6
View HKUDS/FlashST
→
65

JarvisPei / SCOPE

SCOPE: Self-evolving Context Optimization via Prompt Evolution - A framework for automatic prompt optimization

Python★ 84⑂ 6
View JarvisPei/SCOPE
→
66

BaiShuanghao / Prompt-based-Distribution-Alignment

[AAAI 2024] Prompt-based Distribution Alignment for Unsupervised Domain Adaptation

Python★ 84⑂ 5
View BaiShuanghao/Prompt-based-Distribution-Alignment
→
67

001TMF / harness-forge

Turn Claude Code into its own Meta-Harness — a skill that evolves the scaffolding around a fixed model (memory, retrieval, context, prompts) via a native propose→score→Pareto loop.

Python★ 80⑂ 8
View 001TMF/harness-forge
→
68

ShiZhengyan / PowerfulPromptFT

[NeurIPS 2023 Main Track] This is the repository for the paper titled "Don’t Stop Pretraining? Make Prompt-based Fine-tuning Powerful Learner"

Python★ 76⑂ 19
View ShiZhengyan/PowerfulPromptFT
→
69

Jian-Lang / RAGPT

This repo is the official implementation of "Retrieval-Augmented Dynamic Prompt Tuning for Incomplete Multimodal Learning" accepted by AAAI 2025.

Python★ 67⑂ 2
View Jian-Lang/RAGPT
→
70

Chia-Hsuan-Lee / DST-as-Prompting

Source code for Dialogue State Tracking with a Language Model using Schema-Driven Prompting

Python★ 66⑂ 14
View Chia-Hsuan-Lee/DST-as-Prompting
→
71

dx-corp / dspy-advanced-prompting

State-of-the-art prompting techniques implementation with DSpy - Manager-style prompts, role personas, meta-prompting, and more

Python★ 61⑂ 4
View dx-corp/dspy-advanced-prompting
→
72

Terse-AI / terseai

Claude Code & Cursor token usage monitor and cost tracker for macOS & Windows. Live token/cost/burn monitoring across 8 AI coding agents

JavaScript★ 59⑂ 8
View Terse-AI/terseai
→
73

egmaminta / GEPA-Lite

A lightweight implementation of the GEPA (Genetic-Pareto) prompt optimization method for large language models.

Python★ 58⑂ 4
View egmaminta/GEPA-Lite
→
74

Open-Prompting / Knowledge-Base

Открытая база знаний о нейросетях

★ 58⑂ 6
View Open-Prompting/Knowledge-Base
→
75

richard-peng-xia / LMPT

[ACLW'24] LMPT: Prompt Tuning with Class-Specific Embedding Loss for Long-tailed Multi-Label Visual Recognition

Python★ 58⑂ 5
View richard-peng-xia/LMPT
→
76

skillberry-ai / cap-evolve

Optimize any AI agent’s skills, tools/MCP, and prompts against your own evals.

Python★ 57⑂ 16
View skillberry-ai/cap-evolve
→
77

arazd / ResidualPrompts

Residual Prompt Tuning: a method for faster and better prompt tuning.

Python★ 56⑂ 8
View arazd/ResidualPrompts
→
78

mala-lab / AnomalyGFM

Official PyTorch implementation of KDD2025 paper "AnomalyGFM: Graph Foundation Model for Zero/Few-shot Anomaly Detection"

Python★ 55⑂ 4
View mala-lab/AnomalyGFM
→
79

danielsobrado / ainovelprompter

Create the prompts you need to write your Novel using AI

Go★ 53⑂ 10
View danielsobrado/ainovelprompter
→
80

developzir / gepa-mcp

MCP server integrating GEPA (Genetic-Evolutionary Prompt Architecture) for automatic prompt optimization with Claude Desktop

Python★ 52⑂ 4
View developzir/gepa-mcp
→
81

zhiyichin / P4D

[ICML 2024] Prompting4Debugging: Red-Teaming Text-to-Image Diffusion Models by Finding Problematic Prompts (Official Pytorch Implementation)

Python★ 52⑂ 1
View zhiyichin/P4D
→
82

HKUDS / PromptMM

[WWW'2024] "PromptMM: Multi-Modal Knowledge Distillation for Recommendation with Prompt-Tuning"

Python★ 51⑂ 3
View HKUDS/PromptMM
→
83

BatsResearch / menghini-neurips23-code

Exploring prompt tuning with pseudolabels for multiple modalities, learning settings, and training strategies.

Python★ 50⑂ 3
View BatsResearch/menghini-neurips23-code
→
84

zhengzangw / DoPrompt

Official implementation of PCS in essay "Prompt Vision Transformer for Domain Generalization"

Python★ 49⑂ 4
View zhengzangw/DoPrompt
→
85

knightyxp / DGL

[AAAI 2024] DGL: Dynamic Global-Local Prompt Tuning for Text-Video Retrieval.

Python★ 49⑂ 2
View knightyxp/DGL
→
86

VITA-Group / DP-OPT

[ICLR'24 Spotlight] DP-OPT: Make Large Language Model Your Privacy-Preserving Prompt Engineer

Python★ 48⑂ 10
View VITA-Group/DP-OPT
→
87

johnpsasser / claude-code-prompt-optimizer

AI-powered prompt optimization hook for Claude Code. Transforms simple prompts into comprehensive, structured instructions using Claude Opus 4.6's advanced reasoning capabilities.

TypeScript★ 47⑂ 4
View johnpsasser/claude-code-prompt-optimizer
→
88

Lumi-Script / Suno-Architect

Create Suno Prompts Using Gemini Flash, works with the Suno API. Create professional-looking timed word-for-word lyrics videos.

TypeScript★ 46⑂ 2
View Lumi-Script/Suno-Architect
→
89

mlvlab / DAPT

Distribution-Aware Prompt Tuning for Vision-Language Models (ICCV 2023)

Python★ 45⑂ 5
View mlvlab/DAPT
→
90

Mavenoid / prompt-hyperopt

Improve prompts for e.g. GPT3 and GPT-J using templates and hyperparameter optimization.

Python★ 41⑂ 3
View Mavenoid/prompt-hyperopt
→
91

DengBoCong / prompt-tuning

A pipeline for Prompt-tuning

Python★ 41⑂ 14
View DengBoCong/prompt-tuning
→
92

JacobHuang91 / prompt-refiner

🚀 Lightweight Python library for building production LLM applications with smart context management and automatic token optimization.

Python★ 40⑂ 3
View JacobHuang91/prompt-refiner
→
93

bighuang624 / VoP

[CVPR 2023] VoP: Text-Video Co-operative Prompt Tuning for Cross-Modal Retrieval

★ 38⑂ 3
View bighuang624/VoP
→
94

ViryaZheng / promptly-prompt

Claude Code skill that forces AI to understand before executing. Three disciplines: cognition check, requirement understanding, method search.

Python★ 37⑂ 0
View ViryaZheng/promptly-prompt
→
95

mcp-shark / lazy-tool

local-first MCP discovery runtime for agents — search before invoke, reduce prompt bloat, and route to local MCP tools

Go★ 36⑂ 3
View mcp-shark/lazy-tool
→
96

imJunaidAfzal / Prompt-Engineering

Prompt Engineering for Language models (GPT-3, GPT-4, chatGPT) and text-to-image models (Stable Diffusion, Midjourney, Dall-e)

Jupyter Notebook★ 36⑂ 6
View imJunaidAfzal/Prompt-Engineering
→
97

AmanPriyanshu / GeneticPromptLab

GeneticPromptLab uses genetic algorithms for automated prompt engineering (for LLMs), enhancing quality and diversity through iterative selection, crossover, and mutation

Python★ 36⑂ 4
View AmanPriyanshu/GeneticPromptLab
→
98

UCSB-AI / CPL

Official implementation of our EMNLP 2022 paper "CPL: Counterfactual Prompt Learning for Vision and Language Models"

Python★ 35⑂ 6
View UCSB-AI/CPL
→
99

arjun988 / promptModel

PromptForge scores LLM prompts across seven quality dimensions, then rewrites weak prompts into clear, intent-preserving instructions

Jupyter Notebook★ 33⑂ 2
View arjun988/promptModel
→
100

renytek13 / Soft-Prompt-Generation

[ECCV 2024] Soft Prompt Generation for Domain Generalization

Python★ 33⑂ 2
View renytek13/Soft-Prompt-Generation
→

Prompt Optimization & Compression

Prompt Libraries, Templates & Collections

Prompt Tuning & Evaluation

Guardrails, Structured Output & Testing

More AI Trending Projects

1

cloudflare / security-audit-skill

JavaScript★ 18,286⑂ 1,023▲ 2,428 stars
→
2

affaan-m / ECC

JavaScript★ 263,994⑂ 39,485▲ 826 stars
→
3

addyosmani / agent-skills

JavaScript★ 97,817⑂ 10,300▲ 736 stars
→
4

docling-project / docling

Python★ 67,466⑂ 4,869▲ 585 stars
→
5

higgsfield-ai / higgsfield

Jupyter Notebook★ 5,481⑂ 962▲ 465 stars
→
6

anthropics / claude-code

TypeScript★ 147,260⑂ 24,085▲ 419 stars
→

Iterative prompting: a loop, not a magic sentence

Iterative prompt refinement means treating a prompt as something you test rather than something you write once. The loop is short: write a first version, run it against a fixed set of inputs you care about, look at where it fails, change one thing, run it again. What makes that engineering rather than tinkering is the fixed set — a small evaluation file kept next to the prompt, so every change is measured against the same cases instead of your memory of last week.

Real examples of iteration look banal on purpose: moving an instruction from the middle of a long prompt to the end because the model honours the last constraint more reliably; replacing a vague adjective with an explicit output format; splitting one prompt that does three jobs into two that do one each. The optimiser projects below automate the search, but the loop is the technique — they simply run it faster than you can by hand.

What prompt compression does

Prompt compression is the family of techniques that shorten the input without changing the answer. It splits into two kinds. Token-level pruning deletes text the model demonstrably does not need — stop-words, duplicated instructions, boilerplate from a retrieved document — usually with a small trained model scoring each span. Prompt rewriting restates a long instruction more densely, often by letting a model do the shortening and then verifying that behaviour did not change. Both pay off when the same long prefix is sent on every request: cost scales with input tokens, so a prefix that is 40% smaller is a bill that is roughly 40% smaller, and long prompts also raise latency and lower reliability.

Prompt hygiene: versioning, evaluation, structure

Prompt hygiene is what keeps a working prompt working after three people have edited it. Concretely: keep prompts in version control as files rather than as strings buried in application code; keep a small evaluation set and run it before merging a prompt change, the same way you would run tests before merging code; state the output format explicitly and validate it, so a malformed answer surfaces as an error instead of a parse failure three services downstream. The structured-output and guardrail projects in the last section exist because asking politely for JSON is not a validation strategy.

Prompt engineering questions

What is iterative prompt refinement? Repeatedly revising a prompt and re-measuring it against a fixed set of test inputs, changing one variable per round, until the failure rate on those inputs is acceptable.

Which is an example of iteration in prompt engineering? Adding an explicit output schema after seeing the model return prose, re-running the same evaluation set, and confirming that parse failures dropped — then keeping the version that passed.

What is prompt compression? Reducing the number of tokens a prompt consumes while preserving the model behaviour you rely on, usually by pruning unnecessary spans or rewriting instructions more densely.

What is prompt hygiene? Treating prompts as versioned artefacts: stored in files, reviewed, tested against an evaluation set, with an explicit output contract and validation around them.

Do I need a framework to do this? No. A folder of prompt files, a script that runs them over a JSONL of cases and a diff of the results covers most of it. Frameworks start to pay off once the number of prompts and models grows.

Related AI Trending Lists