prompt-library is a WordPress plugin for people who keep prompts for language models. Templates have named, typed variables and are published as immutable numbered versions. Other plugins fetch and render a template by slug and version, so a wording change no longer needs a code change and a deploy. The code is at https://github.com/IndianOpinion/prompt-library, licensed MIT. Version v0.1.0 was released on 15 November 2026.
We wrote it from scratch from a one-line idea. Its PRD says plainly that it was not extracted from running code, and it has not run on a live site. The 47 utilities in this series were specified, built, reviewed and released between 11 and 19 November 2026 by language-model coding agents under the editor’s direction, in five roles: a spec writer, a spec reviewer, a builder that saw only the spec, an independent code reviewer and a releaser. The editor made the rulings on every open question.
Plugins that call language models keep their prompts as string literals in PHP. Every wording change is a code change. Nobody can see which wording produced which output last Tuesday. Editors who own the wording cannot change it, and engineers who can change it cannot easily try it. When a prompt is built by string concatenation, a value that contains a section’s closing marker or a stray placeholder silently changes the prompt’s meaning.
The opposite mistake is to keep prompts as ordinary posts. They then pass through display filters that turn straight quotes curly, add paragraph tags, run shortcodes and strip markup for users without the unfiltered HTML capability. A prompt saved and read back is no longer the prompt that was written.
{{ name }} only, with no filters, defaults, dots or expressions.string, text, integer, number, boolean, enum, list, json), a length limit and an escape mode.live or latest.The draft lives in one post meta value and post content stays empty, so no content filter, shortcode, autop, texturize or kses pass touches prompt text. Published versions are rows in their own table, not WordPress revisions, because sites limit or disable revisions and a version a consumer depends on must never disappear. A unique key on template and version number makes a duplicate number impossible. Each version stores a SHA-256 content hash, and a render recomputes it and compares.
The parser, renderer and value objects have no WordPress dependency. Rendering is one left-to-right pass, so a value that contains {{ other }} stays literal text. Checks run in a fixed order: types, defaults, required values, lengths, escaping, substitution, total size. Each stage lists every problem it finds, and nothing partial is ever returned. An uncached render costs two queries.
The escape modes are plain (strips control characters, bidirectional overrides and the byte order mark, but keeps the zero-width joiner and non-joiner that Indic scripts need), raw, line, json and fenced. A fenced value goes between <name> and </name> lines, and any closing tag inside the value is rewritten so the value cannot close its own fence.
$prompt = promptlib_render('article-summary', [
'title' => $post->post_title,
'text' => wp_strip_all_tags($post->post_content),
], 'live', ['consumer' => 'my-plugin']);
$messages = $prompt->toMessages(); // system first, then user
A plugin that does not want a hard dependency uses the promptlib_render filter instead. It returns null when prompt-library is inactive, so the caller falls back to its own text.
PROMPTLIB_DISABLE_RUNNER wins over the setting. Preview still works.max_length throw. Nothing is truncated silently.The independent code review changed these before the merge:
Test status: this is v0.1.0. 175 PHPUnit tests run without WordPress on a stub layer, with a fake database that simulates a skipped column add and a unique-key race. Static analysis and code style checks passed. Per-site table isolation on multisite needs a real WordPress test install and was not covered. CI has not yet run on GitHub: the commit adding the workflow stayed local because the token lacked the workflow scope.
It needs WordPress 6.4 or later, PHP 8.1 or later, and the mbstring and json extensions. The test runner needs Composer, to fetch llm-json-php, the only runtime dependency.
cd wp-content/plugins
git clone https://github.com/IndianOpinion/prompt-library.git
cd prompt-library
composer install --no-dev
Without Composer, templates, versions, rendering, import and export still work. The test runner stays off, with a notice.