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. T3AF provides the backend module and shared storage. Your extension provides the prompt contracts, category metadata, and runtime resolver.Architecture
PromptContractRegistry
Your extension’s PHP source of truth for built-in prompt types, labels, default text, scopes, and required variables.
PromptCatalogProviderInterface
Connects your prompt contracts to T3AF > AI Prompts.
tx_nst3af_ai_prompt
Shared table owned by T3AF 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\NsT3AF\Contract\PromptCatalogProviderInterface. - Tag the provider with
t3af.prompt_catalog_provider. - Add a runtime resolver that reads custom prompt rows through T3AF services.
- Use the resolved prompt when calling
AiServiceInterface. - Flush caches and verify the category in T3AF > AI Prompts.
Prompt contract rules
- Use stable
prompt_typevalues, for exampleproduct_summary. - Use a unique
category_idprefixed with your extension key. - Use
[variable]placeholders for required values. - Do not seed built-in prompts into the database. Keep built-ins in PHP.
Minimal contract idea
Service registration
Register prompt providers in your extension.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.
AiServiceInterface with a stable featureKey.
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 T3AF > 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
isAvailable()returnstrue. - Flush caches.
- Confirm
extension_key,category_id,scope, andprompt_typematch your resolver query. - Confirm the selected prompt title is passed to the feature runtime.