Agent skill · writing content · jeremylongshore

langchain-prompt-engineering

Manage LangChain 1.0 prompts like code \u2014 LangSmith prompt hub versioning,\n\

Why this skill is useful

Adds executable scripts for managing LangChain prompts, including version control and A/B testing workflows that aren't publicly documented.

What it needs

Requires python installed locally. Requires langsmith account access. About 8k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

LangChain Prompt Engineering (Python) Overview A team inherits a LangChain 1.0 codebase with 47 prompt strings embedded as f-string literals across 12 Python files. Nobody knows which version is live in production. Rollback is git-only — requires a deploy. An A/B test on a single prompt requires shipping code and running two services in parallel. A user pastes a JSON snippet containing { into a chat endpoint and the whole thing throws: That is pain-catalog entry P57 — ChatPromptTemplate.frommessages with f-string templates treat every brace-delimited identifier as a variable marker — including ones that appear inside user content. Any literal braces in user input (code snippets, JSON, LaTeX, CSS selectors) crash the chain. Four prompt-layer pitfalls this skill fixes: P57 — f-string template breaks on literal { in user input P58 — Claude expects system content in the top-level system field, not a later HumanMessage; reordering middleware silently loses persona P53 — Pydantic v2 strict default rejects the helpful extra fields models love to add to extraction schemas P03 — withstructuredoutput(method="functioncalling") silently drops Optional[list[X]] fields; use discriminated unions instead Sections cover: consolidating scattered prompts into a prompts/ module as ChatPromptTemplate objects, pushing/pulling from the LangSmith prompt hub (pinning production to 8-char commit hashes), switching to jinja2 template format, Claude XML-tag conventions (<document>, <example>, <context>), dynamic few-shot with semantic/MMR selectors, and A/B testing two prompt versions via feature flag. Pin: langchain-core 1.0.x, langsmith >= 0.1.99, langchain-anthropic 1.0.x, langchain-openai 1.0.x. Pain-catalog anchors: P03, P53, P57, P58. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/langchain-prompt-engineering

View the source on GitHub

Browse the @skills marketplace