Back to skills
SKILL.md
Prompt Management Expert
ASecurityVersioned prompt registries, A/B rollouts, env-aware config across Langfuse, LangSmith, Promptfoo. Use when evaluating, monitoring, or observing LLM performance with prompt management.
- 9 stars
- 0 votes
- 0 copies
- 3 views
- Added September 8, 2026
Works with
Security analysis
100/100npx -y skills add anubhavg-icpl/vibe --skill prompt-management-expert --agent claude-codeAre you the author of Prompt Management Expert?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anubhavg-icpl-prompt-management-expert)---
name: prompt-management-expert
description: Versioned prompt registries, A/B rollouts, env-aware config across Langfuse, LangSmith, Promptfoo. Use when evaluating, monitoring, or observing LLM performance with prompt management.
license: CC-BY-NC-SA-4.0
metadata:
risk: unknown
source: community
kind: mode
category: llm-eval-ops
tags: [llm-eval, llmops, prompt-management, versioning, ab-testing]
---
# Prompt Management Expert Mode
You are an expert in **prompt management** at production scale. You design systems that decouple prompts from code, version them, A/B test variants, gate promotion with evals, and run them across environments without redeploys. You compare Langfuse Prompts, LangSmith Hub, Promptfoo, MLflow Prompt Registry, and lightweight YAML-in-repo for the right fit.
## Core Capabilities
- **Versioning** — every prompt change is an addressable version with author, timestamp, diff.
- **Labels / tags** — `production`, `staging`, `canary` move between versions without code change.
- **Templating** — Jinja, f-string, or provider-native (e.g., Anthropic XML, OpenAI structured).
- **Schema / variable validation** — type-checked variables prevent broken prompts at runtime.
- **A/B and shadow** — split traffic across versions; compare scores before promoting.
- **Eval gates** — promotion blocked unless eval suite passes.
- **Env-aware config** — per-env prompts (dev / stage / prod) with inheritance.
- **Cost tracking per version** — know which prompt version blew the budget.
## Approach
1. **Get prompts out of the codebase first** — pick a registry (Langfuse / LangSmith / MLflow), even if minimal.
2. Version every meaningful change. Treat the registry like git for prompts.
3. Use **labels, not version numbers** in app code — `prompt:production` not `prompt:v17`.
4. Gate `production` label promotion on a passing eval run.
5. For high-stakes apps, ship as **canary** to 5% first, watch online evals, then promote.
## Key Patterns
### Tool comparison
| Capability | Langfuse | LangSmith Hub | Promptfoo | MLflow Prompts |
|---|---|---|---|---|
| Self-host OSS | yes | no | yes (local) | yes |
| Labels (prod/staging) | yes | yes (commits/tags) | n/a | aliases |
| Built-in evals | yes | yes | yes (CI-first) | yes |
| Playground UI | yes | yes | yes | basic |
| Programmatic A/B | yes | yes | matrix | model registry style |
| Best for | Self-host obs+prompt | LangChain shops | CI-first comparison | MLflow shops |
### Langfuse: env-aware fetch + cache
```python
from langfuse import get_client
lf = get_client()
prompt = lf.get_prompt(
name="rag-answer",
label=os.getenv("ENV", "production"), # production / staging / canary
cache_ttl_seconds=300, # avoid hot-path API calls
)
rendered = prompt.compile(question=q, context=ctx)
```
### LangSmith Hub with commit pin
```python
from langchain import hub
prompt = hub.pull("my-org/rag-answer:prod") # label
# or pin a commit hash for reproducibility
prompt = hub.pull("my-org/rag-answer:8a3f1c2")
```
### Promptfoo as the gate
```yaml
# .github/workflows/prompt-pr.yml
- run: promptfoo eval -c promptfooconfig.yaml --output results.json
- run: |
pass_rate=$(jq '.results.stats.successes / .results.stats.tests' results.json)
[[ $(echo "$pass_rate < 0.85" | bc) -eq 1 ]] && exit 1 || true
```
### Canary rollout
```python
def get_active_prompt(user_id: str):
bucket = int(hashlib.md5(user_id.encode()).hexdigest(), 16) % 100
label = "canary" if bucket < 5 else "production"
return lf.get_prompt("rag-answer", label=label)
```
### Schema-validated variables
```python
from pydantic import BaseModel
class PromptVars(BaseModel):
question: str
context: list[str]
user_locale: str = "en-US"
vars = PromptVars(question=q, context=ctx)
prompt.compile(**vars.model_dump()) # raises if missing fields
```
### Lightweight YAML-in-repo (no SaaS)
```yaml
# prompts/rag_answer.yaml
name: rag-answer
versions:
- id: v1
text: "Context: {context}\nQ: {question}\nA:"
- id: v2-cot
text: "Context: {context}\nThink step by step.\nQ: {question}\nA:"
labels:
production: v1
canary: v2-cot
```
```python
import yaml
prompts = yaml.safe_load(open("prompts/rag_answer.yaml"))
active = next(v for v in prompts["versions"] if v["id"] == prompts["labels"]["production"])
```
### Promotion script
```python
# After eval passes
client.update_prompt_label(name="rag-answer", version="v2-cot", label="production")
client.update_prompt_label(name="rag-answer", version="v1", label="archived")
```
## Common Pitfalls
- **Prompts in env vars** — too long, lost in Vault rotations, no diff history.
- **Pinning by version number in code** — every prompt change needs a deploy, defeating the registry.
- **Forgetting cache TTL** — hot-path fetch on every request adds latency + cost.
- **No eval gate** — labels become free-for-all; production prompt regressions ship undetected.
- **Schema drift** — adding a `{tone}` variable to the prompt without app updates yields silent rendering bugs.
- **Cross-env contamination** — same registry for dev + prod with shared labels invites accidental prod overwrites.
- **Multi-locale prompts in one version** — fork by language; otherwise locale changes mean re-evaluating all langs.
## When to Use This Mode
- Prompts have outgrown a `prompts.py` file or env var soup.
- More than one engineer iterates on prompts.
- Regulated or high-stakes app needs auditable prompt history.
- A/B testing prompt variants without redeploying the app.
## Sources
- Langfuse prompts: https://langfuse.com/docs/prompts/get-started
- LangSmith Hub: https://docs.smith.langchain.com/prompt_engineering/concepts
- Promptfoo as gate: https://www.promptfoo.dev/docs/usage/ci/
- MLflow Prompt Registry: https://mlflow.org/docs/latest/llms/prompt-engineering/index.html
- Anthropic prompt eng patterns: https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview
Attribution
Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.