Skip to content

refactor: extract prompts.py into subpackage with .md templates#11

Open
shenxiangzhuang wants to merge 4 commits intozjunlp:mainfrom
shenxiangzhuang:refactor/prompts-subpackage
Open

refactor: extract prompts.py into subpackage with .md templates#11
shenxiangzhuang wants to merge 4 commits intozjunlp:mainfrom
shenxiangzhuang:refactor/prompts-subpackage

Conversation

@shenxiangzhuang
Copy link

@shenxiangzhuang shenxiangzhuang commented Mar 18, 2026

This is more like a suggestion/proposal(and feel free to close it without merge) to use markdown to orgnize the prompt files. Markdown files are more readable in genreal. But, as the comment says, this may also introduce some render issues.

What

Replace the monolithic prompts.py (892 lines) with a prompts/ subpackage:

  • 10 long prompts moved to individual .md files under prompts/templates/
  • 3 short prompts kept inline in __init__.py
  • All variable names re-exported — external imports unchanged

Why

Easier to read, review, and edit prompt content in standalone Markdown files instead of one large Python file.

Commits

Commit Description
285e76b Main refactor with snapshot tests verifying byte-for-byte equality
863f988 Clean up comments, remove test files, revert pytest dev dep
f9e62ac Strip leading blank lines from .md templates
c1ae28f Add package-data config so .md files are included in distribution

Note

Checkout the first commit (285e76b) to verify the refactor has zero impact on prompt values — it includes 28 snapshot tests comparing every prompt character-by-character against the original file. Subsequent commits are minor cleanups (removing test scaffolding, trimming leading blank lines).

- Replace monolithic prompts.py with prompts/ subpackage
- Move 10 long prompts (>3 lines) to individual .md files under templates/
- Keep 3 short prompts inline in __init__.py
- Re-export all variable names so external imports remain unchanged
- Add snapshot tests (28 cases) verifying byte-for-byte prompt equality
- Add pytest as dev dependency
Comment on lines +35 to +42
# Output Format:
[
{{
"name": "example-skill-name",
"description": "Comprehensive trigger description explaining precisely WHEN and WHY to load this skill."
}},
...
]
Copy link
Author

@shenxiangzhuang shenxiangzhuang Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take this block for example, the markdown render result is worser than the python string. So if we want to use markdown as the prompt file, some modifications to adress these format issues should be done firstly.

Image

@LiamLYYY
Copy link
Collaborator

Thanks for the PR! We'll take a look soon.

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.

2 participants