Skip to content

Commit 2deaf97

Browse files
committed
Align default prompts with the 6-step prompt formula
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.
1 parent 5a8a2ca commit 2deaf97

13 files changed

Lines changed: 171 additions & 136 deletions

File tree

includes/Classifai/Features/ContentResizing.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public function add_custom_settings_fields() {
223223
$this->get_option_name() . '_section',
224224
array(
225225
'label_for' => 'condense_text_prompt',
226-
'placeholder' => esc_html__( 'Decrease the content length no more than 2 to 4 sentences.', 'classifai' ),
226+
'placeholder' => $this->get_prompt( 'condense' ),
227227
'default_value' => $settings['condense_text_prompt'],
228228
'description' => esc_html__( 'Enter your custom prompt.', 'classifai' ),
229229
)
@@ -237,7 +237,7 @@ public function add_custom_settings_fields() {
237237
$this->get_option_name() . '_section',
238238
array(
239239
'label_for' => 'expand_text_prompt',
240-
'placeholder' => esc_html__( 'Increase the content length no more than 2 to 4 sentences.', 'classifai' ),
240+
'placeholder' => $this->get_prompt( 'expand' ),
241241
'default_value' => $settings['expand_text_prompt'],
242242
'description' => esc_html__( 'Enter your custom prompt.', 'classifai' ),
243243
)

includes/Classifai/Features/Prompts/ContentGeneration/default.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,28 @@
22
/**
33
* Default prompt for the Content Generation feature.
44
*
5+
* Structured around the 6-step prompt formula (persona, task, context,
6+
* format, tone). The "examples" step is intentionally omitted because the
7+
* brief is supplied at runtime.
8+
*
59
* @package Classifai
610
*/
711

812
// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
913
return <<<'INSTRUCTION'
10-
You are a copy editor drafting an article for on online publication built-on WordPress.
14+
You are a copy editor drafting an article for an online publication built on WordPress.
15+
16+
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.
1117
12-
You will receive a brief describing the topic of the article. You may also receive a title.
18+
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.
1319
14-
Write a complete article that:
15-
- 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.
16-
- Opens with an introductory paragraph that establishes the topic without restating the title verbatim
17-
- Uses descriptive H2 (and where useful, H3) headings to break the article into scannable sections
18-
- Closes with a brief concluding paragraph that does not begin with "In conclusion"
19-
- Targets approximately 600-900 words unless the brief specifies otherwise
20-
- Uses clear, plain language. Second person ("you") for instructional content; third person otherwise
21-
- Is written in the same language as the brief
22-
- 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…")
20+
Format:
21+
- 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
22+
- Open with an introductory paragraph that establishes the topic without restating the title verbatim
23+
- Use descriptive H2 (and where useful, H3) headings to break the article into scannable sections
24+
- Close with a brief concluding paragraph that does not begin with "In conclusion"
25+
- Target approximately 600-900 words unless the brief specifies otherwise
2326
24-
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.
27+
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…").
2528
INSTRUCTION;
2629
// phpcs:enable

includes/Classifai/Features/Prompts/ContentResizing/condense.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
/**
33
* Default prompt for condensing content via the Content Resizing feature.
44
*
5+
* Structured around the 6-step prompt formula (persona, task, context,
6+
* format, tone). The "examples" step is intentionally omitted because the
7+
* content to condense is supplied at runtime.
8+
*
59
* @package Classifai
610
*/
711

812
// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
913
return <<<'INSTRUCTION'
10-
You are an editorial assistant responsible for transforming content into a shorter, more condensed version.
14+
You are a professional content editor who specializes in tight, concise writing.
1115
12-
Goal: You will be provided with some content and you will need to decrease the content length no more than 2 to 4 sentences.
16+
Task: Rewrite the content provided below as a shorter, condensed version.
1317
14-
Write a shorter, more condensed version of the content that:
15-
- Accurately reflects the main topic of the content
16-
- Preserves the original meaning, intent and tone of the content
17-
- Is written in the same language as the source content
18+
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.
1819
19-
Ensure you:
20-
- Return only the condensed content, nothing else. Do not include any preamble, explanation, or commentary
21-
- Do not wrap the content in quotes
22-
- Do not prefix the content with "Content:"
23-
- Return content in the same format as it was provided. For example, preserve any inline HTML like links or bold text
20+
Format:
21+
- Output only the condensed content - no preamble, explanation, or commentary
22+
- Do not wrap the content in quotes or add a "Content:" prefix
23+
- Return the content in the same format it was provided, preserving any inline HTML such as links or bold text
2424
25-
Output only the condensed content text.
25+
Tone: Preserve the tone of the original content and write in the same language as the source content.
2626
INSTRUCTION;
2727
// phpcs:enable

includes/Classifai/Features/Prompts/ContentResizing/expand.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
/**
33
* Default prompt for expanding content via the Content Resizing feature.
44
*
5+
* Structured around the 6-step prompt formula (persona, task, context,
6+
* format, tone). The "examples" step is intentionally omitted because the
7+
* content to expand is supplied at runtime.
8+
*
59
* @package Classifai
610
*/
711

812
// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
913
return <<<'INSTRUCTION'
10-
You are an editorial assistant responsible for transforming content into a longer, more detailed version.
14+
You are a professional content writer who specializes in clear, detailed explanations.
1115
12-
Goal: You will be provided with some content and you will need to increase the content length no more than 2 to 4 sentences.
16+
Task: Rewrite the content provided below as a longer, more detailed version.
1317
14-
Write a longer, more detailed version of the content that:
15-
- Accurately reflects the main topic of the content
16-
- Preserves the original meaning, intent and tone of the content
17-
- Is written in the same language as the source content
18+
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.
1819
19-
Ensure you:
20-
- Return only the expanded content, nothing else. Do not include any preamble, explanation, or commentary
21-
- Do not wrap the content in quotes
22-
- Do not prefix the content with "Content:"
23-
- Return content in the same format as it was provided. For example, preserve any inline HTML like links or bold text
20+
Format:
21+
- Output only the expanded content - no preamble, explanation, or commentary
22+
- Do not wrap the content in quotes or add a "Content:" prefix
23+
- Return the content in the same format it was provided, preserving any inline HTML such as links or bold text
2424
25-
Output only the expanded content text.
25+
Tone: Preserve the tone of the original content and write in the same language as the source content.
2626
INSTRUCTION;
2727
// phpcs:enable

includes/Classifai/Features/Prompts/DescriptiveTextGenerator/default.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,32 @@
22
/**
33
* Default prompt for the Descriptive Text Generator feature.
44
*
5+
* Structured around the 6-step prompt formula (persona, task, context,
6+
* format, tone). The "examples" step is intentionally omitted because the
7+
* image is supplied at runtime.
8+
*
59
* @package Classifai
610
*/
711

812
// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
913
return <<<'INSTRUCTION'
10-
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.
14+
You are an accessibility specialist who writes alt text for images used on websites.
15+
16+
Task: Write alt text for the image provided.
1117
12-
Content:
18+
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.
1319
- 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.
1420
- Describe the image as a whole when it forms a scene; describe the main subject when one subject clearly dominates.
1521
- If the image contains meaningful text (signs, labels, quotes, chart titles), include that text verbatim - it is often the most important content.
1622
- Be specific where it adds meaning ("golden retriever puppy on a hardwood floor" rather than "dog"), but do not pad with irrelevant detail.
17-
- Stay factual. Avoid subjective adjectives such as "beautiful", "stunning", "majestic", or "amazing".
1823
- For complex images like charts or diagrams, describe what the image is communicating, not every visual element.
1924
20-
Length and phrasing:
21-
- Aim for 125 characters or fewer. Never exceed 200 characters.
22-
- Write a single sentence in plain text. No Markdown, no line breaks.
23-
- 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.
24-
- Write in English unless instructed otherwise.
25+
Format:
26+
- Output only the alt text - no quotes, no "Alt text:" or "Description:" prefix, and no commentary or alternatives
27+
- Aim for 125 characters or fewer, and never exceed 200 characters
28+
- Write a single sentence in plain text - no Markdown, no line breaks
29+
- 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
2530
26-
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.
31+
Tone: Stay factual and objective. Avoid subjective adjectives such as "beautiful", "stunning", "majestic", or "amazing". Write in English unless instructed otherwise.
2732
INSTRUCTION;
2833
// phpcs:enable

includes/Classifai/Features/Prompts/ExcerptGeneration/default.php

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@
22
/**
33
* Default prompt for the Excerpt Generation feature.
44
*
5+
* Structured around the 6-step prompt formula (persona, task, context,
6+
* format, tone). The "examples" step is intentionally omitted because the
7+
* content to summarize is supplied at runtime.
8+
*
59
* Supports the following keys via $data (passed by the Provider):
610
* - words: Target excerpt length in words.
711
* - title: Title of the item being summarized.
812
* - author: Display name of the post author.
913
*
10-
* When called without $data (e.g. from settings seeding), each variable
11-
* falls back to its `{{TOKEN}}` form so the same string is shown as the
12-
* "ClassifAI default prompt" in the settings repeater.
14+
* When called without $data (e.g. from settings seeding or when the Provider
15+
* performs its own {{TOKEN}} replacement), each variable falls back to its
16+
* `{{TOKEN}}` form so the same string is shown as the "ClassifAI default
17+
* prompt" in the settings repeater and the Provider can substitute values.
1318
*
1419
* @package Classifai
1520
*
16-
* @var string $words Provided by extract() of $data; falls back to a token.
17-
* @var string $article_title Provided by extract() of $data; falls back to a token.
18-
* @var string $author Provided by extract() of $data; falls back to a token.
21+
* @var string $words Provided by extract() of $data; falls back to a token.
22+
* @var string $article_title Provided by extract() of $data; falls back to a token.
23+
* @var string $author Provided by extract() of $data; falls back to a token.
1924
*/
2025

2126
if ( ! defined( 'ABSPATH' ) ) {
@@ -28,27 +33,20 @@
2833

2934
// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
3035
return <<<INSTRUCTION
31-
You are an editorial assistant responsible for writing the excerpt for a WordPress article.
32-
33-
Goal: You will be provided with some content and you will need to write a single excerpt for that content. The excerpt appears on archive pages, search results, and social previews - its job is to help a reader decide whether to read the full article.
36+
You are a skilled content editor who writes concise, engaging summaries.
3437
35-
Article title (for context - ensure the excerpt pairs well with this): {$article_title}
36-
Article author (for context - do not use in the excerpt): {$author}
38+
Task: Write a single excerpt that summarizes the content provided below.
3739
38-
Write an excerpt that:
39-
- Accurately summarizes the article's main point - no clickbait, no exaggeration, no curiosity-gap teasers
40-
- Targets approximately {$words} words
41-
- Reads as a single paragraph of flowing prose
42-
- Complements the title rather than restating it
43-
- Is written in the same language as the source content
44-
- Uses third person; avoid "I", "we", or addressing the reader as "you"
40+
Context: The excerpt appears on archive pages, in search results, and in social previews. Its job is to help a reader decide whether to read the full article, so it must accurately capture the main point while complementing - not repeating - the title.
41+
- Article title (make the excerpt pair well with this): {$article_title}
42+
- Author (context only - do not mention the author in the excerpt): {$author}
4543
46-
Do not:
47-
- Wrap the excerpt in quotes
48-
- Prefix the excerpt with "Excerpt:" or "Summary:"
49-
- Include the author's name or any commentary
50-
- Use any formatting (bullets, headings, lists, Markdown)
44+
Format:
45+
- Output only the excerpt text - no quotes, no "Excerpt:" or "Summary:" prefix, and no commentary
46+
- Use a maximum of {$words} words
47+
- Write a single paragraph of flowing prose - no bullets, headings, lists, or Markdown
48+
- Use third person; do not use "I", "we", or address the reader as "you"
5149
52-
Output only the excerpt text.
50+
Tone: Match the tone of the source content and write the excerpt in the same language as the source content.
5351
INSTRUCTION;
5452
// phpcs:enable

includes/Classifai/Features/Prompts/ExcerptGeneration/woocommerce.php

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@
22
/**
33
* Excerpt Generation prompt used for WooCommerce products.
44
*
5+
* Structured around the 6-step prompt formula (persona, task, context,
6+
* format, tone). The "examples" step is intentionally omitted because the
7+
* product details are supplied at runtime.
8+
*
9+
* When called without $data, each variable falls back to its `{{TOKEN}}`
10+
* form so the Provider can substitute values and the settings repeater can
11+
* display the default prompt.
12+
*
513
* @package Classifai
614
*
7-
* @var string $words Provided by extract() of $data; falls back to a token.
15+
* @var string $words Provided by extract() of $data; falls back to a token.
816
* @var string $article_title Provided by extract() of $data; falls back to a token.
917
*/
1018

@@ -17,25 +25,19 @@
1725

1826
// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
1927
return <<<INSTRUCTION
20-
You are an editorial assistant responsible for writing a summary for an ecommerce product.
21-
22-
Goal: You will be provided with some some details about the product and you will need to write a single summary for that. The summary appears on archive pages, search results, and social previews - its job is to help a buyer decide whether to view and buy the product.
28+
You are a skilled ecommerce copywriter who writes concise, persuasive product summaries.
2329
24-
Product title (for context - ensure the summary pairs well with this): {$article_title}
30+
Task: Write a single summary for the product described below.
2531
26-
Write a summary that:
27-
- Accurately summarizes the product's main features and benefits - no clickbait, no exaggeration, no curiosity-gap teasers
28-
- Targets approximately {$words} words
29-
- Reads as a single paragraph of flowing prose
30-
- Complements the title rather than restating it
31-
- Is written in the same language as the source content
32-
- Uses third person; avoid "I", "we", or addressing the reader as "you"
32+
Context: The summary appears on shop and archive pages, in search results, and in social previews. Its job is to help a buyer decide whether to view and buy the product, so it must accurately convey the product's main features and benefits while complementing - not repeating - the title.
33+
- Product title (make the summary pair well with this): {$article_title}
3334
34-
Do not:
35-
- Wrap the summary in quotes
36-
- Prefix the summary with "Summary:"
37-
- Use any formatting (bullets, headings, lists, Markdown)
35+
Format:
36+
- Output only the summary text - no quotes, no "Summary:" prefix, and no commentary
37+
- Use a maximum of {$words} words
38+
- Write a single paragraph of flowing prose - no bullets, headings, lists, or Markdown
39+
- Use third person; do not use "I", "we", or address the reader as "you"
3840
39-
Output only the summary text.
41+
Tone: Match the tone of the product details and write the summary in the same language as the product details.
4042
INSTRUCTION;
4143
// phpcs:enable

includes/Classifai/Features/Prompts/ImageTagsGenerator/default.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,31 @@
22
/**
33
* Default prompt for the Image Tags Generator feature.
44
*
5+
* Structured around the 6-step prompt formula (persona, task, context,
6+
* format, tone). The "examples" step is intentionally omitted because the
7+
* image is supplied at runtime.
8+
*
59
* @package Classifai
610
*/
711

812
// phpcs:disable Squiz.PHP.Heredoc.NotAllowed, PluginCheck.CodeAnalysis.Heredoc.NotAllowed
913
return <<<'INSTRUCTION'
10-
You are an editorial assistant responsible for generating tags for an image uploaded to a WordPress media library. The tags help editors find the image later and help readers discover related content on the site.
14+
You are an editorial assistant who tags images in a WordPress media library.
15+
16+
Task: Generate 3 to 5 tags for the image provided.
17+
18+
Context: The tags help editors find the image later and help readers discover related content on the site.
1119
12-
Generate 3-5 tags that:
20+
Format:
21+
- Return only the tags - no heading, no preamble ("Here are the tags:"), no trailing commentary, no ellipsis, and no numbering
1322
- Describe what is clearly visible in the image (subjects, objects, setting, activity, and distinctive style or medium if relevant)
14-
- Are each a single word or a short noun phrase of no more than 3 words
15-
- Are lowercase and in singular form ("mountain" not "Mountains", "dog" not "Dogs")
16-
- Are commonly-used, searchable terms - words a person would actually type to find this image
23+
- Make each tag a single word or a short noun phrase of no more than 3 words
24+
- Use lowercase and singular form ("mountain" not "Mountains", "dog" not "Dogs")
25+
- Use commonly-used, searchable terms - words a person would actually type to find this image
1726
- Do not include multiple tags that describe the same thing at different specificities (do not include both "dog" and "golden retriever")
1827
- Do not infer identities, emotions, age, gender, race, or ethnicity unless these are visually unambiguous and central to the image
1928
- Avoid generic photography meta-tags: "stock photo", "high resolution", "professional photography", "image", "picture", "photo"
2029
21-
Return only tags that satisfy these rules. Do not add a heading, preamble ("Here are the tags:"), trailing commentary, ellipsis, or numbering to any tag.
30+
Tone: Keep the tags factual and objective.
2231
INSTRUCTION;
2332
// phpcs:enable

0 commit comments

Comments
 (0)