Custom Prompt Catalogs
Use a custom prompt catalog when your extension needs editable LLM instruction templates in AI Foundation > AI Prompts. Prompt catalogs let your extension ship built-in defaults while allowing editors to create project-specific overrides.
Purpose
AI prompts are feature prompts, not MCP workflow templates. Use them for extension features such as SEO generation, content generation, chat answers, product summaries, or support replies.
AI Foundation provides the backend module and shared storage. Your extension provides the prompt contracts, category metadata, and runtime resolver.
Architecture
PromptContract Registry - Your extension’s PHP source of truth for built-in prompt types, labels, default text, scopes, and required variables.
PromptCatalog Provider Interface - Connects your prompt contracts to AI Foundation > AI Prompts.
tx_nst3af_ ai_ prompt - Shared table owned by AI Foundation for editor-created custom prompts.
- Runtime resolver
- Your feature code decides which text to use: explicit request text, saved custom prompt, or built-in default.
Implementation steps
- Define prompt contracts in your extension.
- Implement
NITSAN\.Ns T3AF\ Contract\ Prompt Catalog Provider Interface - Tag the provider with
t3af..prompt_ catalog_ provider - Add a runtime resolver that reads custom prompt rows through AI Foundation services.
- Use the resolved prompt when calling
Ai.Service Interface - Flush caches and verify the category in AI Foundation > AI Prompts.
Prompt contract rules
- Use stable
prompt_values, for exampletype product_.summary - Use a unique
category_prefixed with your extension key.id - Use
[variable]placeholders for required values. - Do not seed built-in prompts into the database. Keep built-ins in PHP.
Minimal contract idea
private const CONTRACTS = [
'product_summary' => [
'scope' => 'catalog',
'label' => 'Product summary',
'defaultText' => 'Write a concise product summary for a TYPO3 catalog page. Focus on key benefits, keep it under 80 words, and use clear retail language.',
'requiredVariables' => [],
],
];
Service registration
Register prompt providers in your extension.
services:
_defaults:
autowire: true
autoconfigure: true
_instanceof:
NITSAN\NsT3AF\Contract\PromptCatalogProviderInterface:
tags: ['t3af.prompt_catalog_provider']
MyVendor\MyExt\Prompt\:
resource: '../Classes/Prompt/'
Runtime usage
At runtime, resolve prompt text before making the AI request. A common resolution order is:
- Explicit prompt text passed by the current request.
- Custom prompt selected by title/type from
tx_.nst3af_ ai_ prompt - Built-in default from your contract registry.
Then pass the resolved text to Ai with a stable feature.
Best practices
- Keep category IDs unique across the TYPO3 instance.
- Keep prompt types stable after release.
- Validate that custom prompt text still contains required variables.
- Do not create extension-specific prompt tables unless the implementation requires separate domain data.
- Keep prompts focused on one feature workflow.
Verification
- Flush TYPO3 caches.
- Open AI Foundation > AI Prompts.
- Confirm your category card appears.
- Open the category and verify built-in prompt rows.
- Add a custom prompt and save it.
- Trigger your feature and confirm the resolver can use the custom prompt.
Troubleshooting
Category is missing
- Confirm the provider is tagged with
t3af..prompt_ catalog_ provider - Confirm
isreturnsAvailable () true. - Flush caches.
Custom prompt is not used
- Confirm
extension_,key category_,id scope, andprompt_match your resolver query.type - Confirm the selected prompt title is passed to the feature runtime.