Install any skill in seconds. Free to start, no credit card required.
Get Started Free →jeremylongshore/langchain-prompt-engineering
Manage LangChain 1.0 prompts like code — LangSmith prompt hub versioning, XML-tag conventions for Claude, few-shot example selection, discriminated-union extraction schemas, and A/B test wiring.
Passed 20 of 22 test cases with the skill, and 17 of 22 without it.
3 fixed17 passed either way2 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 3 test cases the skill fixed. Same model, same prompt, with and without the skill.
Whenever our chat endpoint receives user input containing raw JSON or code snippets with curly braces, our LangChain template crashes during variable formatting. We are also building for Claude 3.5 and want to ensure system instructions and untrusted user inputs follow clean structural boundaries. Could you refactor our prompt setup into a dedicated prompts module in Python and update our Pydantic extraction schema so it doesn't fail when the model returns unexpected extra fields?
| Checked | Without skill | With skill |
|---|---|---|
| Sets template_format="jinja2" on ChatPromptTemplate.from_messages | Missed | Passed |
| Places persona instructions in a system role message | Passed | Passed |
| Encloses user document text inside XML tags | Passed | Passed |
| Sets model_config = ConfigDict(extra="ignore") on the Pydantic schema | Passed | Passed |
The instructions your model reads when the skill loads.
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:
KeyError: '"model"'
File ".../langchain_core/prompts/string.py", line ..., in format
That is pain-catalog entry P57 — ChatPromptTemplate.from_messages 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:
{ in user inputsystem field,
not a later HumanMessage; reordering middleware silently loses personawith_structured_output(method="function_calling") silently drops
Optional[list[X]] fields; use discriminated unions insteadSections 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.
test cases passed, vs 17 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.