diff --git a/.github/workflows/update_views.yml b/.github/workflows/update_views.yml index 77a12e1..93593ce 100644 --- a/.github/workflows/update_views.yml +++ b/.github/workflows/update_views.yml @@ -7,11 +7,11 @@ on: - "prompts/**/*.md" - "prompts/prompt.md" - "src/**/*.ts" - - "system_prompts/**/*.md" - - "templates/*.md" + - "src/system_prompts/**/*.md" + - "src/templates/*.md" jobs: - update_views: + update_views:v runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -20,7 +20,7 @@ jobs: - name: Validate critical files run: | - if [ ! -f "system_prompts/ai_prompt_analyzer_and_output_generator/prompt.md" ]; then + if [ ! -f "src/system_prompts/prompt_analysis_agent/prompt.md" ]; then echo "Error: AI prompt analyzer file is missing" exit 1 fi @@ -58,7 +58,7 @@ jobs: - name: Check for system prompt changes id: check_changes run: | - if git diff --name-only HEAD^ HEAD | grep -q ".github/prompts/ai_prompt_analyzer_and_output_generator/"; then + if git diff --name-only HEAD^ HEAD | grep -q "src/system_prompts/prompt_analysis_agent/"; then echo "FORCE_REGENERATE=true" >> $GITHUB_ENV else echo "FORCE_REGENERATE=false" >> $GITHUB_ENV diff --git a/.gitignore b/.gitignore index cfbfa63..3b3e8a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ +# Ignore environment config .env + +# Ignore specific directories +dist/ node_modules/ -dist/ \ No newline at end of file +archive/ + +# Ignore local temporary files +z_diff_output.txt +z_dir2prompt_output.txt \ No newline at end of file diff --git a/.promptignore b/.promptignore new file mode 100644 index 0000000..22d865e --- /dev/null +++ b/.promptignore @@ -0,0 +1,23 @@ +# Ignore all README.md files in subdirectories +**/README.md + +# Include the main README.md in the root directory +!/README.md + +# Include the .github directory (e.g., for workflows) +!.github/ + +# Ignore environment config and lock file +.env +package-lock.json + +# Ignore specific directories +dist/ +node_modules/ +archive/ +fragments/ +prompts/ + +# Ignore local temporary files +z_diff_output.txt +z_dir2prompt_output.txt \ No newline at end of file diff --git a/README.md b/README.md index 0361a27..fbd4657 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,47 @@ # 📚 Prompt Library +> ### 🚧 **Project Under Active Development** 🚧 +> +> **Note:** This project is new and undergoing rapid development. You may encounter bugs or frequent changes. We appreciate your patience and encourage you to: +> - Report any issues you encounter +> - Check for updates regularly +> - Contribute ideas or improvements +> +> Your feedback is valuable in shaping this project. Thank you for your interest and support! + Welcome to the **Prompt Library**. This repository contains a collection of AI prompts categorized for easy navigation and reuse. ## 🗂️ Categories ### Artificial Intelligence And Machine Learning -- [AI Concept Generator for Specialized Assistants](prompts/ai_concept_generator_specialized_assistants/view.md) - Generates innovative and feasible AI assistant concepts for specific topics +- [AI Concept Creator](prompts/ai_concept_agent/README.md) - Generates innovative and feasible AI assistant concepts for specific topics ### Code Quality And Best Practices -- [Divine Code Refactoring Expert](prompts/divine_code_refactoring_expert/view.md) - Analyzes, refactors, and validates code to enhance quality, readability, and performance -- [Software Development Pull Request Generator](prompts/software_development_pull_request_generator/view.md) - Generates comprehensive pull requests for software development projects +- [Divine Code Refactoring Agent](prompts/code_refactoring_agent/README.md) - Analyzes, refactors, and validates code to improve quality, readability, and performance ### Documentation -- [Software Specification Creator](prompts/software_specification_creator/view.md) - Creates detailed software specification documents through interactive requirement gathering +- [Software Specification Creator](prompts/software_spec_agent/README.md) - Generates detailed software specification documents through interactive requirement analysis ### Project Management -- [GitHub Issue Creation Expert](prompts/github_issue_creation_expert/view.md) - Creates optimized GitHub issues considering code context, project history, and team dynamics +- [GitHub Issue Creation Expert](prompts/github_issue_agent/README.md) - Creates comprehensive, optimized GitHub issues based on context and team dynamics ### Prompt Engineering -- [Prompt Engineering God](prompts/prompt_engineering_god/view.md) - Crafts divine-tier prompts for optimal AI performance across various domains +- [Prompt Engineering God](prompts/prompt_engineering_agent/README.md) - Creates and refines optimized prompts for AI models across various domains + +### Software Testing + +- [Elite AI Coding Assistant](prompts/coding_assistant_agent/README.md) - Assists in software development tasks across multiple programming languages and paradigms ### Version Control -- [Git Branch Name Generator](prompts/git_branch_name_generator/view.md) - Generates optimal git branch names based on project context and requirements -- [Git Commit Message Generator](prompts/git_commit_message_generator/view.md) - Generates optimized git commit messages following Conventional Commits specification +- [Git Commit Message Generator](prompts/git_commit_message_agent/README.md) - Generates optimized git commit messages following Conventional Commits specification +- [Software Development Pull Request Generator](prompts/software_dev_pr_agent/README.md) - Generates comprehensive pull requests for software projects based on provided context +- [Git Branch Name Generator](prompts/git_branch_name_agent/README.md) - Generates optimal git branch names based on project context and development workflow ## 🚀 Getting Started @@ -47,36 +60,59 @@ This repository is designed to be easily forked and customized for your own use. - Navigate to "Secrets and variables" > "Actions". - Create a new repository secret named `ANTHROPIC_API_KEY` and paste your Anthropic API key as the value. -4. **Add Your Own Prompts**: +4. **Install Dependencies**: + - Ensure you have Node.js installed (version 22 or later recommended). + - Run `npm install` to install the project dependencies. + +5. **Add Your Own Prompts**: - Create a new file in the `prompts` directory named `prompt.md`. - Write your prompt content in this file. - Commit and push your changes to GitHub. -5. **Let GitHub Actions Work**: +6. **Let GitHub Actions Work**: - The GitHub Actions workflow will automatically generate metadata for your new prompt. - - It will create a new directory for your prompt, move the `prompt.md` file into it, and create `metadata.yml` and `view.md` files. - - The README will be automatically updated to include your new prompt. + - It will create a new directory for your prompt, move the `prompt.md` file into it, and create `metadata.yml` and `README.md` files. + - The main README will be automatically updated to include your new prompt. + +7. **Run Locally**: + - Use `npm run generate-metadata` to generate metadata for your prompts. + - Use `npm run update-views` to update the README files. -6. **Customize as Needed**: - - You can modify the templates in the `.github/templates` directory to change how prompts are displayed. - - Update the scripts in `.github/scripts` to alter the metadata generation or view update process. +8. **Customize as Needed**: + - Modify the templates in the `src/templates` directory to change how prompts are displayed. + - Update the scripts in `src/core` to alter the metadata generation or view update process. ## 🛠️ How It Works - When you add or update a `prompt.md` file in the `prompts` directory, GitHub Actions are triggered. -- The `generate_metadata.py` script uses the Anthropic API to analyze your prompt and generate metadata. -- The `update_views.py` script creates or updates the `view.md` files for each prompt and updates the main README. +- The `generate_metadata.ts` script uses the Anthropic API to analyze your prompt and generate metadata. +- The `update_views.ts` script creates or updates the `README.md` files for each prompt and updates the main README. - All changes are automatically committed back to the repository. ## 🔧 Customizing Metadata Extraction The system prompt used to extract metadata from your prompts can be customized. This prompt is located at: -``` -.github/prompts/ai_prompt_analyzer_and_output_generator/prompt.md -``` +[`src/system_prompts/prompt_analysis_agent/prompt.md`](src/system_prompts/prompt_analysis_agent/prompt.md) + +To customize the metadata extraction process: + +1. Open the `prompt.md` file in your preferred text editor. +2. Review the existing prompt structure, which includes sections like ``, ``, ``, ``, and ``. +3. Modify the content within these sections to adjust the behavior of the metadata extraction process. For example: + - Update the `` section to change how categories are assigned. + - Modify the `` section to alter the structure of the generated metadata. +4. Save your changes to the file. + +After modifying the prompt: + +- Run `npm run generate-metadata` locally to test your changes. +- Review the generated metadata files to ensure the output meets your expectations. +- If satisfied, commit and push your changes to trigger the GitHub Actions workflow. + +This customization allows you to tailor the metadata generation process to your specific needs or to extract additional information from your prompts. Remember that changes to this file will affect all future metadata generations, so test thoroughly before committing. -You can modify this file to change how metadata is extracted from your prompts. This allows you to tailor the metadata generation process to your specific needs or to extract additional information from your prompts. +> **Note**: The `generate_metadata.ts` script in `src/core/` uses this prompt file when interacting with the Anthropic API. If you make significant changes to the prompt structure, you may need to update the script as well. ## 📝 Contributing diff --git a/jest.config.js b/jest.config.js index 70ff87b..42168f0 100644 --- a/jest.config.js +++ b/jest.config.js @@ -4,7 +4,8 @@ module.exports = { testMatch: ['**/tests/**/*.test.ts'], moduleNameMapper: { '^@config(.*)$': '/src/config$1', - '^@types/(.*)$': '/src/types/$1', + '^@core/(.*)$': '/src/core/$1', + '^@types(.*)$': '/src/types$1', '^@utils/(.*)$': '/src/utils/$1' } }; diff --git a/package.json b/package.json index 05a3bb5..295709a 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,6 @@ "prompt-library", "ai-prompts", "metadata-generation", - "view-generation", "anthropic-api", "yaml-processing", "automation", diff --git a/prompts/ai_concept_generator_specialized_assistants/view.md b/prompts/ai_concept_agent/README.md similarity index 87% rename from prompts/ai_concept_generator_specialized_assistants/view.md rename to prompts/ai_concept_agent/README.md index a46da68..6f6639b 100644 --- a/prompts/ai_concept_generator_specialized_assistants/view.md +++ b/prompts/ai_concept_agent/README.md @@ -1,4 +1,4 @@ -# AI Concept Generator for Specialized Assistants +# AI Concept Creator ### ✏️ One-line Description @@ -6,7 +6,7 @@ ### 📄 Description -This prompt tasks an AI to create exceptional yet practical concepts for specialized AI assistants. It encourages creativity while ensuring feasibility, focusing on core competencies and transformative abilities within a given topic. +This prompt engineers a creative AI system that conceptualizes novel, yet practical AI assistants for given topics. It focuses on generating groundbreaking ideas while ensuring feasibility, ethical considerations, and maximum potential impact. ### 🔧 Variables @@ -55,8 +55,8 @@ Now, based on the topic {{TOPIC}}, generate a groundbreaking yet feasible AI ass ### 🔖 Tags -- ai_concepts -- creativity +- ai_ideation +- creative_thinking - innovation - specialized_assistants - prompt_engineering @@ -67,4 +67,4 @@ Primary Category: artificial_intelligence_and_machine_learning Subcategories: - concept_generation -- specialized_ai_assistants \ No newline at end of file +- specialized_assistants \ No newline at end of file diff --git a/prompts/ai_concept_agent/metadata.yml b/prompts/ai_concept_agent/metadata.yml new file mode 100644 index 0000000..3464f72 --- /dev/null +++ b/prompts/ai_concept_agent/metadata.yml @@ -0,0 +1,21 @@ +content_hash: 46fdf466b661c338e49f3d34c07c2bc1 +description: >- + This prompt engineers a creative AI system that conceptualizes novel, yet + practical AI assistants for given topics. It focuses on generating + groundbreaking ideas while ensuring feasibility, ethical considerations, and + maximum potential impact. +directory: ai_concept_agent +one_line_description: Generates innovative and feasible AI assistant concepts for specific topics +primary_category: artificial_intelligence_and_machine_learning +subcategories: + - concept_generation + - specialized_assistants +tags: + - ai_ideation + - creative_thinking + - innovation + - specialized_assistants + - prompt_engineering +title: AI Concept Creator +variables: + - '{{TOPIC}}' diff --git a/prompts/ai_concept_generator_specialized_assistants/prompt.md b/prompts/ai_concept_agent/prompt.md similarity index 100% rename from prompts/ai_concept_generator_specialized_assistants/prompt.md rename to prompts/ai_concept_agent/prompt.md diff --git a/prompts/ai_concept_generator_specialized_assistants/metadata.yml b/prompts/ai_concept_generator_specialized_assistants/metadata.yml deleted file mode 100644 index 1fd9163..0000000 --- a/prompts/ai_concept_generator_specialized_assistants/metadata.yml +++ /dev/null @@ -1,21 +0,0 @@ -title: AI Concept Generator for Specialized Assistants -primary_category: artificial_intelligence_and_machine_learning -subcategories: - - concept_generation - - specialized_ai_assistants -directory: ai_concept_generator_specialized_assistants -tags: - - ai_concepts - - creativity - - innovation - - specialized_assistants - - prompt_engineering -one_line_description: Generates innovative and feasible AI assistant concepts for specific topics -description: >- - This prompt tasks an AI to create exceptional yet practical concepts for - specialized AI assistants. It encourages creativity while ensuring - feasibility, focusing on core competencies and transformative abilities within - a given topic. -variables: - - '{{TOPIC}}' -content_hash: 46fdf466b661c338e49f3d34c07c2bc1 diff --git a/prompts/divine_code_refactoring_expert/view.md b/prompts/code_refactoring_agent/README.md similarity index 93% rename from prompts/divine_code_refactoring_expert/view.md rename to prompts/code_refactoring_agent/README.md index 418eb63..728fd33 100644 --- a/prompts/divine_code_refactoring_expert/view.md +++ b/prompts/code_refactoring_agent/README.md @@ -1,12 +1,12 @@ -# Divine Code Refactoring Expert +# Divine Code Refactoring Agent ### ✏️ One-line Description -**Analyzes, refactors, and validates code to enhance quality, readability, and performance** +**Analyzes, refactors, and validates code to improve quality, readability, and performance** ### 📄 Description -This prompt creates an AI expert that analyzes codebases, infers the programming language, and performs comprehensive refactoring. It optimizes code quality, readability, and performance while preserving core functionality, followed by testing and validation. +This prompt creates an AI agent that analyzes code, infers the programming language, and performs comprehensive refactoring. It optimizes code quality, readability, and performance while preserving core functionality, and includes testing and validation steps. ### 🔧 Variables @@ -126,8 +126,8 @@ Now, proceed with the refactoring task, ensuring you provide detailed explanatio ### 🔖 Tags -- code_analysis - refactoring +- code_analysis - optimization - language_inference - testing @@ -137,5 +137,5 @@ Now, proceed with the refactoring task, ensuring you provide detailed explanatio Primary Category: code_quality_and_best_practices Subcategories: -- refactoring -- performance_optimization \ No newline at end of file +- code_refactoring +- programming_languages \ No newline at end of file diff --git a/prompts/code_refactoring_agent/metadata.yml b/prompts/code_refactoring_agent/metadata.yml new file mode 100644 index 0000000..66b98bc --- /dev/null +++ b/prompts/code_refactoring_agent/metadata.yml @@ -0,0 +1,24 @@ +content_hash: 0a5d4183b3ff1952e48d7998acb1ac02 +description: >- + This prompt creates an AI agent that analyzes code, infers the programming + language, and performs comprehensive refactoring. It optimizes code quality, + readability, and performance while preserving core functionality, and includes + testing and validation steps. +directory: code_refactoring_agent +one_line_description: >- + Analyzes, refactors, and validates code to improve quality, readability, and + performance +primary_category: code_quality_and_best_practices +subcategories: + - code_refactoring + - programming_languages +tags: + - refactoring + - code_analysis + - optimization + - language_inference + - testing +title: Divine Code Refactoring Agent +variables: + - '{{REFACTOR_SCOPE}}' + - '{{CODEBASE}}' diff --git a/prompts/divine_code_refactoring_expert/prompt.md b/prompts/code_refactoring_agent/prompt.md similarity index 100% rename from prompts/divine_code_refactoring_expert/prompt.md rename to prompts/code_refactoring_agent/prompt.md diff --git a/prompts/elite_ai_coding_assistant/view.md b/prompts/coding_assistant_agent/README.md similarity index 89% rename from prompts/elite_ai_coding_assistant/view.md rename to prompts/coding_assistant_agent/README.md index 7649c91..f2fd43a 100644 --- a/prompts/elite_ai_coding_assistant/view.md +++ b/prompts/coding_assistant_agent/README.md @@ -2,19 +2,19 @@ ### ✏️ One-line Description -**Assists in all aspects of software development with expert guidance and best practices** +**Assists in software development tasks across multiple programming languages and paradigms** ### 📄 Description -This prompt creates an AI coding assistant with comprehensive knowledge across multiple programming languages and frameworks. It provides expert guidance in code writing, analysis, optimization, and debugging while incorporating advanced software engineering principles and best practices. +This prompt creates an AI coding assistant with extensive knowledge in various programming languages, frameworks, and software engineering practices. It provides guidance on code writing, analysis, optimization, and debugging while incorporating advanced software engineering principles. ### 🔧 Variables -- `{{USER_CODE}}` - `{{LANGUAGE}}` - `{{FRAMEWORK}}` - `{{TASK_TYPE}}` - `{{ADDITIONAL_CONTEXT}}` +- `{{USER_CODE}}` ### 📜 Prompt @@ -101,16 +101,16 @@ Please provide your response based on the {{TASK_TYPE}} specified in the input p ### 🔖 Tags -- code_writing -- code_analysis -- optimization +- multi_language +- code_optimization - debugging +- software_engineering - best_practices ### 📚 Category -Primary Category: code_quality_and_best_practices +Primary Category: software_testing Subcategories: -- multi_language_programming -- software_engineering_principles \ No newline at end of file +- code_analysis +- software_engineering \ No newline at end of file diff --git a/prompts/coding_assistant_agent/metadata.yml b/prompts/coding_assistant_agent/metadata.yml new file mode 100644 index 0000000..650d571 --- /dev/null +++ b/prompts/coding_assistant_agent/metadata.yml @@ -0,0 +1,27 @@ +content_hash: bf31ad01f23e7ef8003f0402bc23b6a3 +description: >- + This prompt creates an AI coding assistant with extensive knowledge in various + programming languages, frameworks, and software engineering practices. It + provides guidance on code writing, analysis, optimization, and debugging while + incorporating advanced software engineering principles. +directory: coding_assistant_agent +one_line_description: >- + Assists in software development tasks across multiple programming languages + and paradigms +primary_category: software_testing +subcategories: + - code_analysis + - software_engineering +tags: + - multi_language + - code_optimization + - debugging + - software_engineering + - best_practices +title: Elite AI Coding Assistant +variables: + - '{{LANGUAGE}}' + - '{{FRAMEWORK}}' + - '{{TASK_TYPE}}' + - '{{ADDITIONAL_CONTEXT}}' + - '{{USER_CODE}}' diff --git a/prompts/elite_ai_coding_assistant/prompt.md b/prompts/coding_assistant_agent/prompt.md similarity index 100% rename from prompts/elite_ai_coding_assistant/prompt.md rename to prompts/coding_assistant_agent/prompt.md diff --git a/prompts/divine_code_refactoring_expert/metadata.yml b/prompts/divine_code_refactoring_expert/metadata.yml deleted file mode 100644 index 0048a95..0000000 --- a/prompts/divine_code_refactoring_expert/metadata.yml +++ /dev/null @@ -1,25 +0,0 @@ -title: Divine Code Refactoring Expert -primary_category: code_quality_and_best_practices -subcategories: - - refactoring - - performance_optimization -directory: divine_code_refactoring_expert -tags: - - code_analysis - - refactoring - - optimization - - language_inference - - testing -one_line_description: >- - Analyzes, refactors, and validates code to enhance quality, readability, and - performance -description: >- - This prompt creates an AI expert that analyzes codebases, infers the - programming language, and performs comprehensive refactoring. It optimizes - code quality, readability, and performance while preserving core - functionality, followed by testing and validation. -variables: - - '{{REFACTOR_SCOPE}}' - - '{{CODEBASE}}' - -content_hash: 0a5d4183b3ff1952e48d7998acb1ac02 diff --git a/prompts/elite_ai_coding_assistant/metadata.yml b/prompts/elite_ai_coding_assistant/metadata.yml deleted file mode 100644 index e2f7654..0000000 --- a/prompts/elite_ai_coding_assistant/metadata.yml +++ /dev/null @@ -1,28 +0,0 @@ -title:Elite AI Coding Assistant -primary_category:code_quality_and_best_practices -subcategories: -- multi_language_programming -- software_engineering_expertise -directory:elite_ai_coding_assistant -tags: -- code_writing -- code_analysis -- optimization -- debugging -- software_engineering -one_line_description:>- -Assists in all aspects of software development with expert guidance and best -practices -description:>- -This prompt creates an AI coding assistant with extensive knowledge across -multiple programming languages and frameworks. It provides guidance on code -writing, analysis, optimization, and debugging while incorporating advanced -software engineering principles and best practices. -variables: -- '{{LANGUAGE}}' -- '{{FRAMEWORK}}' -- '{{TASK_TYPE}}' -- '{{ADDITIONAL_CONTEXT}}' -- '{{USER_CODE}}' - -content_hash:bf31ad01f23e7ef8003f0402bc23b6a3 diff --git a/prompts/git_branch_name_generator/view.md b/prompts/git_branch_name_agent/README.md similarity index 93% rename from prompts/git_branch_name_generator/view.md rename to prompts/git_branch_name_agent/README.md index 247247e..594d1ef 100644 --- a/prompts/git_branch_name_generator/view.md +++ b/prompts/git_branch_name_agent/README.md @@ -2,11 +2,11 @@ ### ✏️ One-line Description -**Generates optimal git branch names based on project context and requirements** +**Generates optimal git branch names based on project context and development workflow** ### 📄 Description -This prompt creates semantically meaningful git branch names adhering to best practices and team conventions. It analyzes project context, user requirements, and development workflows to generate appropriate branch names with type prefixes. +This prompt creates an AI assistant specialized in generating semantically meaningful git branch names. It analyzes project context, user requirements, and development workflows to produce branch names that adhere to best practices and team-specific conventions. ### 🔧 Variables @@ -127,5 +127,5 @@ Current Branch Name Analysis: Primary Category: version_control Subcategories: -- git_branching -- naming_conventions \ No newline at end of file +- branch_naming +- software_development_workflow \ No newline at end of file diff --git a/prompts/git_branch_name_agent/metadata.yml b/prompts/git_branch_name_agent/metadata.yml new file mode 100644 index 0000000..e3bac05 --- /dev/null +++ b/prompts/git_branch_name_agent/metadata.yml @@ -0,0 +1,27 @@ +content_hash: fc85ebcbe0ab76a21b72706335c49e4a +description: >- + This prompt creates an AI assistant specialized in generating semantically + meaningful git branch names. It analyzes project context, user requirements, + and development workflows to produce branch names that adhere to best + practices and team-specific conventions. +directory: git_branch_name_agent +one_line_description: >- + Generates optimal git branch names based on project context and development + workflow +primary_category: version_control +subcategories: + - branch_naming + - software_development_workflow +tags: + - git + - branch_naming + - version_control + - software_development + - best_practices +title: Git Branch Name Generator +variables: + - '{{PROJECT_CONTEXT}}' + - '{{USER_REQUIREMENTS}}' + - '{{DEVELOPMENT_WORKFLOW}}' + - '{{TEAM_CONVENTIONS}}' + - '{{CURRENT_BRANCH_NAME}}' diff --git a/prompts/git_branch_name_generator/prompt.md b/prompts/git_branch_name_agent/prompt.md similarity index 100% rename from prompts/git_branch_name_generator/prompt.md rename to prompts/git_branch_name_agent/prompt.md diff --git a/prompts/git_branch_name_generator/metadata.yml b/prompts/git_branch_name_generator/metadata.yml deleted file mode 100644 index 8f736fc..0000000 --- a/prompts/git_branch_name_generator/metadata.yml +++ /dev/null @@ -1,26 +0,0 @@ -title: Git Branch Name Generator -primary_category: version_control -subcategories: - - git_branching - - naming_conventions -directory: git_branch_name_generator -tags: - - git - - branch_naming - - version_control - - software_development - - best_practices -one_line_description: Generates optimal git branch names based on project context and requirements -description: >- - This prompt creates semantically meaningful git branch names adhering to best - practices and team conventions. It analyzes project context, user - requirements, and development workflows to generate appropriate branch names - with type prefixes. -variables: - - '{{PROJECT_CONTEXT}}' - - '{{USER_REQUIREMENTS}}' - - '{{DEVELOPMENT_WORKFLOW}}' - - '{{TEAM_CONVENTIONS}}' - - '{{CURRENT_BRANCH_NAME}}' - -content_hash: fc85ebcbe0ab76a21b72706335c49e4a diff --git a/prompts/git_commit_message_generator/view.md b/prompts/git_commit_message_agent/README.md similarity index 94% rename from prompts/git_commit_message_generator/view.md rename to prompts/git_commit_message_agent/README.md index dc679f3..510a87d 100644 --- a/prompts/git_commit_message_generator/view.md +++ b/prompts/git_commit_message_agent/README.md @@ -6,7 +6,7 @@ ### 📄 Description -This prompt creates an AI expert in crafting git commit messages that adhere to the Conventional Commits specification. It generates concise, informative commit messages with appropriate emojis, providing clear insights into code changes for both developers and automated tools. +This prompt creates an AI agent specialized in crafting perfect git commit messages. It adheres strictly to the Conventional Commits specification, incorporates appropriate emojis, and provides clear insights into code changes within character limits. The agent is designed to optimize commit messages for both human readability and automated tool processing. ### 🔧 Variables diff --git a/prompts/git_commit_message_agent/metadata.yml b/prompts/git_commit_message_agent/metadata.yml new file mode 100644 index 0000000..c50f69a --- /dev/null +++ b/prompts/git_commit_message_agent/metadata.yml @@ -0,0 +1,25 @@ +content_hash: b15f73d644b948ff5cf129a2ca2412b2 +description: >- + This prompt creates an AI agent specialized in crafting perfect git commit + messages. It adheres strictly to the Conventional Commits specification, + incorporates appropriate emojis, and provides clear insights into code changes + within character limits. The agent is designed to optimize commit messages for + both human readability and automated tool processing. +directory: git_commit_message_agent +one_line_description: >- + Generates optimized git commit messages following Conventional Commits + specification +primary_category: version_control +subcategories: + - commit_message_formatting + - conventional_commits +tags: + - git + - commit_messages + - conventional_commits + - emoji + - code_changes +title: Git Commit Message Generator +variables: + - '{{TASK_DESCRIPTION}}' + - '{{CODE_CHANGES}}' diff --git a/prompts/git_commit_message_generator/prompt.md b/prompts/git_commit_message_agent/prompt.md similarity index 100% rename from prompts/git_commit_message_generator/prompt.md rename to prompts/git_commit_message_agent/prompt.md diff --git a/prompts/git_commit_message_generator/metadata.yml b/prompts/git_commit_message_generator/metadata.yml deleted file mode 100644 index 15197b2..0000000 --- a/prompts/git_commit_message_generator/metadata.yml +++ /dev/null @@ -1,22 +0,0 @@ -title: Git Commit Message Generator -primary_category: version_control -subcategories: -- commit_message_formatting -- conventional_commits -directory: git_commit_message_generator -tags: -- git -- commit_messages -- conventional_commits -- emoji -- code_changes -one_line_description: Generates optimized git commit messages following Conventional - Commits specification -description: This prompt creates an AI expert in crafting git commit messages that - adhere to the Conventional Commits specification. It generates concise, informative - commit messages with appropriate emojis, providing clear insights into code changes - for both developers and automated tools. -variables: -- '{{TASK_DESCRIPTION}}' -- '{{CODE_CHANGES}}' -content_hash: b15f73d644b948ff5cf129a2ca2412b2 diff --git a/prompts/github_issue_creation_expert/view.md b/prompts/github_issue_agent/README.md similarity index 92% rename from prompts/github_issue_creation_expert/view.md rename to prompts/github_issue_agent/README.md index bdee2b6..cfce58f 100644 --- a/prompts/github_issue_creation_expert/view.md +++ b/prompts/github_issue_agent/README.md @@ -2,11 +2,11 @@ ### ✏️ One-line Description -**Creates optimized GitHub issues considering code context, project history, and team dynamics** +**Creates comprehensive, optimized GitHub issues based on context and team dynamics** ### 📄 Description -This prompt embodies an AI expert in GitHub issue management, capable of creating comprehensive and actionable issues. It analyzes project context, documentation, history, and team dynamics to generate highly optimized and insightful GitHub issues tailored to the specific project and team needs. +This prompt embodies an AI expert in GitHub issue management, capable of creating highly detailed and actionable issues. It analyzes project context, documentation, history, and team dynamics to generate optimized GitHub issues that follow best practices and consider team-specific factors. ### 🔧 Variables @@ -137,7 +137,7 @@ Please provide the created GitHub issue using the Markdown format specified in t - issue_management - project_optimization - team_dynamics -- best_practices +- repository_management ### 📚 Category @@ -145,4 +145,4 @@ Primary Category: project_management Subcategories: - issue_tracking -- software_development_lifecycle \ No newline at end of file +- team_collaboration \ No newline at end of file diff --git a/prompts/github_issue_agent/metadata.yml b/prompts/github_issue_agent/metadata.yml new file mode 100644 index 0000000..736ca03 --- /dev/null +++ b/prompts/github_issue_agent/metadata.yml @@ -0,0 +1,26 @@ +content_hash: f692d056df3bb02f011848894db6a96a +description: >- + This prompt embodies an AI expert in GitHub issue management, capable of + creating highly detailed and actionable issues. It analyzes project context, + documentation, history, and team dynamics to generate optimized GitHub issues + that follow best practices and consider team-specific factors. +directory: github_issue_agent +one_line_description: >- + Creates comprehensive, optimized GitHub issues based on context and team + dynamics +primary_category: project_management +subcategories: + - issue_tracking + - team_collaboration +tags: + - github + - issue_management + - project_optimization + - team_dynamics + - repository_management +title: GitHub Issue Creation Expert +variables: + - '{{CONTEXT}}' + - '{{PROJECT_DOCUMENTATION}}' + - '{{TEAM_DYNAMICS}}' + - '{{PROJECT_HISTORY}}' diff --git a/prompts/github_issue_creation_expert/prompt.md b/prompts/github_issue_agent/prompt.md similarity index 100% rename from prompts/github_issue_creation_expert/prompt.md rename to prompts/github_issue_agent/prompt.md diff --git a/prompts/github_issue_creation_expert/metadata.yml b/prompts/github_issue_creation_expert/metadata.yml deleted file mode 100644 index 6a371b7..0000000 --- a/prompts/github_issue_creation_expert/metadata.yml +++ /dev/null @@ -1,24 +0,0 @@ -title: GitHub Issue Creation Expert -primary_category: project_management -subcategories: -- issue_tracking -- software_development_lifecycle -directory: github_issue_creation_expert -tags: -- github -- issue_management -- project_optimization -- team_dynamics -- best_practices -one_line_description: Creates optimized GitHub issues considering code context, project - history, and team dynamics -description: This prompt embodies an AI expert in GitHub issue management, capable - of creating comprehensive and actionable issues. It analyzes project context, documentation, - history, and team dynamics to generate highly optimized and insightful GitHub issues - tailored to the specific project and team needs. -variables: -- '{{CONTEXT}}' -- '{{PROJECT_DOCUMENTATION}}' -- '{{TEAM_DYNAMICS}}' -- '{{PROJECT_HISTORY}}' -content_hash: f692d056df3bb02f011848894db6a96a diff --git a/prompts/prompt_engineering_god/view.md b/prompts/prompt_engineering_agent/README.md similarity index 93% rename from prompts/prompt_engineering_god/view.md rename to prompts/prompt_engineering_agent/README.md index d859e69..f194ae7 100644 --- a/prompts/prompt_engineering_god/view.md +++ b/prompts/prompt_engineering_agent/README.md @@ -2,11 +2,11 @@ ### ✏️ One-line Description -**Crafts divine-tier prompts for optimal AI performance across various domains** +**Creates and refines optimized prompts for AI models across various domains** ### 📄 Description -This prompt embodies the ultimate prompt engineer, capable of creating and refining prompts that maximize AI model potential. It incorporates advanced techniques, adapts to various domains, and ensures ethical compliance while meeting specific user requirements. +This prompt embodies advanced prompt engineering techniques to unlock the full potential of AI models. It adapts to various domains, incorporates ethical constraints, and employs cutting-edge optimization methods to generate exceptional, tailored outputs for any user need. ### 🔧 Variables @@ -148,14 +148,14 @@ Generate the final prompt output according to the specified {{PROMPT_OUTPUT_FORM - prompt_optimization - ai_capabilities +- adaptive_prompting - ethical_constraints -- task_customization -- advanced_techniques +- multi_domain ### 📚 Category Primary Category: prompt_engineering Subcategories: -- ai_optimization -- task_adaptation \ No newline at end of file +- advanced_techniques +- ai_model_optimization \ No newline at end of file diff --git a/prompts/prompt_engineering_agent/metadata.yml b/prompts/prompt_engineering_agent/metadata.yml new file mode 100644 index 0000000..157772f --- /dev/null +++ b/prompts/prompt_engineering_agent/metadata.yml @@ -0,0 +1,27 @@ +content_hash: 98cc0ea85eb722ef28407f75f62d8dec +description: >- + This prompt embodies advanced prompt engineering techniques to unlock the full + potential of AI models. It adapts to various domains, incorporates ethical + constraints, and employs cutting-edge optimization methods to generate + exceptional, tailored outputs for any user need. +directory: prompt_engineering_agent +one_line_description: Creates and refines optimized prompts for AI models across various domains +primary_category: prompt_engineering +subcategories: + - advanced_techniques + - ai_model_optimization +tags: + - prompt_optimization + - ai_capabilities + - adaptive_prompting + - ethical_constraints + - multi_domain +title: Prompt Engineering God +variables: + - '{{USER_REQUIREMENTS}}' + - '{{AI_MODEL}}' + - '{{OPTIONAL_PROMPT_TO_REFINE}}' + - '{{PROMPT_ENGINEERING_GUIDELINES}}' + - '{{OUTPUT_GUIDELINES}}' + - '{{PROMPT_OUTPUT_FORMAT}}' + - '{{AVAILABLE_OUTPUT_FORMATS}}' diff --git a/prompts/prompt_engineering_god/prompt.md b/prompts/prompt_engineering_agent/prompt.md similarity index 100% rename from prompts/prompt_engineering_god/prompt.md rename to prompts/prompt_engineering_agent/prompt.md diff --git a/prompts/prompt_engineering_god/metadata.yml b/prompts/prompt_engineering_god/metadata.yml deleted file mode 100644 index 6e66d55..0000000 --- a/prompts/prompt_engineering_god/metadata.yml +++ /dev/null @@ -1,27 +0,0 @@ -title: Prompt Engineering God -primary_category: prompt_engineering -subcategories: - - ai_optimization - - task_adaptation -directory: prompt_engineering_god -tags: - - prompt_optimization - - ai_capabilities - - ethical_constraints - - task_customization - - advanced_techniques -one_line_description: Crafts divine-tier prompts for optimal AI performance across various domains -description: >- - This prompt embodies the ultimate prompt engineer, capable of creating and - refining prompts that maximize AI model potential. It incorporates advanced - techniques, adapts to various domains, and ensures ethical compliance while - meeting specific user requirements. -variables: - - '{{USER_REQUIREMENTS}}' - - '{{AI_MODEL}}' - - '{{OPTIONAL_PROMPT_TO_REFINE}}' - - '{{PROMPT_ENGINEERING_GUIDELINES}}' - - '{{OUTPUT_GUIDELINES}}' - - '{{PROMPT_OUTPUT_FORMAT}}' - - '{{AVAILABLE_OUTPUT_FORMATS}}' -content_hash: 98cc0ea85eb722ef28407f75f62d8dec diff --git a/prompts/software_development_pull_request_generator/view.md b/prompts/software_dev_pr_agent/README.md similarity index 90% rename from prompts/software_development_pull_request_generator/view.md rename to prompts/software_dev_pr_agent/README.md index fbf5bca..cc9fc7c 100644 --- a/prompts/software_development_pull_request_generator/view.md +++ b/prompts/software_dev_pr_agent/README.md @@ -2,11 +2,11 @@ ### ✏️ One-line Description -**Generates comprehensive pull requests for software development projects** +**Generates comprehensive pull requests for software projects based on provided context** ### 📄 Description -This prompt creates detailed pull requests that optimize code architecture, identify issues, and suggest improvements. It follows GitHub best practices and provides a structured format for effective code review and project enhancement. +This prompt creates detailed, high-quality pull requests for software projects. It analyzes given context, identifies improvements, suggests optimizations, and ensures adherence to GitHub best practices and conventions. ### 🔧 Variables @@ -108,16 +108,16 @@ Generate a pull request based on the provided project context, following the str ### 🔖 Tags -- pull_request +- github - code_review +- pull_request - best_practices -- github - software_development ### 📚 Category -Primary Category: code_quality_and_best_practices +Primary Category: version_control Subcategories: -- pull_request_generation -- code_review \ No newline at end of file +- code_review +- pull_request_generation \ No newline at end of file diff --git a/prompts/software_dev_pr_agent/metadata.yml b/prompts/software_dev_pr_agent/metadata.yml new file mode 100644 index 0000000..46ce3c8 --- /dev/null +++ b/prompts/software_dev_pr_agent/metadata.yml @@ -0,0 +1,22 @@ +content_hash: 405f0046d96dcf7338e351beee3b7f84 +description: >- + This prompt creates detailed, high-quality pull requests for software + projects. It analyzes given context, identifies improvements, suggests + optimizations, and ensures adherence to GitHub best practices and conventions. +directory: software_dev_pr_agent +one_line_description: >- + Generates comprehensive pull requests for software projects based on provided + context +primary_category: version_control +subcategories: + - code_review + - pull_request_generation +tags: + - github + - code_review + - pull_request + - best_practices + - software_development +title: Software Development Pull Request Generator +variables: + - '{{CONTEXT}}' diff --git a/prompts/software_development_pull_request_generator/prompt.md b/prompts/software_dev_pr_agent/prompt.md similarity index 100% rename from prompts/software_development_pull_request_generator/prompt.md rename to prompts/software_dev_pr_agent/prompt.md diff --git a/prompts/software_development_pull_request_generator/metadata.yml b/prompts/software_development_pull_request_generator/metadata.yml deleted file mode 100644 index a7eb542..0000000 --- a/prompts/software_development_pull_request_generator/metadata.yml +++ /dev/null @@ -1,20 +0,0 @@ -title: Software Development Pull Request Generator -primary_category: code_quality_and_best_practices -subcategories: -- pull_request_generation -- code_review -directory: software_development_pull_request_generator -tags: -- pull_request -- code_review -- best_practices -- github -- software_development -one_line_description: Generates comprehensive pull requests for software development - projects -description: This prompt creates detailed pull requests that optimize code architecture, - identify issues, and suggest improvements. It follows GitHub best practices and - provides a structured format for effective code review and project enhancement. -variables: -- '{{CONTEXT}}' -content_hash: 405f0046d96dcf7338e351beee3b7f84 diff --git a/prompts/software_specification_creator/view.md b/prompts/software_spec_agent/README.md similarity index 95% rename from prompts/software_specification_creator/view.md rename to prompts/software_spec_agent/README.md index 8996c0b..61b2b18 100644 --- a/prompts/software_specification_creator/view.md +++ b/prompts/software_spec_agent/README.md @@ -2,11 +2,11 @@ ### ✏️ One-line Description -**Creates detailed software specification documents through interactive requirement gathering** +**Generates detailed software specification documents through interactive requirement analysis** ### 📄 Description -This prompt guides the creation of comprehensive software specification documents. It employs an interactive review process to gather and refine user requirements, covering various aspects of software development from project overview to future considerations. +This prompt creates comprehensive software specification documents by guiding users through an interactive review process. It analyzes user requirements, asks clarifying questions, and generates a structured specification document covering various aspects of software development. ### 🔧 Variables @@ -256,16 +256,16 @@ Throughout the specification process, ensure: ### 🔖 Tags -- requirements_gathering +- software_specifications +- requirements_analysis - interactive_review -- spec_document -- software_development -- project_management +- document_generation +- project_planning ### 📚 Category Primary Category: documentation Subcategories: -- software_requirements -- project_planning \ No newline at end of file +- requirements_gathering +- software_design \ No newline at end of file diff --git a/prompts/software_spec_agent/metadata.yml b/prompts/software_spec_agent/metadata.yml new file mode 100644 index 0000000..948379e --- /dev/null +++ b/prompts/software_spec_agent/metadata.yml @@ -0,0 +1,25 @@ +content_hash: c0bc0f6622f12af4a3f8349d0bf91f30 +description: >- + This prompt creates comprehensive software specification documents by guiding + users through an interactive review process. It analyzes user requirements, + asks clarifying questions, and generates a structured specification document + covering various aspects of software development. +directory: software_spec_agent +one_line_description: >- + Generates detailed software specification documents through interactive + requirement analysis +primary_category: documentation +subcategories: + - requirements_gathering + - software_design +tags: + - software_specifications + - requirements_analysis + - interactive_review + - document_generation + - project_planning +title: Software Specification Creator +variables: + - '{{USER_REQUIREMENTS}}' + - '{{OUTPUT_FORMAT}}' + - '{{AVAILABLE_OUTPUT_FORMATS}}' diff --git a/prompts/software_specification_creator/prompt.md b/prompts/software_spec_agent/prompt.md similarity index 100% rename from prompts/software_specification_creator/prompt.md rename to prompts/software_spec_agent/prompt.md diff --git a/prompts/software_specification_creator/metadata.yml b/prompts/software_specification_creator/metadata.yml deleted file mode 100644 index 0798e90..0000000 --- a/prompts/software_specification_creator/metadata.yml +++ /dev/null @@ -1,23 +0,0 @@ -title: Software Specification Creator -primary_category: documentation -subcategories: -- software_requirements -- project_planning -directory: software_specification_creator -tags: -- requirements_gathering -- interactive_review -- spec_document -- software_development -- project_management -one_line_description: Creates detailed software specification documents through interactive - requirement gathering -description: This prompt guides the creation of comprehensive software specification - documents. It employs an interactive review process to gather and refine user requirements, - covering various aspects of software development from project overview to future - considerations. -variables: -- '{{USER_REQUIREMENTS}}' -- '{{OUTPUT_FORMAT}}' -- '{{AVAILABLE_OUTPUT_FORMATS}}' -content_hash: c0bc0f6622f12af4a3f8349d0bf91f30 diff --git a/src/core/config.ts b/src/core/config.ts index 558b631..74f3073 100644 --- a/src/core/config.ts +++ b/src/core/config.ts @@ -22,7 +22,7 @@ interface Config { /** Metadata settings */ DEFAULT_CATEGORY: string; /** GitHub Actions settings */ - FORCE_REGENERATE_ENV_VAR: string; + FORCE_REGENERATE: string; /** Logging settings */ LOG_LEVEL: 'debug' | 'info' | 'warn' | 'error'; /** YAML configuration */ @@ -34,18 +34,18 @@ interface Config { */ const config: Config = { PROMPTS_DIR: 'prompts', - TEMPLATES_DIR: path.join('templates'), - ANALYZER_PROMPT_PATH: path.join('system_prompts', 'ai_prompt_analyzer_and_output_generator', 'prompt.md'), + TEMPLATES_DIR: path.join('src', 'templates'), + ANALYZER_PROMPT_PATH: path.join('src', 'system_prompts', 'prompt_analysis_agent', 'prompt.md'), README_PATH: 'README.md', ANTHROPIC_MODEL: 'claude-3-5-sonnet-20240620', ANTHROPIC_MAX_TOKENS: 2500, PROMPT_FILE_NAME: 'prompt.md', METADATA_FILE_NAME: 'metadata.yml', - VIEW_FILE_NAME: 'view.md', - VIEW_TEMPLATE_NAME: 'view_template.md', - README_TEMPLATE_NAME: 'readme_template.md', + VIEW_FILE_NAME: 'README.md', + VIEW_TEMPLATE_NAME: 'sub_readme.md', + README_TEMPLATE_NAME: 'main_readme.md', DEFAULT_CATEGORY: 'uncategorized', - FORCE_REGENERATE_ENV_VAR: 'false', + FORCE_REGENERATE: process.env.FORCE_REGENERATE ?? 'false', LOG_LEVEL: 'info', YAML_INDENT: 2, YAML_LINE_WIDTH: 80 diff --git a/src/core/generate_metadata.ts b/src/core/generate_metadata.ts index a208d2e..a7348b6 100644 --- a/src/core/generate_metadata.ts +++ b/src/core/generate_metadata.ts @@ -109,7 +109,7 @@ export async function generateMetadata(promptContent: string): Promise * @returns {Promise<[boolean, string]>} A tuple indicating if update is needed and the new hash. */ export async function shouldUpdateMetadata(promptFile: string, metadataFile: string): Promise<[boolean, string]> { - const forceRegenerate = process.env[config.FORCE_REGENERATE_ENV_VAR]?.toLowerCase() === 'true'; + const forceRegenerate = config.FORCE_REGENERATE.toLowerCase() === 'true'; const promptContent = await readFileContent(promptFile); const promptHash = crypto.createHash('md5').update(promptContent).digest('hex'); @@ -118,6 +118,11 @@ export async function shouldUpdateMetadata(promptFile: string, metadataFile: str return [true, promptHash]; } + if (!(await fileExists(metadataFile))) { + logger.info(`Metadata file ${metadataFile} does not exist. Update needed.`); + return [true, promptHash]; + } + try { const metadataContent = await readFileContent(metadataFile); const storedHashLine = metadataContent.split('\n').find((line) => line.trim().startsWith('content_hash:')); @@ -137,12 +142,8 @@ export async function shouldUpdateMetadata(promptFile: string, metadataFile: str logger.info(`Content hash match for ${promptFile}. No update needed.`); return [false, promptHash]; } catch (error) { - if ((error as NodeJS.ErrnoException).code === 'ENOENT') { - logger.info(`Metadata file ${metadataFile} does not exist. Update needed.`); - return [true, promptHash]; - } - - throw error; + logger.error(`Error reading metadata file ${metadataFile}:`, error); + return [true, promptHash]; } } diff --git a/src/system_prompts/prompt_analysis_agent/README.md b/src/system_prompts/prompt_analysis_agent/README.md new file mode 100644 index 0000000..9a6378e --- /dev/null +++ b/src/system_prompts/prompt_analysis_agent/README.md @@ -0,0 +1,120 @@ +# AI Prompt Analysis Expert + +### ✏️ One-line Description + +**Analyzes AI prompts to extract key information and provide insights for optimization** + +### 📄 Description + +This prompt creates an AI expert that specializes in analyzing and dissecting AI prompts. It extracts crucial information, categorizes the prompt, and provides actionable insights for prompt engineering and optimization. + +### 🔧 Variables + +- `{{PROMPT}}` + +### 📜 Prompt + +```md +You are an AI prompt analysis expert with unparalleled skills in categorization and information extraction. Your mission is to dissect and analyze the given AI prompt with surgical precision, providing valuable insights for prompt engineering and optimization. + +Analyze the provided AI prompt and extract key information according to the specified guidelines. Your analysis should be thorough, precise, and actionable. + + +Prompt to Analyze: {{PROMPT}} +Top-Level Categories: [ + "architecture_and_design", + "artificial_intelligence_and_machine_learning", + "cloud_computing", + "code_quality_and_best_practices", + "data_management_and_analytics", + "development_tools_and_environments", + "devops_and_deployment", + "documentation", + "frontend_development", + "mobile_development", + "performance_and_optimization", + "project_management", + "prompt_engineering", + "security", + "software_testing", + "user_experience_and_interface_design", + "version_control", + "web_development" +] + + + +Follow these steps to analyze the prompt: + +1. Carefully examine the provided prompt, considering its structure, content, and intended purpose. + Assess the prompt's overall structure, key components, and any specific instructions or requirements it contains. + +2. Select the most appropriate primary category from the provided list of top-level categories. + Consider the prompt's main focus and overall objective. If multiple categories seem relevant, choose the one that best captures the prompt's primary function. + +3. Identify up to two subcategories that further specify the prompt's focus. These can be more specific than the primary category and may be custom-created if necessary. + Look for secondary themes or specific applications within the prompt. Ensure these subcategories provide additional context beyond the primary category. + +4. Generate a list of 3-5 tags that accurately represent the prompt's main themes or applications. These should be single words or short phrases, with underscores replacing spaces. + Consider key concepts, technologies, or methodologies mentioned in the prompt. Aim for a mix of general and specific tags to aid in searchability. + +5. Craft a concise, one-line description of the prompt that: + - Captures the main purpose or function + - Is no longer than 100 characters + - Starts with a verb in the present tense (e.g., "Analyzes," "Generates," "Optimizes") + Distill the prompt's core function into a clear, action-oriented statement. + +6. Write a brief 2-3 sentence description explaining the prompt's key features and capabilities. + Expand on the one-line description, highlighting unique aspects or methodologies used in the prompt. + +7. Identify all variables in the prompt that require user input, typically in the format {{VARIABLE_NAME}}. + Scan the prompt for placeholders or explicitly mentioned variables that users need to provide. + +8. Generate a directory name for the prompt using this convention: + - Convert the prompt's main topic to lowercase + - Replace spaces with underscores + - Remove special characters + - Remove level-specific terms (e.g., "expert", "god", "elite", "advanced", etc.) + - When applicable, replace generic terms (e.g., "AI", "creator", "generator", etc.) with "agent" as the default term + - Keep it concise (max 30 characters) + Create a clear, descriptive name that reflects the prompt's primary function. + +Present your analysis using the specified output format, ensuring accuracy and adherence to the guidelines. + + + +title: [Prompt's main topic or purpose] +primary_category: [Your selected primary category] +subcategories: + - [Subcategory 1] + - [Subcategory 2] +directory: [Your generated directory name] +tags: + - [Tag 1] + - [Tag 2] + - [Tag 3] + [Add more tags if necessary] +one_line_description: [Your one-line description] +description: [Your quick description] +variables: + - "{{VARIABLE_1}}" + - "{{VARIABLE_2}}" + [Add more variables if necessary] + +``` + +### 🔖 Tags + +- prompt_engineering +- analysis +- categorization +- information_extraction +- optimization + +### 📚 Category + +Primary Category: prompt_engineering +Subcategories: + +- information_extraction +- categorization \ No newline at end of file diff --git a/src/system_prompts/prompt_analysis_agent/metadata.yml b/src/system_prompts/prompt_analysis_agent/metadata.yml new file mode 100644 index 0000000..7307041 --- /dev/null +++ b/src/system_prompts/prompt_analysis_agent/metadata.yml @@ -0,0 +1,16 @@ +title: AI Prompt Analysis Expert +primary_category: prompt_engineering +subcategories: + - information_extraction + - categorization +directory: prompt_analysis_agent +tags: + - prompt_engineering + - analysis + - categorization + - information_extraction + - optimization +one_line_description: Analyzes AI prompts to extract key information and provide insights for optimization +description: This prompt creates an AI expert that specializes in analyzing and dissecting AI prompts. It extracts crucial information, categorizes the prompt, and provides actionable insights for prompt engineering and optimization. +variables: + - "{{PROMPT}}" \ No newline at end of file diff --git a/system_prompts/ai_prompt_analyzer_and_output_generator/prompt.md b/src/system_prompts/prompt_analysis_agent/prompt.md similarity index 94% rename from system_prompts/ai_prompt_analyzer_and_output_generator/prompt.md rename to src/system_prompts/prompt_analysis_agent/prompt.md index b2cca6f..61a4cc5 100644 --- a/system_prompts/ai_prompt_analyzer_and_output_generator/prompt.md +++ b/src/system_prompts/prompt_analysis_agent/prompt.md @@ -57,14 +57,11 @@ Follow these steps to analyze the prompt: - Convert the prompt's main topic to lowercase - Replace spaces with underscores - Remove special characters - - Keep it concise (max 50 characters) + - Remove level-specific terms (e.g., "expert", "god", "elite", "advanced", etc.) + - When applicable, replace generic terms (e.g., "AI", "creator", "generator", etc.) with "agent" as the default term + - Keep it concise (max 30 characters) Create a clear, descriptive name that reflects the prompt's primary function. -9. Create a markdown link for referencing the prompt: - - Use the one-line description as the link text - - Use the directory name as the link URL - - Format it as: [One-line description](directory_name) - Present your analysis using the specified output format, ensuring accuracy and adherence to the guidelines. diff --git a/src/templates/main_readme.md b/src/templates/main_readme.md new file mode 100644 index 0000000..97bd18f --- /dev/null +++ b/src/templates/main_readme.md @@ -0,0 +1,102 @@ +# 📚 Prompt Library + +> ### 🚧 **Project Under Active Development** 🚧 +> +> **Note:** This project is new and undergoing rapid development. You may encounter bugs or frequent changes. We appreciate your patience and encourage you to: +> - Report any issues you encounter +> - Check for updates regularly +> - Contribute ideas or improvements +> +> Your feedback is valuable in shaping this project. Thank you for your interest and support! + +Welcome to the **Prompt Library**. This repository contains a collection of AI prompts categorized for easy navigation and reuse. + +## 🗂️ Categories + +{%- for category, prompts in categories %} + +### {{ format_category(category) }} + +{% for prompt in prompts %} +- [{{ prompt.title }}]({{ prompt.path }}) - {{ prompt.description }} +{%- endfor %} +{%- endfor %} + +## 🚀 Getting Started + +This repository is designed to be easily forked and customized for your own use. Follow these steps to get started: + +1. **Fork the Repository**: Click the "Fork" button at the top right of this page to create a copy of this repository in your own GitHub account. + +2. **Clone Your Fork**: Clone the forked repository to your local machine using: + + ``` + git clone https://github.com/YOUR_USERNAME/REPO_NAME.git + ``` + +3. **Set Up Anthropic API Key**: + - Go to your repository's settings on GitHub. + - Navigate to "Secrets and variables" > "Actions". + - Create a new repository secret named `ANTHROPIC_API_KEY` and paste your Anthropic API key as the value. + +4. **Install Dependencies**: + - Ensure you have Node.js installed (version 22 or later recommended). + - Run `npm install` to install the project dependencies. + +5. **Add Your Own Prompts**: + - Create a new file in the `prompts` directory named `prompt.md`. + - Write your prompt content in this file. + - Commit and push your changes to GitHub. + +6. **Let GitHub Actions Work**: + - The GitHub Actions workflow will automatically generate metadata for your new prompt. + - It will create a new directory for your prompt, move the `prompt.md` file into it, and create `metadata.yml` and `README.md` files. + - The main README will be automatically updated to include your new prompt. + +7. **Run Locally**: + - Use `npm run generate-metadata` to generate metadata for your prompts. + - Use `npm run update-views` to update the README files. + +8. **Customize as Needed**: + - Modify the templates in the `src/templates` directory to change how prompts are displayed. + - Update the scripts in `src/core` to alter the metadata generation or view update process. + +## 🛠️ How It Works + +- When you add or update a `prompt.md` file in the `prompts` directory, GitHub Actions are triggered. +- The `generate_metadata.ts` script uses the Anthropic API to analyze your prompt and generate metadata. +- The `update_views.ts` script creates or updates the `README.md` files for each prompt and updates the main README. +- All changes are automatically committed back to the repository. + +## 🔧 Customizing Metadata Extraction + +The system prompt used to extract metadata from your prompts can be customized. This prompt is located at: + +[`src/system_prompts/prompt_analysis_agent/prompt.md`](src/system_prompts/prompt_analysis_agent/prompt.md) + +To customize the metadata extraction process: + +1. Open the `prompt.md` file in your preferred text editor. +2. Review the existing prompt structure, which includes sections like ``, ``, ``, ``, and ``. +3. Modify the content within these sections to adjust the behavior of the metadata extraction process. For example: + - Update the `` section to change how categories are assigned. + - Modify the `` section to alter the structure of the generated metadata. +4. Save your changes to the file. + +After modifying the prompt: + +- Run `npm run generate-metadata` locally to test your changes. +- Review the generated metadata files to ensure the output meets your expectations. +- If satisfied, commit and push your changes to trigger the GitHub Actions workflow. + +This customization allows you to tailor the metadata generation process to your specific needs or to extract additional information from your prompts. Remember that changes to this file will affect all future metadata generations, so test thoroughly before committing. + +> **Note**: The `generate_metadata.ts` script in `src/core/` uses this prompt file when interacting with the Anthropic API. If you make significant changes to the prompt structure, you may need to update the script as well. + +## 📝 Contributing + +Contributions to improve the templates, scripts, or overall structure of this prompt library are welcome! Please feel free to submit issues or pull requests. + +## 📄 License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details. diff --git a/templates/view_template.md b/src/templates/sub_readme.md similarity index 100% rename from templates/view_template.md rename to src/templates/sub_readme.md diff --git a/src/utils/yaml_operations.ts b/src/utils/yaml_operations.ts index 64f248a..33f81f9 100644 --- a/src/utils/yaml_operations.ts +++ b/src/utils/yaml_operations.ts @@ -87,15 +87,17 @@ export function parseAndValidateYamlContent(yamlContent: string): Metadata { * @returns {string} Sanitized YAML content. */ export function sanitizeYamlContent(content: string): string { - const lines = content.split('\n'); - const sanitizedLines = lines.map((line) => { - const trimmedLine = line.trimStart(); - - if (trimmedLine.includes(':') && !trimmedLine.endsWith(':')) { - const [key, ...values] = trimmedLine.split(':'); - return `${key}:${values.join(':').trimStart()}`; - } - return trimmedLine; - }); - return sanitizedLines.join('\n').trim() + '\n'; + try { + const parsedContent = yaml.load(content); + const sanitizedContent = yaml.dump(parsedContent, { + indent: config.YAML_INDENT, + lineWidth: config.YAML_LINE_WIDTH, + noRefs: true, + sortKeys: true + }); + return sanitizedContent.trim() + '\n'; + } catch (error) { + logger.error('YAML sanitization error:', error); + throw new Error(`Failed to sanitize YAML content: ${(error as Error).message}`); + } } diff --git a/templates/readme_template.md b/templates/readme_template.md deleted file mode 100644 index 14e8dfd..0000000 --- a/templates/readme_template.md +++ /dev/null @@ -1,70 +0,0 @@ -# 📚 Prompt Library - -Welcome to the **Prompt Library**. This repository contains a collection of AI prompts categorized for easy navigation and reuse. - -## 🗂️ Categories - -{%- for category, prompts in categories %} - -### {{ format_category(category) }} - -{% for prompt in prompts %} -- [{{ prompt.title }}]({{ prompt.path }}) - {{ prompt.description }} -{%- endfor %} -{%- endfor %} - -## 🚀 Getting Started - -This repository is designed to be easily forked and customized for your own use. Follow these steps to get started: - -1. **Fork the Repository**: Click the "Fork" button at the top right of this page to create a copy of this repository in your own GitHub account. - -2. **Clone Your Fork**: Clone the forked repository to your local machine using: - - ``` - git clone https://github.com/YOUR_USERNAME/REPO_NAME.git - ``` - -3. **Set Up Anthropic API Key**: - - Go to your repository's settings on GitHub. - - Navigate to "Secrets and variables" > "Actions". - - Create a new repository secret named `ANTHROPIC_API_KEY` and paste your Anthropic API key as the value. - -4. **Add Your Own Prompts**: - - Create a new file in the `prompts` directory named `prompt.md`. - - Write your prompt content in this file. - - Commit and push your changes to GitHub. - -5. **Let GitHub Actions Work**: - - The GitHub Actions workflow will automatically generate metadata for your new prompt. - - It will create a new directory for your prompt, move the `prompt.md` file into it, and create `metadata.yml` and `view.md` files. - - The README will be automatically updated to include your new prompt. - -6. **Customize as Needed**: - - You can modify the templates in the `.github/templates` directory to change how prompts are displayed. - - Update the scripts in `.github/scripts` to alter the metadata generation or view update process. - -## 🛠️ How It Works - -- When you add or update a `prompt.md` file in the `prompts` directory, GitHub Actions are triggered. -- The `generate_metadata.py` script uses the Anthropic API to analyze your prompt and generate metadata. -- The `update_views.py` script creates or updates the `view.md` files for each prompt and updates the main README. -- All changes are automatically committed back to the repository. - -## 🔧 Customizing Metadata Extraction - -The system prompt used to extract metadata from your prompts can be customized. This prompt is located at: - -``` -.github/prompts/ai_prompt_analyzer_and_output_generator/prompt.md -``` - -You can modify this file to change how metadata is extracted from your prompts. This allows you to tailor the metadata generation process to your specific needs or to extract additional information from your prompts. - -## 📝 Contributing - -Contributions to improve the templates, scripts, or overall structure of this prompt library are welcome! Please feel free to submit issues or pull requests. - -## 📄 License - -This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.