Skip to content

Commit

Permalink
📝 docs(readme): Add auto-generation for table of contents and simplif…
Browse files Browse the repository at this point in the history
…y README
  • Loading branch information
thibaultyou committed Oct 10, 2024
1 parent a36c21c commit c10162d
Show file tree
Hide file tree
Showing 5 changed files with 1,109 additions and 864 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/update_views.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ jobs:
- name: Update views
run: npm run update-views

- name: Generate TOC
run: npm run toc

- name: Commit changes
run: |
git config --local user.name "github-actions[bot]"
Expand Down
211 changes: 90 additions & 121 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,29 @@

> ### 🚧 **Project Under Development** 🚧
>
> This project is evolving. You may encounter bugs or frequent changes. Your feedback and contributions are welcome!
> This project is evolving. You may encounter bugs or frequent changes. Feedback and contributions are welcome!
Welcome to the **Prompt Library**. This repository contains a collection of AI prompts categorized for easy navigation and reuse. It is designed to be easily forked and customized for your own use, allowing you to create and maintain your personalized library of prompts tailored to your specific needs and use cases.
Welcome to the **Prompt Library**, a collection of categorized AI prompts for easy navigation and reuse. Fork and customize this repository to build your own personalized prompt library tailored to your needs.

## đź“š Table of Contents

<!-- toc -->

- [🎯 Purpose](#%F0%9F%8E%AF-purpose)
- [🛠️ How It Works](#%F0%9F%9B%A0%EF%B8%8F-how-it-works)
- [đź“‚ Prompt Library](#%F0%9F%93%82-prompt-library)
* [Coding](#coding)
* [Healthcare](#healthcare)
* [Problem Solving](#problem-solving)
* [Prompt Engineering](#prompt-engineering)
* [Translation](#translation)
* [Writing](#writing)
- [🚀 Getting Started](#%F0%9F%9A%80-getting-started)
- [🔧 Customizing Metadata Extraction](#%F0%9F%94%A7-customizing-metadata-extraction)
- [🧩 Using Fragments](#%F0%9F%A7%A9-using-fragments)
- [đź“ť Contributing](#%F0%9F%93%9D-contributing)
- [đź“„ License](#%F0%9F%93%84-license)

<!-- tocstop -->
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [🎯 Purpose](#-purpose)
- [🛠️ How It Works](#-how-it-works)
- [đź“‚ Prompt Library Example](#-prompt-library-example)
- [🚀 Getting Started](#-getting-started)
- [🔧 Customizing Metadata Extraction](#-customizing-metadata-extraction)
- [🧩 Using Fragments](#-using-fragments)
- [đź“ť Contributing](#-contributing)
- [đź“„ License](#-license)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## 🎯 Purpose

The primary goal of this project is to provide a structured framework for organizing and managing AI prompts. Whether you're a developer, researcher, or AI enthusiast, this library can help you:
This project provides a structured framework for organizing and managing AI prompts, helping you to:

1. Store and categorize your prompts efficiently
2. Automatically generate metadata for your prompts
Expand All @@ -39,177 +34,151 @@ The primary goal of this project is to provide a structured framework for organi

## 🛠️ How It Works

This repository uses a combination of user input and automated processes to manage your prompt library:

1. **Adding Prompts**: You create `prompt.md` files in the `prompts` directory to add new prompts to your library.

2. **Version Control**: You commit and push your changes to the repository.
User input and automated processes manage your prompt library:

3. **Automated Processing**: Once changes are pushed, GitHub Actions are triggered automatically:
- 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.
1. **Add Prompts**: Create `prompt.md` files in the `prompts` directory.
2. **Commit Changes**: Push your changes to the repository.
3. **Automation**: GitHub Actions:
- Generate metadata using `generate_metadata.ts` and the Anthropic API.
- Update `README.md` files using `update_views.ts`.
4. **Update Repository**: Changes are automatically committed back.

4. **Repository Updates**: All changes generated by the scripts are automatically committed back to the repository.
Monitor these processes in the "Actions" tab of your GitHub repository.

You can monitor the progress of these automated processes in the "Actions" tab of your GitHub repository. This tab shows you the status of all workflow runs, allowing you to track the progress of your changes and troubleshoot any issues that may arise.
## đź“‚ Prompt Library Example

## đź“‚ Prompt Library
> **Note:** The prompts listed here are examples to demonstrate structure and organization. Customize and maintain your own prompts as needed.
> **Note:** The prompts listed here serve as examples to demonstrate the structure and organization of this library. The primary goal is for you, the user, to create and maintain your own personalized library of prompts tailored to your specific needs and use cases. Feel free to modify, remove, or add prompts as you see fit.
> **Tip:** Check out the Prompt Engineering category for prompts to help you create high-quality prompts and build your own library.
<details open>
<summary><strong>Coding</strong></summary>
> **Tip:** Check out the Prompt Engineering category in this library. It contains prompts that can help you create high-quality prompts with ease and get started in building your own prompt library.
### Coding

- [Git Branch Name Generator](prompts/git_branch_name_generator/README.md) - Generates optimal git branch names based on project context and development requirements
- [Code Refactoring Agent](prompts/code_refactoring_agent/README.md) - Analyzes, refactors, and validates code to enhance quality, readability, and performance
- [Git Commit Message Expert](prompts/git_commit_message_agent/README.md) - Generates precise git commit messages following Conventional Commits specification
- [Coding Assistant Agent](prompts/coding_assistant_agent/README.md) - Assists in all aspects of software development across multiple programming languages
- [Code Refactoring Agent](prompts/code_refactoring_agent/README.md) - Analyzes, refactors, and validates code to enhance quality, readability, and performance
- [Git Branch Name Generator](prompts/git_branch_name_generator/README.md) - Generates optimal git branch names based on project context and development requirements
- [GitHub Issue Management Agent](prompts/github_issue_management_agent/README.md) - Creates comprehensive, optimized GitHub issues based on project context and team dynamics
- [Git Commit Message Expert](prompts/git_commit_message_agent/README.md) - Generates precise git commit messages following Conventional Commits specification
- [Software Specification Creator](prompts/software_spec_creator_agent/README.md) - Creates detailed software specification documents through interactive requirement analysis
- [Software Development Pull Request Generator](prompts/software_dev_pr_generator/README.md) - Generates comprehensive pull requests for software projects based on given context
- [Software Specification Creator](prompts/software_spec_creator_agent/README.md) - Creates detailed software specification documents through interactive requirement analysis

### Healthcare
</details>
<details open>
<summary><strong>Healthcare</strong></summary>

- [Health Optimization Agent](prompts/health_optimization_agent/README.md) - Generates personalized, evidence-based health optimization plans using comprehensive data analysis

### Problem Solving
</details>
<details open>
<summary><strong>Problem Solving</strong></summary>

- [Problem Solving Goal Achievement Agent](prompts/problem_solving_goal_agent/README.md) - Generates tailored expert networks and solutions for complex challenges and ambitious goals

### Prompt Engineering
</details>
<details open>
<summary><strong>Prompt Engineering</strong></summary>

- [AI Assistant Architect](prompts/ai_assistant_architect/README.md) - Generates innovative and practical concepts for specialized AI assistants
- [Prompt Engineering God](prompts/prompt_engineering_agent/README.md) - Crafts and refines optimized prompts for AI models using advanced techniques and guidelines

### Translation
</details>
<details open>
<summary><strong>Translation</strong></summary>

- [Universal Translator Agent](prompts/universal_translator_agent/README.md) - Translates between any languages, modes of expression, or conceptual frameworks

### Writing
</details>
<details open>
<summary><strong>Writing</strong></summary>

- [Software Documentation Specialist Agent](prompts/software_documentation_agent/README.md) - Creates comprehensive software documentation across various types and industries

## 🚀 Getting Started

To start building your own prompt library, follow these steps:
</details>

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.
## 🚀 Getting Started

2. **Clone Your Fork**: Clone the forked repository to your local machine using:
1. **Fork the Repository**: Click "Fork" to create a copy in your GitHub account.
2. **Clone Your Fork**:
```
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.

- In repository settings: **Secrets and variables** > **Actions**.
- Create a secret named `ANTHROPIC_API_KEY` with your API key.
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:
- Ensure Node.js (v22+ recommended) is installed.
- Run `npm install`.
5. **Add Prompts**:
- Create a `prompt.md` file in the `prompts` directory.
- Write your prompt content.
- Commit and push:
```
git add .
git commit -m "Add new prompt: [Brief Description]"
git push
```
6. **Let GitHub Actions Work**: The automated processes will generate metadata and update README files.
7. **Run Locally** (Optional):
- Copy the `.env.example` file to a new file named `.env` in the root directory of your project:
6. **Automated Processes**: GitHub Actions will generate metadata and update README files.
7. **Run Locally (Optional)**:
- Copy `.env.example` to `.env`:
```
cp .env.example .env
```
- Open the `.env` file and update the environment variables:
```
ANTHROPIC_API_KEY=your_actual_api_key_here
FORCE_REGENERATE=false
LOG_LEVEL=info
```
- To generate metadata for your prompts, run:
- Update `.env` with your API key.
- Generate metadata:
```
npm run generate-metadata
```
- To update the README files, run:
- Update README files:
```
npm run update-views
```
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.
- Modify templates in `src/templates` to change prompt display.
- Update scripts in `src/core` to alter metadata generation or view updates.
## 🔧 Customizing Metadata Extraction
The system prompt used to extract metadata from your prompts can be customized. This prompt is located at:
The system prompt for metadata extraction is 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 `<system_role>`, `<task>`, `<input_parameters>`, `<instructions>`, and `<output>`.
3. Modify the content within these sections to adjust the behavior of the metadata extraction process. For example:
- Update the `<instructions>` section to change how categories are assigned.
- Modify the `<output>` section to alter the structure of the generated metadata.
- Adapt the categories in the `Top-Level Categories` list to better suit your needs.
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.
To customize:
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.
1. Open `prompt.md` and modify sections like `<instructions>` or `<output>` to adjust metadata extraction.
2. Save your changes.
3. Run `npm run generate-metadata` to test.
4. Commit and push changes to trigger GitHub Actions.
> **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.
> **Note**: Changes affect future metadata generations. Test thoroughly.
## 🧩 Using Fragments
Fragments are reusable components that can be included in your prompts. They are designed for injection and reuse purposes, allowing you to create more elaborate prompt flows and tools. To use fragments in your prompt library:
Fragments are reusable prompt components.
1. **Create a new fragment**:
- Navigate to the `fragments` directory.
- Choose or create a subdirectory that matches the appropriate category (as listed in the system prompt analysis).
- Create a new Markdown file (`.md`) in this subdirectory with a descriptive name for your fragment.
- Write the content of your fragment in this file.
To use fragments:
2. **Add the fragment to your prompt**:
- In your prompt file, include the content of the fragment where you want to use it.
- You can reference the fragment using a placeholder or by directly copying its content, depending on your implementation.
3. **Update metadata and views**:
- After adding new fragments or modifying existing ones, you should refresh the metadata files and views.
- To update the metadata, run:
1. **Create a Fragment**:
- In `fragments`, create a subdirectory under the appropriate category.
- Create a new `.md` file with your fragment content.
2. **Add Fragment to a Prompt**:
- Include the fragment content in your prompt file.
3. **Update Metadata and Views**:
- Regenerate metadata:
```
FORCE_REGENERATE=true npm run generate-metadata
```
- This command forces the regeneration of metadata for all prompts, ensuring new fragments are detected.
- To refresh the views and README files, run:
- Update views:
```
npm run update-views
```
- The system will automatically detect and list the used fragments in each prompt's metadata during this process.
> **Note**: Forcing metadata regeneration can be costly in terms of API usage, especially for large libraries. This operation is not currently included in GitHub Actions to prevent unexpected costs. Consider running it locally or selectively when necessary.
4. **Selective updates**:
- If you only need to update specific prompts, you can manually edit the metadata files in the respective prompt directories.
- After manual edits, run `npm run update-views` to reflect the changes in the README files.
4. **Selective Updates**:
- Manually edit metadata files if needed.
- Run `npm run update-views` to reflect changes.
Remember that fragments are powerful tools for creating modular and reusable prompt components. They are particularly useful when building complex prompt flows or maintaining consistency across multiple prompts in your library.
> **Note**: Forcing metadata regeneration can be costly; consider running selectively.
## đź“ť 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.
Contributions to improve templates, scripts, or structure are welcome! Submit issues or pull requests.
## đź“„ License
Expand Down
Loading

0 comments on commit c10162d

Please sign in to comment.