Recipes

LangGPT-style prompt library for a repo's AI features

Discovered from README cross-links · yesterday

Content & CreativeSoftware & DevOps

Built reusable structured prompts for a repo's AI features using LangGPT.

What they did

They wanted every AI-facing feature in their repo to use consistent, reviewable prompts instead of ad-hoc strings scattered across files. Starting from the LangGPT README, they adopted the Role/Profile/Goal/Skills/Rules/Workflow/Initialization template as the house style. They drafted a first pass of prompts for three features (a code-review assistant, a changelog writer, and a support-triage bot), then ran each draft through prompt-optimizer to tighten wording, remove contradictions, and add explicit done criteria and non-goals. For the trickier roles they borrowed patterns from wonderful-prompts — few-shot examples, output schemas, refusal rules — and folded them into the LangGPT sections rather than inventing new structure. Each prompt was saved as a markdown file under prompts/ with front-matter (name, version, owner, model targets), and a short README explained how to invoke them. They also added a lightweight eval checklist per prompt: does it stay in character, does it refuse to hallucinate, does the output match the declared schema. Finally they wired the prompt files into the app by loading them at build time so product code references a prompt id, not a raw string.

How it went

They ended up with a small, versioned prompt library that reviewers could diff like code. The LangGPT structure made intent obvious at a glance, and prompt-optimizer passes cut vague instructions noticeably. The changelog and triage prompts were usable after two iterations; the code-review prompt needed more few-shot examples before outputs were consistent. Overall it felt like a solid foundation rather than a finished product — the eval checklist is manual and the prompts still drift when models change.

Worth knowing

LangGPT is a documentation and template framework, not a runtime library, so all wiring and versioning is hand-rolled. prompt-optimizer and wonderful-prompts are separate community resources with their own conventions; results vary by model and language. No automated eval harness was included, so regressions are caught by eye. Model-specific quirks (context limits, instruction-following differences) are not handled by the templates themselves.

Wiring

1) Read the LangGPT README and copy the basic template into prompts/_template.md. 2) Inventory existing inline prompts with a grep for prompt/system/messages strings. 3) Draft each prompt in the template, one file per feature under prompts/. 4) Run drafts through prompt-optimizer, then borrow few-shot and schema patterns from wonderful-prompts where outputs must be structured. 5) Add front-matter (name, version, owner, models) and a per-prompt eval checklist. 6) Add a small loader that reads prompts/*.md at build time and exposes them by id. 7) Replace inline strings in app code with prompt-id lookups. 8) Commit with a note on which prompts are considered stable vs experimental.

Try it yourself

Look at this repo and find every place we build an LLM prompt as a raw string. For each one, rewrite it as a LangGPT-style structured prompt with Role, Profile, Goal (Outcome, Done Criteria, Non-Goals), Skills, Rules, Workflow, and Initialization sections. Save each as prompts/<feature>.md with front-matter for name, version, owner, and target models. Then add a prompts/README.md explaining how to load and invoke them, and refactor the code to load prompts by id instead of inline strings. Keep behavior identical unless a prompt is clearly broken, and list any prompts you think need few-shot examples.

Source

Tools in this stack