Skip to content

chore(core): improve element description prompt with language-specific examples#2067

Merged
quanru merged 1 commit intomainfrom
claude/check-aidescribe-prompt-fxRNQ
Mar 4, 2026
Merged

chore(core): improve element description prompt with language-specific examples#2067
quanru merged 1 commit intomainfrom
claude/check-aidescribe-prompt-fxRNQ

Conversation

@ottomao
Copy link
Collaborator

@ottomao ottomao commented Mar 4, 2026

Summary

Enhanced the element describer instruction prompt to provide language-specific examples and clearer emphasis on the required output language. This improves the AI model's ability to generate descriptions in the user's preferred language.

Key Changes

  • Added examplesMap with localized example descriptions for Chinese and English languages
  • Created getExamples() helper function to format language-specific examples
  • Restructured the prompt to explicitly emphasize language requirements with "IMPORTANT" and bold formatting
  • Updated examples section to dynamically use language-appropriate examples instead of hardcoded English-only examples
  • Enhanced clarity by separating the language instruction into its own paragraph

Implementation Details

  • The examplesMap provides 5 realistic examples for each supported language (Chinese and English)
  • Examples are formatted with markdown list syntax (- ) for better readability
  • Falls back to English examples if the preferred language is not in the map
  • The prompt now repeats the language requirement in multiple places (opening statement, IMPORTANT section, and guidelines) to reinforce the instruction to the AI model
  • Updated snapshot test reflects the new prompt structure

https://claude.ai/code/session_01A2hhpJ74in5M6cL2Qj2HrR

The previous prompt had "Use ${language}." appended to the first sentence,
which was ambiguous and easily overridden by the all-English few-shot
examples. This change:

- Separates the language instruction into a standalone "IMPORTANT" directive
- Adds a redundant reminder in the GUIDELINES section
- Provides Chinese examples when preferredLanguage is Chinese, so the
  few-shot signal aligns with the language instruction

https://claude.ai/code/session_01A2hhpJ74in5M6cL2Qj2HrR
@quanru quanru merged commit 7286b57 into main Mar 4, 2026
9 checks passed
@quanru quanru deleted the claude/check-aidescribe-prompt-fxRNQ branch March 4, 2026 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants