Skip to content

Commit 99c56ed

Browse files
authored
Merge pull request #14 from thibaultyou/feature/10-enhance-prompt-categorization
Enhance AI Prompt Analyzer and Update Automation Scripts
2 parents 3a649cf + f155ddf commit 99c56ed

File tree

31 files changed

+441
-202
lines changed

31 files changed

+441
-202
lines changed

.github/prompts/ai_prompt_analyzer_and_output_generator/prompt.md

Lines changed: 57 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,49 @@
11
You are an AI assistant tasked with analyzing an AI prompt and producing specific outputs related to it. The prompt will be provided to you, and you should generate the following:
22

33
1. A directory name for storing the prompt
4-
2. A category in snake_case format
5-
3. A list of tags
6-
4. A one-line concise description
7-
5. A quick description
8-
6. A markdown link for referencing the prompt
9-
7. A list of variables that require user input
4+
2. A primary category from the predefined list
5+
3. Optional subcategories (up to 2)
6+
4. A list of tags
7+
5. A one-line concise description
8+
6. A quick description
9+
7. A markdown link for referencing the prompt
10+
8. A list of variables that require user input
11+
12+
Here's the list of predefined top-level categories:
13+
14+
TOP_LEVEL_CATEGORIES = [
15+
"api_development",
16+
"artificial_intelligence",
17+
"backend_development",
18+
"cloud_computing",
19+
"code_analysis_and_review",
20+
"code_generation_and_optimization",
21+
"containerization_and_orchestration",
22+
"data_management_and_analytics",
23+
"database_design",
24+
"debugging_and_error_handling",
25+
"design_patterns",
26+
"devops",
27+
"documentation",
28+
"frontend_development",
29+
"full_stack_development",
30+
"ide_and_development_tools",
31+
"machine_learning",
32+
"mobile_development",
33+
"network_programming",
34+
"performance_tuning",
35+
"project_management",
36+
"prompt_engineering",
37+
"refactoring",
38+
"scalability_and_system_design",
39+
"security",
40+
"software_architecture",
41+
"testing_and_quality_assurance",
42+
"user_experience_design",
43+
"version_control",
44+
"web_development",
45+
"workflow_automation"
46+
]
1047

1148
Here's the AI prompt you need to analyze:
1249

@@ -24,10 +61,13 @@ Generate a directory name for the prompt using the following convention:
2461
- Remove any special characters
2562
- The directory name should be concise but descriptive, ideally not exceeding 50 characters
2663

27-
2. Category:
28-
Determine a simple and clear category for the prompt, formatted in snake_case.
64+
2. Primary Category:
65+
Select the most appropriate primary category from the predefined list of top-level categories, formatted in snake_case.
2966

30-
3. Tags:
67+
3. Subcategories:
68+
Determine up to two subcategories that further specify the prompt's focus. These should be more specific than the primary category and can be custom-created, formatted in snake_case.
69+
70+
4. Tags:
3171
Create a list of 3-5 relevant tags for the prompt. These tags should:
3272

3373
- Be single words or short phrases
@@ -36,36 +76,39 @@ Create a list of 3-5 relevant tags for the prompt. These tags should:
3676
- Accurately represent the main themes or applications of the prompt
3777
- Be useful for categorizing and searching for the prompt
3878

39-
4. One-line description:
79+
5. One-line description:
4080
Write a concise, one-line description of the prompt that:
4181

4282
- Captures the main purpose or function of the prompt
4383
- Is no longer than 100 characters
4484
- Starts with a verb in the present tense (e.g., "Creates," "Generates," "Analyzes")
4585

46-
5. Quick description:
86+
6. Quick description:
4787
Provide a brief description of the prompt that:
4888

4989
- Expands on the one-line description
5090
- Explains the key features or capabilities of the prompt
5191
- Is 2-3 sentences long
5292
- Gives the reader a clear understanding of what the prompt does
5393

54-
6. Markdown link:
94+
7. Markdown link:
5595
Create a markdown link that can be used to reference the prompt:
5696

5797
- Use the one-line description as the link text
5898
- Use the directory name as the link URL
5999
- Format it as: [One-line description](directory_name)
60100

61-
7. User input variables:
101+
8. User input variables:
62102
List all variables in the prompt that require user input or replacement. These should be in the format {{VARIABLE_NAME}} and listed one per line.
63103

64104
Present your final output in the following format:
65105

66106
<output>
67107
title: [Prompt's main topic or purpose]
68-
category: [Your determined category in snake_case]
108+
primary_category: [Your selected primary category]
109+
subcategories:
110+
- [Subcategory 1]
111+
- [Subcategory 2]
69112
directory: [Your generated directory name]
70113
tags:
71114
- [Tag 1]

.github/scripts/generate_metadata.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def generate_metadata(prompt_content):
4343
logger.info("Sending request to Anthropic API")
4444
message = client.messages.create(
4545
model="claude-3-5-sonnet-20240620",
46-
max_tokens=1000,
46+
max_tokens=2500,
4747
messages=[
4848
{
4949
"role": "user",
@@ -76,7 +76,13 @@ def generate_metadata(prompt_content):
7676
return metadata
7777

7878
def should_update_metadata(prompt_file, metadata_file):
79-
"""Check if metadata should be updated based on content hash."""
79+
"""Check if metadata should be updated based on content hash or force flag."""
80+
force_regenerate = os.environ.get('FORCE_REGENERATE', 'false').lower() == 'true'
81+
82+
if force_regenerate:
83+
logger.info("Forcing metadata regeneration due to system prompt changes.")
84+
return True, None
85+
8086
# Generate hash of the prompt file content
8187
with open(prompt_file, 'rb') as f:
8288
prompt_content = f.read()
@@ -200,7 +206,7 @@ def update_prompt_metadata():
200206
shutil.rmtree(item_path)
201207
else:
202208
os.rename(item_path, new_dir_path)
203-
item_path = new_dir_path # Update item_path for the new location
209+
item_path = new_dir_path
204210

205211
# Save updated metadata
206212
metadata_path = os.path.join(item_path, 'metadata.yml')

.github/scripts/update_views.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,27 @@ def update_views():
6666
logger.info(f"Wrote view content to {view_path}")
6767

6868
# Organize prompts by category for the README
69-
category = format_category(metadata.get('category', 'Uncategorized'))
70-
if category not in categories:
71-
categories[category] = []
69+
primary_category = metadata.get('primary_category', 'uncategorized')
70+
if primary_category not in categories:
71+
categories[primary_category] = []
7272

73-
categories[category].append({
73+
categories[primary_category].append({
7474
'title': metadata.get('title', 'Untitled'),
7575
'description': metadata.get('one_line_description', 'No description'),
76-
'path': f'prompts/{prompt_dir}/view.md'
76+
'path': f'prompts/{prompt_dir}/view.md',
77+
'subcategories': metadata.get('subcategories', [])
7778
})
78-
logger.info(f"Added prompt to category: {category}")
79+
logger.info(f"Added prompt to category: {primary_category}")
80+
81+
# Remove empty categories
82+
categories = {k: v for k, v in categories.items() if v}
7983

8084
# Sort categories alphabetically
8185
sorted_categories = dict(sorted(categories.items()))
8286

8387
# Generate README content using the template and write to file
8488
logger.info("Generating README content")
85-
readme_content = readme_template.render(categories=sorted_categories)
89+
readme_content = readme_template.render(categories=sorted_categories, format_category=format_category)
8690
readme_path = 'README.md'
8791
with open(readme_path, 'w') as f:
8892
f.write(readme_content)

.github/templates/readme_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Welcome to the **Prompt Library**. This repository contains a collection of AI p
66

77
{% for category, prompts in categories.items() %}
88

9-
### {{ category }}
9+
### {{ format_category(category) }}
1010

1111
{% for prompt in prompts %}
1212

.github/templates/view_template.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,15 @@
2727

2828
- {{ tag }}
2929
{% endfor %}
30+
31+
### 📚 Category
32+
33+
Primary Category: {{ metadata.primary_category }}
34+
35+
{% if metadata.subcategories %}
36+
Subcategories:
37+
{% for subcategory in metadata.subcategories %}
38+
39+
- {{ subcategory }}
40+
{% endfor %}
41+
{% endif %}

.github/workflows/update_views.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,39 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 2
19+
1720
- name: Set up Python
1821
uses: actions/setup-python@v5
1922
with:
2023
python-version: "3.12.6"
2124
cache: "pip"
2225
cache-dependency-path: ".github/scripts/requirements.txt"
26+
2327
- name: Install dependencies
2428
run: |
2529
python -m pip install --upgrade pip
2630
pip install -r .github/scripts/requirements.txt
31+
32+
- name: Check for system prompt changes
33+
id: check_changes
34+
run: |
35+
if git diff --name-only HEAD^ HEAD | grep -q ".github/prompts/ai_prompt_analyzer_and_output_generator/"; then
36+
echo "FORCE_REGENERATE=true" >> $GITHUB_ENV
37+
else
38+
echo "FORCE_REGENERATE=false" >> $GITHUB_ENV
39+
fi
40+
2741
- name: Generate metadata
2842
env:
2943
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
44+
FORCE_REGENERATE: ${{ env.FORCE_REGENERATE }}
3045
run: python .github/scripts/generate_metadata.py
46+
3147
- name: Update views
3248
run: python .github/scripts/update_views.py
49+
3350
- name: Commit changes
3451
run: |
3552
git config --local user.name "github-actions[bot]"

README.md

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,71 +6,65 @@ Welcome to the **Prompt Library**. This repository contains a collection of AI p
66

77

88

9-
### Code Documentation
9+
### Artificial Intelligence
1010

1111

1212

13-
- [AI Code Repository Documentation Generator](prompts/ai_code_repository_documentation_generator/view.md) - Analyzes code repositories and generates comprehensive documentation autonomously
14-
13+
- [God Tier Assistant Generator](prompts/god_tier_assistant_generator/view.md) - Generates innovative ideas for specialized AI assistants based on given topics
1514

1615

16+
- [AI Application Idea Generator](prompts/ai_application_idea_generator/view.md) - Generates diverse and innovative AI application ideas for specific domains
1717

18-
### Code Improvement
1918

2019

2120

22-
- [Code Refactoring AI Assistant](prompts/code_refactoring_ai_assistant/view.md) - Analyzes, refactors, and tests code to improve quality, readability, and performance
21+
### Documentation
2322

2423

2524

25+
- [AI Code Documentation Generator](prompts/ai_code_documentation_generator/view.md) - Analyzes code repositories and generates comprehensive documentation
2626

27-
### Idea Generation
2827

2928

3029

31-
- [God Tier Assistant Generator](prompts/god_tier_assistant_generator/view.md) - Generates innovative ideas for specialized AI assistants based on given topics
30+
### Full Stack Development
3231

3332

34-
- [AI Topic Idea Generator](prompts/ai_topic_idea_generator/view.md) - Generates innovative AI application ideas for specific domains and constraints
3533

34+
- [Advanced AI Software Development Assistant](prompts/advanced_ai_software_development_assistant/view.md) - Provides comprehensive guidance and support throughout the software development lifecycle
3635

3736

3837

39-
### Issue Management
4038

41-
42-
43-
- [GitHub Issue Creator](prompts/github_issue_creator_from_user_input/view.md) - Creates well-structured GitHub Issues from user input and project context
39+
### Project Management
4440

4541

4642

43+
- [Software Specification Generator](prompts/software_specification_generator/view.md) - Generates comprehensive software specifications based on user requirements
4744

48-
### Product Management
4945

50-
51-
52-
- [Software Specification Generator](prompts/software_specification_generator/view.md) - Creates comprehensive software specifications based on user requirements and interactive review
46+
- [GitHub Issue Creator](prompts/github_issue_creator_from_user_input/view.md) - Creates well-structured GitHub Issues from user input and project context
5347

5448

5549

5650

57-
### Software Development
51+
### Refactoring
5852

5953

6054

61-
- [AI Software Development Assistant](prompts/ai_software_development_assistant/view.md) - Provides expert guidance and support throughout the software development lifecycle
55+
- [Code Refactoring AI Assistant](prompts/code_refactoring_ai_assistant/view.md) - Analyzes, refactors, and tests code to improve quality, readability, and performance
6256

6357

64-
- [GitHub Pull Request Generator](prompts/github_pull_request_generator/view.md) - Generates comprehensive and well-structured GitHub pull requests based on change details and project context
6558

6659

60+
### Version Control
6761

6862

69-
### Version Control
7063

64+
- [Git Commit Message Writer](prompts/git_commit_message_writer/view.md) - Generates concise, informative git commit messages following Conventional Commits with emojis
7165

7266

73-
- [Git Commit Message Writer](prompts/git_commit_message_writer/view.md) - Generates concise, informative git commit messages with emojis following Conventional Commits
67+
- [GitHub Pull Request Generator](prompts/github_pull_request_generator/view.md) - Generates comprehensive and well-structured GitHub pull requests
7468

7569

7670

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
title: Advanced AI Software Development Assistant
2+
primary_category: full_stack_development
3+
subcategories:
4+
- software_lifecycle_management
5+
- development_workflow_optimization
6+
directory: advanced_ai_software_development_assistant
7+
tags:
8+
- software_development
9+
- code_generation
10+
- best_practices
11+
- debugging
12+
- documentation
13+
one_line_description: Provides comprehensive guidance and support throughout the software
14+
development lifecycle
15+
description: This AI assistant offers expert guidance, code suggestions, and workflow
16+
optimization for software developers across the entire development lifecycle. It
17+
covers various aspects including coding, debugging, documentation, and best practices
18+
in multiple programming languages and frameworks.
19+
variables:
20+
- '{{USER_REQUEST}}'
21+
- '{{CONTEXT}}'
22+
content_hash: None
File renamed without changes.

0 commit comments

Comments
 (0)