From 2deaf97296410bd22599648639131e8194cfc408 Mon Sep 17 00:00:00 2001 From: Konstantinos Galanakis Date: Thu, 9 Jul 2026 15:49:58 +0300 Subject: [PATCH] Align default prompts with the 6-step prompt formula MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restructure every default prompt into a consistent persona → task → context → format → tone layout. Preserve the {{WORDS}}/{{TITLE}}/ {{AUTHOR}} runtime tokens and fix the Content Resizing settings placeholders to pull from get_prompt(). Reframe the stale "default prompt" reference in the prompt-examples doc. --- .../Classifai/Features/ContentResizing.php | 4 +- .../Prompts/ContentGeneration/default.php | 27 ++++++----- .../Prompts/ContentResizing/condense.php | 24 +++++----- .../Prompts/ContentResizing/expand.php | 24 +++++----- .../DescriptiveTextGenerator/default.php | 23 ++++++---- .../Prompts/ExcerptGeneration/default.php | 46 +++++++++---------- .../Prompts/ExcerptGeneration/woocommerce.php | 36 ++++++++------- .../Prompts/ImageTagsGenerator/default.php | 21 ++++++--- .../Prompts/ImageTextExtraction/default.php | 16 +++++-- .../Features/Prompts/KeyTakeaways/default.php | 28 +++++++---- .../Prompts/TitleGeneration/default.php | 28 +++++------ .../Prompts/TitleGeneration/woocommerce.php | 26 +++++------ .../03.advanced-docs/02.prompt-examples.md | 4 +- 13 files changed, 171 insertions(+), 136 deletions(-) diff --git a/includes/Classifai/Features/ContentResizing.php b/includes/Classifai/Features/ContentResizing.php index 0e9c0c803..fb34ed642 100644 --- a/includes/Classifai/Features/ContentResizing.php +++ b/includes/Classifai/Features/ContentResizing.php @@ -223,7 +223,7 @@ public function add_custom_settings_fields() { $this->get_option_name() . '_section', array( 'label_for' => 'condense_text_prompt', - 'placeholder' => esc_html__( 'Decrease the content length no more than 2 to 4 sentences.', 'classifai' ), + 'placeholder' => $this->get_prompt( 'condense' ), 'default_value' => $settings['condense_text_prompt'], 'description' => esc_html__( 'Enter your custom prompt.', 'classifai' ), ) @@ -237,7 +237,7 @@ public function add_custom_settings_fields() { $this->get_option_name() . '_section', array( 'label_for' => 'expand_text_prompt', - 'placeholder' => esc_html__( 'Increase the content length no more than 2 to 4 sentences.', 'classifai' ), + 'placeholder' => $this->get_prompt( 'expand' ), 'default_value' => $settings['expand_text_prompt'], 'description' => esc_html__( 'Enter your custom prompt.', 'classifai' ), ) diff --git a/includes/Classifai/Features/Prompts/ContentGeneration/default.php b/includes/Classifai/Features/Prompts/ContentGeneration/default.php index 00f6b80fc..17e87f3e8 100644 --- a/includes/Classifai/Features/Prompts/ContentGeneration/default.php +++ b/includes/Classifai/Features/Prompts/ContentGeneration/default.php @@ -2,25 +2,28 @@ /** * Default prompt for the Content Generation feature. * + * Structured around the 6-step prompt formula (persona, task, context, + * format, tone). The "examples" step is intentionally omitted because the + * brief is supplied at runtime. + * * @package Classifai */ // phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed return <<<'INSTRUCTION' -You are a copy editor drafting an article for on online publication built-on WordPress. +You are a copy editor drafting an article for an online publication built on WordPress. + +Task: Write a complete article based on the brief provided below. You will receive a brief describing the topic of the article, and you may also receive a title. -You will receive a brief describing the topic of the article. You may also receive a title. +Context: The article will be published as a standalone post. Stay strictly within the topic and claims of the brief - do not invent facts, statistics, dates, quotes, sources, expert names, study citations, or specific numbers. If a specific claim is not in the brief, omit it. -Write a complete article that: -- Stays strictly within the topic and claims of the brief. Do not invent facts, statistics, dates, quotes, sources, expert names, study citations, or specific numbers. If a specific claim is not in the brief, omit it. -- Opens with an introductory paragraph that establishes the topic without restating the title verbatim -- Uses descriptive H2 (and where useful, H3) headings to break the article into scannable sections -- Closes with a brief concluding paragraph that does not begin with "In conclusion" -- Targets approximately 600-900 words unless the brief specifies otherwise -- Uses clear, plain language. Second person ("you") for instructional content; third person otherwise -- Is written in the same language as the brief -- Avoids clickbait phrasing, marketing fluff, and AI-trope openers ("In today's fast-paced world…", "In an era where…", "It's important to note that…") +Format: +- Output only the article content - do not include the title, do not wrap the output in quotes or code fences, and do not add a preamble ("Here's the article:") or trailing commentary +- Open with an introductory paragraph that establishes the topic without restating the title verbatim +- Use descriptive H2 (and where useful, H3) headings to break the article into scannable sections +- Close with a brief concluding paragraph that does not begin with "In conclusion" +- Target approximately 600-900 words unless the brief specifies otherwise -Output only the article content. Do not include the title. Do not wrap the output in quotes or code fences. Do not add a preamble ("Here's the article:") or trailing commentary. +Tone: Use clear, plain language - second person ("you") for instructional content, third person otherwise. Write in the same language as the brief. Avoid clickbait phrasing, marketing fluff, and AI-trope openers ("In today's fast-paced world…", "In an era where…", "It's important to note that…"). INSTRUCTION; // phpcs:enable diff --git a/includes/Classifai/Features/Prompts/ContentResizing/condense.php b/includes/Classifai/Features/Prompts/ContentResizing/condense.php index d575b38dd..f1bc4cf86 100644 --- a/includes/Classifai/Features/Prompts/ContentResizing/condense.php +++ b/includes/Classifai/Features/Prompts/ContentResizing/condense.php @@ -2,26 +2,26 @@ /** * Default prompt for condensing content via the Content Resizing feature. * + * Structured around the 6-step prompt formula (persona, task, context, + * format, tone). The "examples" step is intentionally omitted because the + * content to condense is supplied at runtime. + * * @package Classifai */ // phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed return <<<'INSTRUCTION' -You are an editorial assistant responsible for transforming content into a shorter, more condensed version. +You are a professional content editor who specializes in tight, concise writing. -Goal: You will be provided with some content and you will need to decrease the content length no more than 2 to 4 sentences. +Task: Rewrite the content provided below as a shorter, condensed version. -Write a shorter, more condensed version of the content that: -- Accurately reflects the main topic of the content -- Preserves the original meaning, intent and tone of the content -- Is written in the same language as the source content +Context: Reduce the length by roughly 2 to 4 sentences while keeping the piece complete and readable. Retain the key facts and main points, and preserve the original meaning, intent, and tone. -Ensure you: -- Return only the condensed content, nothing else. Do not include any preamble, explanation, or commentary -- Do not wrap the content in quotes -- Do not prefix the content with "Content:" -- Return content in the same format as it was provided. For example, preserve any inline HTML like links or bold text +Format: +- Output only the condensed content - no preamble, explanation, or commentary +- Do not wrap the content in quotes or add a "Content:" prefix +- Return the content in the same format it was provided, preserving any inline HTML such as links or bold text -Output only the condensed content text. +Tone: Preserve the tone of the original content and write in the same language as the source content. INSTRUCTION; // phpcs:enable diff --git a/includes/Classifai/Features/Prompts/ContentResizing/expand.php b/includes/Classifai/Features/Prompts/ContentResizing/expand.php index e38621705..7d69f5697 100644 --- a/includes/Classifai/Features/Prompts/ContentResizing/expand.php +++ b/includes/Classifai/Features/Prompts/ContentResizing/expand.php @@ -2,26 +2,26 @@ /** * Default prompt for expanding content via the Content Resizing feature. * + * Structured around the 6-step prompt formula (persona, task, context, + * format, tone). The "examples" step is intentionally omitted because the + * content to expand is supplied at runtime. + * * @package Classifai */ // phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed return <<<'INSTRUCTION' -You are an editorial assistant responsible for transforming content into a longer, more detailed version. +You are a professional content writer who specializes in clear, detailed explanations. -Goal: You will be provided with some content and you will need to increase the content length no more than 2 to 4 sentences. +Task: Rewrite the content provided below as a longer, more detailed version. -Write a longer, more detailed version of the content that: -- Accurately reflects the main topic of the content -- Preserves the original meaning, intent and tone of the content -- Is written in the same language as the source content +Context: Increase the length by roughly 2 to 4 sentences by adding relevant context, detail, or examples. Every addition must be accurate and genuinely relevant - do not pad with filler. Preserve the original meaning, intent, and tone. -Ensure you: -- Return only the expanded content, nothing else. Do not include any preamble, explanation, or commentary -- Do not wrap the content in quotes -- Do not prefix the content with "Content:" -- Return content in the same format as it was provided. For example, preserve any inline HTML like links or bold text +Format: +- Output only the expanded content - no preamble, explanation, or commentary +- Do not wrap the content in quotes or add a "Content:" prefix +- Return the content in the same format it was provided, preserving any inline HTML such as links or bold text -Output only the expanded content text. +Tone: Preserve the tone of the original content and write in the same language as the source content. INSTRUCTION; // phpcs:enable diff --git a/includes/Classifai/Features/Prompts/DescriptiveTextGenerator/default.php b/includes/Classifai/Features/Prompts/DescriptiveTextGenerator/default.php index ff03ec3ce..c03aab4be 100644 --- a/includes/Classifai/Features/Prompts/DescriptiveTextGenerator/default.php +++ b/includes/Classifai/Features/Prompts/DescriptiveTextGenerator/default.php @@ -2,27 +2,32 @@ /** * Default prompt for the Descriptive Text Generator feature. * + * Structured around the 6-step prompt formula (persona, task, context, + * format, tone). The "examples" step is intentionally omitted because the + * image is supplied at runtime. + * * @package Classifai */ // phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed return <<<'INSTRUCTION' -You are an editorial assistant responsible for generating alt text for an image displayed on a website. The alt text will be read aloud by screen readers to users who cannot see the image, so it must convey what the image shows clearly and efficiently. +You are an accessibility specialist who writes alt text for images used on websites. + +Task: Write alt text for the image provided. -Content: +Context: The alt text is read aloud by screen readers to users who cannot see the image, so it must convey what the image shows clearly and efficiently. - Describe only what is clearly visible in the image. Do not infer relationships, identities, intent, emotions, or attributes (age, gender, race, ethnicity) unless they are visually unambiguous and central to the image's meaning. - Describe the image as a whole when it forms a scene; describe the main subject when one subject clearly dominates. - If the image contains meaningful text (signs, labels, quotes, chart titles), include that text verbatim - it is often the most important content. - Be specific where it adds meaning ("golden retriever puppy on a hardwood floor" rather than "dog"), but do not pad with irrelevant detail. -- Stay factual. Avoid subjective adjectives such as "beautiful", "stunning", "majestic", or "amazing". - For complex images like charts or diagrams, describe what the image is communicating, not every visual element. -Length and phrasing: -- Aim for 125 characters or fewer. Never exceed 200 characters. -- Write a single sentence in plain text. No Markdown, no line breaks. -- Do not begin with "Image of", "Picture of", "Photo of", "Graphic of", "A close-up of", "This is", "Shown is", "Depicted is", or similar - screen readers already announce that the element is an image. -- Write in English unless instructed otherwise. +Format: +- Output only the alt text - no quotes, no "Alt text:" or "Description:" prefix, and no commentary or alternatives +- Aim for 125 characters or fewer, and never exceed 200 characters +- Write a single sentence in plain text - no Markdown, no line breaks +- Do not begin with "Image of", "Picture of", "Photo of", "Graphic of", "A close-up of", "This is", "Shown is", "Depicted is", or similar - screen readers already announce that the element is an image -Output only the alt text. Do not wrap it in quotes. Do not prefix it with "Alt text:", "Description:", or anything similar. Do not add commentary or alternatives. +Tone: Stay factual and objective. Avoid subjective adjectives such as "beautiful", "stunning", "majestic", or "amazing". Write in English unless instructed otherwise. INSTRUCTION; // phpcs:enable diff --git a/includes/Classifai/Features/Prompts/ExcerptGeneration/default.php b/includes/Classifai/Features/Prompts/ExcerptGeneration/default.php index 180644bfd..b8ca150e2 100644 --- a/includes/Classifai/Features/Prompts/ExcerptGeneration/default.php +++ b/includes/Classifai/Features/Prompts/ExcerptGeneration/default.php @@ -2,20 +2,25 @@ /** * Default prompt for the Excerpt Generation feature. * + * Structured around the 6-step prompt formula (persona, task, context, + * format, tone). The "examples" step is intentionally omitted because the + * content to summarize is supplied at runtime. + * * Supports the following keys via $data (passed by the Provider): * - words: Target excerpt length in words. * - title: Title of the item being summarized. * - author: Display name of the post author. * - * When called without $data (e.g. from settings seeding), each variable - * falls back to its `{{TOKEN}}` form so the same string is shown as the - * "ClassifAI default prompt" in the settings repeater. + * When called without $data (e.g. from settings seeding or when the Provider + * performs its own {{TOKEN}} replacement), each variable falls back to its + * `{{TOKEN}}` form so the same string is shown as the "ClassifAI default + * prompt" in the settings repeater and the Provider can substitute values. * * @package Classifai * - * @var string $words Provided by extract() of $data; falls back to a token. - * @var string $article_title Provided by extract() of $data; falls back to a token. - * @var string $author Provided by extract() of $data; falls back to a token. + * @var string $words Provided by extract() of $data; falls back to a token. + * @var string $article_title Provided by extract() of $data; falls back to a token. + * @var string $author Provided by extract() of $data; falls back to a token. */ if ( ! defined( 'ABSPATH' ) ) { @@ -28,27 +33,20 @@ // phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed return << Write an SEO-friendly title for the following content that will encourage readers to clickthrough, staying within a range of 40 to 60 characters and format it in sentence case.