diff --git a/README.md b/README.md index 0bad1b0..cccf240 100644 --- a/README.md +++ b/README.md @@ -1,382 +1,5 @@ # AI Driven Dev Community -![AI-Driven Dev Community FR](./images/aiddc.png) +La communautΓ© s'est agrandie ! -Our goal is to help you become a 10x developer by coding with AI. - -The GitHub Repository is updated weekly! - -**A collection of tools, prompts, snippets and agents for developers that use AI, daily.** - -πŸ‡«πŸ‡· More French resources are available to learn how to use AI in your daily work. - -[![5 meilleures resources IA pour dΓ©veloppeurs](https://img.shields.io/badge/-5%20resources%20AI%20pour%20devs-blue?style=for-the-badge)](https://learn.alexsoyes.com/ressources-ia?utm_source=github&utm_medium=cta-button&utm_campaign=free-ai-resources&utm_terms=ia) [![Discord](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/BUcTKVfbGh) - -
- -Get started easily with the **AI Driven Dev Community**: - -- [**0#** πŸš€ Get started](#0--get-started) - - [Best practices](#best-practices) - - [Tools to install](#tools-to-install) - - [Example workflow of an AI Driven Dev](#example-workflow-of-an-ai-driven-dev) -- [**1#** πŸ€– Custom AI for developers](#1--custom-ai-for-developers) - - [RAG Developer](#rag-developer) - - [Best Instructions](#best-instructions) - - [Custom GPT Agents](#custom-gpt-agents) -- [**2#** ⭐️ Developer prompts list](#2-️-developer-prompts-list) - - [Usage](#usage) - - [Installation](#installation) - - [Prompts for developers (in IDE)](#prompts-for-developers-in-ide) - - [Prompts for developers (in Chat)](#prompts-for-developers-in-chat) - - [Coding with AI CLI](#coding-with-ai-cli) -- [**3#** πŸ› οΈ Install AI Toolbox for software engineers](#3-️-install-ai-toolbox-for-software-engineers) - - [AIDDC Scripts](#aiddc-scripts) - - [Website scraper](#website-scraper) - - [Private prompts](#private-prompts) - - [VSCode snippets](#vscode-snippets) -- [**4#** ❀️ Get support](#4-️-get-support) - - [Discord](#discord) - - [✨ Courses (in french)](#-courses-in-french) - - [Links](#links) - - [AIDDC Video Demo (in french)](#aiddc-video-demo-in-french) -- [**5#** πŸš€ Super easy contribution](#5--super-easy-contribution) - - [5 steps to contribute in 2 minutes](#5-steps-to-contribute-in-2-minutes) - - [No -fork contributions](#no---fork-contributions) - -## **0#** πŸš€ Get started - -This repository is made to be easily updated by just editing the Readmes! - -### Best practices - -This is our best practices to use AI in your daily dev work: - -1. **Use AI for repetitive tasks** - Yes, AI can be sometimes slower or mistaken, but in the long run, it will save you time. -2. **Adopt at least 2 AI in your daily work** - One for coding, one for instructions. -3. **Pin ChatGPT or equivalent in your browser** - Or just install the desktop app to always have it available. -4. **Enforce daily AI code generation** - Use snippets, prompts, and instructions to make it a habit, EVERY-DAY. -5. **Open AI Chat in your IDE** - Use a plugin to have it available in your IDE. -6. **Check all the prompts available** - Use them, change them, embrase them the more you can. - -If you do follow these best practices, you will become a 10x Dev in no time. - -![VSCode Setup](images/vscode-setup.png) - -### Tools to install - -- [Espanso](https://espanso.org) - Text expander to use the prompts in your daily work. (Required * for the prompts) -- [ChatGPT](https://chat.openai.com) - AI to help you in your daily work. (Recommended) -- [GitHub Copilot](https://copilot.github.com) - AI to help you code faster. (Recommended) -- [Maccy](https://maccy.app) - OSX Clipboard manager to use the prompts easily. (Recommended) -- [VSCode](https://code.visualstudio.com) - Because Copilot AI features are available sooner in this IDE. (Recommended) - -Free and Paid alternatives are available for each tool. - -[![Best list of AI Tools for developers](https://img.shields.io/badge/-Notion%20List%20of%20best%20AI%20Tools%20for%20developers-purple?style=for-the-badge)](https://alexsoyes.notion.site/c858af13ed704d7184456a3f8ac21f07?v=79a8d07b1e414ced99fcd210970b2ee8) - -### Example workflow of an AI Driven Dev - -Here is a basic workflow of how you can combine prompts, parameters and AI instructions. - -![AIDD Workflow](images/aiddc-workflow.gif) - -## **1#** πŸ€– Custom AI for developers - -Custom instructions to transform an AI like ChatGPT into a RAG, now it became a member of your team that knows about the specs and the codebase. - -### RAG Developer - -Teach an AI to act as a Dev... from your own team - -"Fine-tune" the LLM using a RAG to act as a developer in your project. - -**This will help you to get the best out of the AI by providing it with the right context and knowledge about your project.** - -1. **Documents list to provide** - Upload the relevant documents to instruct the AI about your project. -2. **Create a RAG for your project** - Instructions for AI to act as a developer **from your team**, using your language etc. - -[Full page resource](./resources/llm-instructions/gpt-rag-developer.md) πŸ”— - -### Best Instructions - -Personalize the AI to have better performance and quicker answers. - -**This will help you to get the best out of the AI by providing it with the right context and knowledge about your project.** - -[Full page resource](./resources/llm-instructions/chatgpt-custom-instructions.md) πŸ”— - -### Custom GPT Agents - -Use those GPT agents to help you in your daily work. - -(Include instructions sources) - -- [Senior Dev](./resources/llm-instructions/gpt-senior-developer.md) -- [Agile Coach](./resources/llm-instructions/gpt-agile-coach.md) - -## **2#** ⭐️ Developer prompts list - -### Usage - -This repo is filled of **amazing prompt for developers**, mapped with my favorite text expander, [Espanso](https://espanso.org). -Use the prompts in your daily work: - -- Use a keyboard shortcut (like `:codeHelpMeThinking`) -- Or by using the dialog box (`βŒ₯ + SPACE` or `ALT + SPACE`) - -Basically, all prompts in the repository are available as an Espanso package. - -**This make it easy for every developer to use the prompts in their daily work.** - -### Installation - -Guide: - -1. Follow the [Espanso installation guide here](https://espanso.org/install/) for your operating system. - -2. Then, install the package: - - ```sh - espanso install ai-driven-dev-prompts --git git@github.com:alexsoyes/ai-driven-dev-community.git --external - ``` - -3. Configure the package from [config directory](https://espanso.org/docs/configuration/basics/#structure): - -From "`espanso path config`/default.yml": - - ```yml - # prevent "v" being pasted instead of the prompt - backend: "inject" - # allow to keep current prompt in clipboard - preserve_clipboard: false - # reload when config / package changes - auto_restart: true - # delay to paste the prompt - clipboard_threshold: 100 - ``` - -πŸ”„ **Note**: Update every time you want to get the latest prompts: - - ```sh - espanso package update ai-driven-dev-prompts - ``` - -### Prompts for developers (in IDE) - -Here are the best prompts to use in your IDE... Sorted! - -![VSCode Prompt trigger](images/vscode-espanso-code-inline-chat.gif) - -**Those prompts have been selected AND tested to help you in your daily work.** - -Feel free to use them and add your own! ❀️ (credit your own prompts) - -- πŸ› [Bug Fixing](./resources/prompts/bug-fixing.md) (*in progress*) -- πŸ•΅οΈβ€β™€οΈ [Code Review](./resources/prompts/code-review.md) (*in progress*) -- πŸ’» [Code Writing](./resources/prompts/code-writing.md) -- πŸ“š [Documentation](./resources/prompts/documentation.md) -- πŸ› οΈ [General Dev](./resources/prompts/dev.md) - Help to use AI in our daily work (but not specifically AI oriented). -- ♻️ [Refactoring](./resources/prompts/refactoring.md) (*in progress*) -- πŸ§ͺ [Testing](./resources/prompts/testing.md) - -More dev prompts: - -- Language Specific - - [TypeScript](./resources/prompts/languages/typescript.md) -- Private prompts - - [Your private (or team) prompts](./resources/prompts/private) - -### Prompts for developers (in Chat) - -Sometimes you need a bigger context to get the best out of your AI. - -![ChatGPT Prompt Trigger](images/chatgpt-espanso-text-trigger.gif) - -Use those dev prompts (mostly in ChatGPT or equivalent): - -- πŸ—ƒοΈ [Database](./resources/prompts/database.md) -- πŸ–ΌοΈ [Image to Code](./resources/prompts/image-to-code.md) -- πŸš€ [Feature Request](./resources/prompts/feature-request.md) -- πŸ“‹ [Project Management](./resources/prompts/project-management.md) -- 🚧 [Project Setup](./resources/prompts/project-setup.md) - -### Coding with AI CLI - -Use the CLI to code with the AI when you need to write in multiple files at once. - -- πŸ’Ύ [Guide - Coding with AI CLI (+ example script)](./resources/guide/coding-with-cli.md) - -![Aider - Split file](images/aider-split-file.gif) - -## **3#** πŸ› οΈ Install AI Toolbox for software engineers - -Clone this repo: `git clone git@github.com:alexsoyes/ai-driven-dev-community.git` - -You are all set! - -Requirements: - -- [Node.js](https://nodejs.org/en/download/) - To run the project. - -### AIDDC Scripts - -A set of scripts for developers that directly communicate with OpenAI's ChatGPT API. - -Full documentation available in the [scripts directory](./scripts/aiddc/README.md). - -Available aliases: - -- `aiddc-changes` : List the changes in the repository. -- `aiddc-changes-from-main` : List the changes in the repository from the main branch. -- `aiddc-commit-last` : Get the last commit message. -- `aiddc-commit-msg` : Generate a commit message (using AI). - -```bash -curl -sSf https://raw.githubusercontent.com/alexsoyes/ai-driven-dev-community/main/scripts/aiddc/install.sh | bash -``` - -### Website scraper - -A python scraper to save HTML / Markdown content from your best websites. - -Full documentation available in the [scraper directory](./scripts/scraper/README.md). - -Requirements: - -- [Python 3+](https://www.python.org/downloads/) - To run the scraper. - -### Private prompts - -Having your personal prompts in a huge Notion doc or shared with your team? - -**You can easily make them available privately in your computer with Espanso.** - -1. Add your prompts in `markdown`in the directory `./prompts/private/` -2. Take a look at the [contributing guide](./CONTRIBUTE.md) to create a perfect prompt. -3. Start the project: `npm i && npm start` - -Enjoy your private prompts! - -### VSCode snippets - -We created a list of snippets we daily use as a frontend TypeScript developer. - -![VSCode Snippet](images/vscode-snippet.gif) - -AI makes way much easier code generation. - -> But sometimes, when you exactly know what you need, you do not necessary need a Gen-AI to write obvious code for you. - -Thus, AI can be mistaken, as a developer, you are the master of your code structure. - -Feel free to use them! - -**Languages**: - -- [TypeScript](./resources/snippets/vscode/typescript.json) - -**Libraries**: - -- [React](./resources/snippets/vscode/typescriptreact.json) - -**Installation**: - -You can install them easily with the following script: - -```bash -#!/bin/bash - -# TODO: add OS support -# TODO: merge with existing files - -PATH_SOURCE=$(pwd)/vscode -PATH_DESTINATION=~/Library/Application\ Support/Code/User/snippets - -# Check if both source and destination exist -if [ ! -d "${PATH_SOURCE}" ]; then - echo "Source directory does not exist: ${PATH_SOURCE}" - exit 1 -fi - -if [ ! -d "${PATH_DESTINATION}" ]; then - echo "Destination directory does not exist: ${PATH_DESTINATION}" - exit 1 -fi - -# For each file in source, copy it in the destination, but if exists, rename it with a .bak extension and current date -for file in "${PATH_SOURCE}"/*; do - filename=$(basename $file) - if [ -f "${PATH_DESTINATION}/$filename" ]; then - mv "${PATH_DESTINATION}/$filename" "${PATH_DESTINATION}/$filename.bak.$(date +%Y%m%d)" - fi - - cp -v "${PATH_SOURCE}/${filename}" "${PATH_DESTINATION}/${filename}" -done - -# source: scripts/generated/snippets-install-osx.sh -``` - -## **4#** ❀️ Get support - -We are a group of french software engineers that are using AI in our daily work. - -### Discord - -Motivated to use AI in your daily developer work life? - -Join us on Discord to get the **latest updates, news and shared experiences** with AI. - -[![Discord](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/BUcTKVfbGh) - -### ✨ Courses (in french) - -French courses are available to learn how to use AI in your daily work. - -[![Formation "Coder avec l'IA"](https://img.shields.io/badge/-Formation%20%22Coder%20avec%20l%27IA%22-red?style=for-the-badge)](https://learn.alexsoyes.com/formation-coder-avec-ia?utm_source=github&utm_medium=cta-button&utm_campaign=formation-coder-avec-ia&utm_terms=ia) - -### Links - -Various links available that do not fit in other categories: - -**External**: - -- [Anthropic Prompt Library](https://docs.anthropic.com/en/prompt-library/website-wizard) - A collection of prompts to use with Claude. -- [LLMLingua](https://llmlingua.com) - Prompts compressing for accelerated inference. -- [GitHub: "Awesome Agents"](https://github.com/kyrolabs/awesome-agents) - A curated list of AI agents to use in your daily work. -- [GitHub: Copilot course from Microsoft](https://github.com/microsoft/Mastering-GitHub-Copilot-for-Paired-Programming) - Mastering GitHub Copilot for Paired Programming. - -**Internal**: - -- [GPTs source list for developers πŸ“‹](./resources/custom-gpts.md) (Include prompt source when available) -- [Various](./resources/prompts/_/various.md) - Various and personals prompts that do not fit in other categories. - -[![Best list of AI Tools for developers](https://img.shields.io/badge/-Notion%20List%20of%20best%20AI%20Tools%20for%20developers-purple?style=for-the-badge)](https://alexsoyes.notion.site/c858af13ed704d7184456a3f8ac21f07?v=79a8d07b1e414ced99fcd210970b2ee8) - -### AIDDC Video Demo (in french) - -Check the [Demo on YouTube](http://www.youtube.com/watch?v=1YvECxOn2_Q) to learn how to use our repository! - -[![AIDDC demo](images/aiddc-demo.png)](http://www.youtube.com/watch?v=1YvECxOn2_Q) - -## **5#** πŸš€ Super easy contribution - -This repository is made to be easily updated by just editing the Readmes! - -It will automatically update the prompts and the scripts. - -**If only one person updates one Readme, the whole community will benefit from it.** - -### 5 steps to contribute in 2 minutes - -1. [Fork the repository](https://github.com/alexsoyes/ai-driven-dev-community/fork), then clone it. -2. After installation, run `npm i && npx husky-init` if you want to **automatically**: -3. Update any Readme from sub-directories in `./resources` to automatically generate the prompts in Espanso and scripts generation! -4. Check the [Contributing guide](./CONTRIBUTE.md) -5. Push your changes and create a Pull Request. - -### No -fork contributions - -You can also contribute without forking the repository: - -Report prompting issues / improvements at [hello@alexsoyes.com](mailto:hello@alexsoyes.com) +**Retrouver dΓ©sormais la v2 du dΓ©pΓ΄t dans notre organisation [AI-Driven Dev](https://github.com/ai-driven-dev).** ❀️ diff --git a/README.old.md b/README.old.md new file mode 100644 index 0000000..0bad1b0 --- /dev/null +++ b/README.old.md @@ -0,0 +1,382 @@ +# AI Driven Dev Community + +![AI-Driven Dev Community FR](./images/aiddc.png) + +Our goal is to help you become a 10x developer by coding with AI. + +The GitHub Repository is updated weekly! + +**A collection of tools, prompts, snippets and agents for developers that use AI, daily.** + +πŸ‡«πŸ‡· More French resources are available to learn how to use AI in your daily work. + +[![5 meilleures resources IA pour dΓ©veloppeurs](https://img.shields.io/badge/-5%20resources%20AI%20pour%20devs-blue?style=for-the-badge)](https://learn.alexsoyes.com/ressources-ia?utm_source=github&utm_medium=cta-button&utm_campaign=free-ai-resources&utm_terms=ia) [![Discord](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/BUcTKVfbGh) + +
+ +Get started easily with the **AI Driven Dev Community**: + +- [**0#** πŸš€ Get started](#0--get-started) + - [Best practices](#best-practices) + - [Tools to install](#tools-to-install) + - [Example workflow of an AI Driven Dev](#example-workflow-of-an-ai-driven-dev) +- [**1#** πŸ€– Custom AI for developers](#1--custom-ai-for-developers) + - [RAG Developer](#rag-developer) + - [Best Instructions](#best-instructions) + - [Custom GPT Agents](#custom-gpt-agents) +- [**2#** ⭐️ Developer prompts list](#2-️-developer-prompts-list) + - [Usage](#usage) + - [Installation](#installation) + - [Prompts for developers (in IDE)](#prompts-for-developers-in-ide) + - [Prompts for developers (in Chat)](#prompts-for-developers-in-chat) + - [Coding with AI CLI](#coding-with-ai-cli) +- [**3#** πŸ› οΈ Install AI Toolbox for software engineers](#3-️-install-ai-toolbox-for-software-engineers) + - [AIDDC Scripts](#aiddc-scripts) + - [Website scraper](#website-scraper) + - [Private prompts](#private-prompts) + - [VSCode snippets](#vscode-snippets) +- [**4#** ❀️ Get support](#4-️-get-support) + - [Discord](#discord) + - [✨ Courses (in french)](#-courses-in-french) + - [Links](#links) + - [AIDDC Video Demo (in french)](#aiddc-video-demo-in-french) +- [**5#** πŸš€ Super easy contribution](#5--super-easy-contribution) + - [5 steps to contribute in 2 minutes](#5-steps-to-contribute-in-2-minutes) + - [No -fork contributions](#no---fork-contributions) + +## **0#** πŸš€ Get started + +This repository is made to be easily updated by just editing the Readmes! + +### Best practices + +This is our best practices to use AI in your daily dev work: + +1. **Use AI for repetitive tasks** - Yes, AI can be sometimes slower or mistaken, but in the long run, it will save you time. +2. **Adopt at least 2 AI in your daily work** - One for coding, one for instructions. +3. **Pin ChatGPT or equivalent in your browser** - Or just install the desktop app to always have it available. +4. **Enforce daily AI code generation** - Use snippets, prompts, and instructions to make it a habit, EVERY-DAY. +5. **Open AI Chat in your IDE** - Use a plugin to have it available in your IDE. +6. **Check all the prompts available** - Use them, change them, embrase them the more you can. + +If you do follow these best practices, you will become a 10x Dev in no time. + +![VSCode Setup](images/vscode-setup.png) + +### Tools to install + +- [Espanso](https://espanso.org) - Text expander to use the prompts in your daily work. (Required * for the prompts) +- [ChatGPT](https://chat.openai.com) - AI to help you in your daily work. (Recommended) +- [GitHub Copilot](https://copilot.github.com) - AI to help you code faster. (Recommended) +- [Maccy](https://maccy.app) - OSX Clipboard manager to use the prompts easily. (Recommended) +- [VSCode](https://code.visualstudio.com) - Because Copilot AI features are available sooner in this IDE. (Recommended) + +Free and Paid alternatives are available for each tool. + +[![Best list of AI Tools for developers](https://img.shields.io/badge/-Notion%20List%20of%20best%20AI%20Tools%20for%20developers-purple?style=for-the-badge)](https://alexsoyes.notion.site/c858af13ed704d7184456a3f8ac21f07?v=79a8d07b1e414ced99fcd210970b2ee8) + +### Example workflow of an AI Driven Dev + +Here is a basic workflow of how you can combine prompts, parameters and AI instructions. + +![AIDD Workflow](images/aiddc-workflow.gif) + +## **1#** πŸ€– Custom AI for developers + +Custom instructions to transform an AI like ChatGPT into a RAG, now it became a member of your team that knows about the specs and the codebase. + +### RAG Developer + +Teach an AI to act as a Dev... from your own team + +"Fine-tune" the LLM using a RAG to act as a developer in your project. + +**This will help you to get the best out of the AI by providing it with the right context and knowledge about your project.** + +1. **Documents list to provide** - Upload the relevant documents to instruct the AI about your project. +2. **Create a RAG for your project** - Instructions for AI to act as a developer **from your team**, using your language etc. + +[Full page resource](./resources/llm-instructions/gpt-rag-developer.md) πŸ”— + +### Best Instructions + +Personalize the AI to have better performance and quicker answers. + +**This will help you to get the best out of the AI by providing it with the right context and knowledge about your project.** + +[Full page resource](./resources/llm-instructions/chatgpt-custom-instructions.md) πŸ”— + +### Custom GPT Agents + +Use those GPT agents to help you in your daily work. + +(Include instructions sources) + +- [Senior Dev](./resources/llm-instructions/gpt-senior-developer.md) +- [Agile Coach](./resources/llm-instructions/gpt-agile-coach.md) + +## **2#** ⭐️ Developer prompts list + +### Usage + +This repo is filled of **amazing prompt for developers**, mapped with my favorite text expander, [Espanso](https://espanso.org). +Use the prompts in your daily work: + +- Use a keyboard shortcut (like `:codeHelpMeThinking`) +- Or by using the dialog box (`βŒ₯ + SPACE` or `ALT + SPACE`) + +Basically, all prompts in the repository are available as an Espanso package. + +**This make it easy for every developer to use the prompts in their daily work.** + +### Installation + +Guide: + +1. Follow the [Espanso installation guide here](https://espanso.org/install/) for your operating system. + +2. Then, install the package: + + ```sh + espanso install ai-driven-dev-prompts --git git@github.com:alexsoyes/ai-driven-dev-community.git --external + ``` + +3. Configure the package from [config directory](https://espanso.org/docs/configuration/basics/#structure): + +From "`espanso path config`/default.yml": + + ```yml + # prevent "v" being pasted instead of the prompt + backend: "inject" + # allow to keep current prompt in clipboard + preserve_clipboard: false + # reload when config / package changes + auto_restart: true + # delay to paste the prompt + clipboard_threshold: 100 + ``` + +πŸ”„ **Note**: Update every time you want to get the latest prompts: + + ```sh + espanso package update ai-driven-dev-prompts + ``` + +### Prompts for developers (in IDE) + +Here are the best prompts to use in your IDE... Sorted! + +![VSCode Prompt trigger](images/vscode-espanso-code-inline-chat.gif) + +**Those prompts have been selected AND tested to help you in your daily work.** + +Feel free to use them and add your own! ❀️ (credit your own prompts) + +- πŸ› [Bug Fixing](./resources/prompts/bug-fixing.md) (*in progress*) +- πŸ•΅οΈβ€β™€οΈ [Code Review](./resources/prompts/code-review.md) (*in progress*) +- πŸ’» [Code Writing](./resources/prompts/code-writing.md) +- πŸ“š [Documentation](./resources/prompts/documentation.md) +- πŸ› οΈ [General Dev](./resources/prompts/dev.md) - Help to use AI in our daily work (but not specifically AI oriented). +- ♻️ [Refactoring](./resources/prompts/refactoring.md) (*in progress*) +- πŸ§ͺ [Testing](./resources/prompts/testing.md) + +More dev prompts: + +- Language Specific + - [TypeScript](./resources/prompts/languages/typescript.md) +- Private prompts + - [Your private (or team) prompts](./resources/prompts/private) + +### Prompts for developers (in Chat) + +Sometimes you need a bigger context to get the best out of your AI. + +![ChatGPT Prompt Trigger](images/chatgpt-espanso-text-trigger.gif) + +Use those dev prompts (mostly in ChatGPT or equivalent): + +- πŸ—ƒοΈ [Database](./resources/prompts/database.md) +- πŸ–ΌοΈ [Image to Code](./resources/prompts/image-to-code.md) +- πŸš€ [Feature Request](./resources/prompts/feature-request.md) +- πŸ“‹ [Project Management](./resources/prompts/project-management.md) +- 🚧 [Project Setup](./resources/prompts/project-setup.md) + +### Coding with AI CLI + +Use the CLI to code with the AI when you need to write in multiple files at once. + +- πŸ’Ύ [Guide - Coding with AI CLI (+ example script)](./resources/guide/coding-with-cli.md) + +![Aider - Split file](images/aider-split-file.gif) + +## **3#** πŸ› οΈ Install AI Toolbox for software engineers + +Clone this repo: `git clone git@github.com:alexsoyes/ai-driven-dev-community.git` + +You are all set! + +Requirements: + +- [Node.js](https://nodejs.org/en/download/) - To run the project. + +### AIDDC Scripts + +A set of scripts for developers that directly communicate with OpenAI's ChatGPT API. + +Full documentation available in the [scripts directory](./scripts/aiddc/README.md). + +Available aliases: + +- `aiddc-changes` : List the changes in the repository. +- `aiddc-changes-from-main` : List the changes in the repository from the main branch. +- `aiddc-commit-last` : Get the last commit message. +- `aiddc-commit-msg` : Generate a commit message (using AI). + +```bash +curl -sSf https://raw.githubusercontent.com/alexsoyes/ai-driven-dev-community/main/scripts/aiddc/install.sh | bash +``` + +### Website scraper + +A python scraper to save HTML / Markdown content from your best websites. + +Full documentation available in the [scraper directory](./scripts/scraper/README.md). + +Requirements: + +- [Python 3+](https://www.python.org/downloads/) - To run the scraper. + +### Private prompts + +Having your personal prompts in a huge Notion doc or shared with your team? + +**You can easily make them available privately in your computer with Espanso.** + +1. Add your prompts in `markdown`in the directory `./prompts/private/` +2. Take a look at the [contributing guide](./CONTRIBUTE.md) to create a perfect prompt. +3. Start the project: `npm i && npm start` + +Enjoy your private prompts! + +### VSCode snippets + +We created a list of snippets we daily use as a frontend TypeScript developer. + +![VSCode Snippet](images/vscode-snippet.gif) + +AI makes way much easier code generation. + +> But sometimes, when you exactly know what you need, you do not necessary need a Gen-AI to write obvious code for you. + +Thus, AI can be mistaken, as a developer, you are the master of your code structure. + +Feel free to use them! + +**Languages**: + +- [TypeScript](./resources/snippets/vscode/typescript.json) + +**Libraries**: + +- [React](./resources/snippets/vscode/typescriptreact.json) + +**Installation**: + +You can install them easily with the following script: + +```bash +#!/bin/bash + +# TODO: add OS support +# TODO: merge with existing files + +PATH_SOURCE=$(pwd)/vscode +PATH_DESTINATION=~/Library/Application\ Support/Code/User/snippets + +# Check if both source and destination exist +if [ ! -d "${PATH_SOURCE}" ]; then + echo "Source directory does not exist: ${PATH_SOURCE}" + exit 1 +fi + +if [ ! -d "${PATH_DESTINATION}" ]; then + echo "Destination directory does not exist: ${PATH_DESTINATION}" + exit 1 +fi + +# For each file in source, copy it in the destination, but if exists, rename it with a .bak extension and current date +for file in "${PATH_SOURCE}"/*; do + filename=$(basename $file) + if [ -f "${PATH_DESTINATION}/$filename" ]; then + mv "${PATH_DESTINATION}/$filename" "${PATH_DESTINATION}/$filename.bak.$(date +%Y%m%d)" + fi + + cp -v "${PATH_SOURCE}/${filename}" "${PATH_DESTINATION}/${filename}" +done + +# source: scripts/generated/snippets-install-osx.sh +``` + +## **4#** ❀️ Get support + +We are a group of french software engineers that are using AI in our daily work. + +### Discord + +Motivated to use AI in your daily developer work life? + +Join us on Discord to get the **latest updates, news and shared experiences** with AI. + +[![Discord](https://img.shields.io/badge/Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/BUcTKVfbGh) + +### ✨ Courses (in french) + +French courses are available to learn how to use AI in your daily work. + +[![Formation "Coder avec l'IA"](https://img.shields.io/badge/-Formation%20%22Coder%20avec%20l%27IA%22-red?style=for-the-badge)](https://learn.alexsoyes.com/formation-coder-avec-ia?utm_source=github&utm_medium=cta-button&utm_campaign=formation-coder-avec-ia&utm_terms=ia) + +### Links + +Various links available that do not fit in other categories: + +**External**: + +- [Anthropic Prompt Library](https://docs.anthropic.com/en/prompt-library/website-wizard) - A collection of prompts to use with Claude. +- [LLMLingua](https://llmlingua.com) - Prompts compressing for accelerated inference. +- [GitHub: "Awesome Agents"](https://github.com/kyrolabs/awesome-agents) - A curated list of AI agents to use in your daily work. +- [GitHub: Copilot course from Microsoft](https://github.com/microsoft/Mastering-GitHub-Copilot-for-Paired-Programming) - Mastering GitHub Copilot for Paired Programming. + +**Internal**: + +- [GPTs source list for developers πŸ“‹](./resources/custom-gpts.md) (Include prompt source when available) +- [Various](./resources/prompts/_/various.md) - Various and personals prompts that do not fit in other categories. + +[![Best list of AI Tools for developers](https://img.shields.io/badge/-Notion%20List%20of%20best%20AI%20Tools%20for%20developers-purple?style=for-the-badge)](https://alexsoyes.notion.site/c858af13ed704d7184456a3f8ac21f07?v=79a8d07b1e414ced99fcd210970b2ee8) + +### AIDDC Video Demo (in french) + +Check the [Demo on YouTube](http://www.youtube.com/watch?v=1YvECxOn2_Q) to learn how to use our repository! + +[![AIDDC demo](images/aiddc-demo.png)](http://www.youtube.com/watch?v=1YvECxOn2_Q) + +## **5#** πŸš€ Super easy contribution + +This repository is made to be easily updated by just editing the Readmes! + +It will automatically update the prompts and the scripts. + +**If only one person updates one Readme, the whole community will benefit from it.** + +### 5 steps to contribute in 2 minutes + +1. [Fork the repository](https://github.com/alexsoyes/ai-driven-dev-community/fork), then clone it. +2. After installation, run `npm i && npx husky-init` if you want to **automatically**: +3. Update any Readme from sub-directories in `./resources` to automatically generate the prompts in Espanso and scripts generation! +4. Check the [Contributing guide](./CONTRIBUTE.md) +5. Push your changes and create a Pull Request. + +### No -fork contributions + +You can also contribute without forking the repository: + +Report prompting issues / improvements at [hello@alexsoyes.com](mailto:hello@alexsoyes.com) diff --git a/ai-driven-dev-prompts/_manifest.yml b/ai-driven-dev-prompts/_manifest.yml index 3f83ab4..0149b58 100644 --- a/ai-driven-dev-prompts/_manifest.yml +++ b/ai-driven-dev-prompts/_manifest.yml @@ -1,6 +1,6 @@ name: 'ai-driven-dev-prompts' title: 'AI Driven Dev Prompts' description: The best collection of prompts for developers. -version: 0.3.86 +version: 0.3.87 author: alexsoyes website: https://alexsoyes.com diff --git a/ai-driven-dev-prompts/package.yml b/ai-driven-dev-prompts/package.yml index 6d62c0c..b82cc39 100644 --- a/ai-driven-dev-prompts/package.yml +++ b/ai-driven-dev-prompts/package.yml @@ -113,15 +113,36 @@ matches: If not, list the potential issues in bullet points and suggest possible solutions. - trigger: ':reviewCreatePullRequest' form: | - Goal: Create a pull request for my changes. + Goal: + Create a pull request for my changes. Rules: - - Use the following template file: #file - - "AI instruction" comments are hints for you, follow them carefully, then, delete them. - - Here are the changes: - [[copy_your_git_changes_from_main_here]] + - Use the changes from main. + - Fill the "template" file to create the PR (the "output"). + - "Instructions" comments must be followed no matter what. + - "Instructions" comments must be remove from the output. + - Output should be properly formatted in markdown. + + Template (surrounded by `---`): + --- + [[copy_your_pr_template_here__use_githubpull_request_templatemd_if_needed]] + --- + + Commits (surrounded by `---`): + --- + [[commits_list_from_main_here__use_aiddccommitsdiffmain]] + --- + + Code changes (surrendered by `---`): + --- + [[copy_your_git_changes_from_main_here__use_aiddcchangesfrommain]] + --- form_fields: - copy_your_git_changes_from_main_here: + copy_your_pr_template_here__use_githubpull_request_templatemd_if_needed: + multiline: true + commits_list_from_main_here__use_aiddccommitsdiffmain: + multiline: true + copy_your_git_changes_from_main_here__use_aiddcchangesfrommain: multiline: true - trigger: ':codeApplyStructure' @@ -1136,7 +1157,20 @@ matches: Add in relevant component elements from #selection a "data-testid" if not already present. - trigger: ':testCreateNewFakeTestObject' form: | - Without importing, create new fake filled object for every required properties of this file: #file + Goal: + List every untested behaviors for all the tests provided. + + Rules: + - List every behavior that is not tested yet from every test files. + - Provide bullet list of untested behaviors that will be written in "should" format. + - Group those behaviors, by providing the files where the test should be written. + - Focus on behavior, not on technical details. + + Test files to check: + #file + + Implementations to test: + #file - trigger: ':testFillTestCases' form: "Fill every empty tests in file #file\nCode implementation to test:\_#file\n\nRules:\n- Arrange fake data with valid ones (mock or stub if necessary) based on required properties of objects:\_#file\n- Act to test logic.\n- Assert that the result is expected.\n" - trigger: ':testMockFunction' @@ -1351,3 +1385,4 @@ matches: + diff --git a/package-lock.json b/package-lock.json index d9ef020..da34a9f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ai-driven-dev-community", - "version": "0.3.86", + "version": "0.3.87", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ai-driven-dev-community", - "version": "0.3.86", + "version": "0.3.87", "dependencies": { "markdown-it": "^14.0.0", "yaml": "^2.3.4" diff --git a/package.json b/package.json index c8a4fc7..8feed7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ai-driven-dev-community", - "version": "0.3.86", + "version": "0.3.87", "description": "From prompts in Readme to Espanso text expander!", "main": "index.js", "directories": { diff --git a/resources/prompts/code-review.md b/resources/prompts/code-review.md index ba4f610..b51fb41 100644 --- a/resources/prompts/code-review.md +++ b/resources/prompts/code-review.md @@ -85,11 +85,28 @@ Create a pull request from an AI template (eg: using `.github/pull_request_templ **Prompt**: ```text -Goal: Create a pull request for my changes. +Goal: +Create a pull request for my changes. Rules: -- Use the following template file: #file -- "AI instruction" comments are hints for you, follow them carefully, then, delete them. -- Here are the changes: -[[Copy your git changes (from main?) here]] +- Use the changes from main. +- Fill the "template" file to create the PR (the "output"). +- "Instructions" comments must be followed no matter what. +- "Instructions" comments must be remove from the output. +- Output should be properly formatted in markdown. + +Template (surrounded by `---`): +--- +[[Copy your PR template here - use: .github/pull_request_template.md if needed]] +--- + +Commits (surrounded by `---`): +--- +[[commits list (from main?) here - use: aiddc-commits-diff-main]] +--- + +Code changes (surrendered by `---`): +--- +[[Copy your git changes (from main?) here - use: aiddc-changes-from-main]] +--- ``` diff --git a/resources/prompts/testing.md b/resources/prompts/testing.md index 72548b9..bc27185 100644 --- a/resources/prompts/testing.md +++ b/resources/prompts/testing.md @@ -20,7 +20,8 @@ This document contains a list of prompts for developers that can be used to gene - [Generate new data-testid `:testGenerateNewDataTestId`](#generate-new-data-testid-testgeneratenewdatatestid) - [Create](#create) - [Create new test object with "fake" properties `:testCreateNewFakeTestObject`](#create-new-test-object-with-fake-properties-testcreatenewfaketestobject) - - [Fill](#fill) + - [Fill / Add](#fill--add) + - [List untested behaviors](#list-untested-behaviors) - [Fill empty test cases expectations `:testFillTestCases`](#fill-empty-test-cases-expectations-testfilltestcases) - [Mock](#mock) - [Mock function from file `:testMockFunction`](#mock-function-from-file-testmockfunction) @@ -343,7 +344,42 @@ Super useful to generate a fake object with all properties filled. Without importing, create new fake filled object for every required properties of this file: #file ``` -### Fill +### Fill / Add + +### List untested behaviors + +**Description**: + +List untested behaviors from some test files. + +The idea is to have a list of behaviors that are not tested yet. + +**How to use the prompt**: + +| Usage | Context | +|-------------------------|------------------------------------------------------------| +| πŸš€ **Author** | [@alexsoyes](https://beacons.ai/alexsoyes) | +| πŸ€– **Tool** | Github Copilot | +| πŸ” **Context** | Some tests exist but some are missing. | + +**Prompt**: + +```text +Goal: +List every untested behaviors for all the tests provided. + +Rules: +- List every behavior that is not tested yet from every test files. +- Provide bullet list of untested behaviors that will be written in "should" format. +- Group those behaviors, by providing the files where the test should be written. +- Focus on behavior, not on technical details. + +Test files to check: +#file + +Implementations to test: +#file +``` #### Fill empty test cases expectations `:testFillTestCases` diff --git a/scripts/aiddc/.env.example b/scripts/aiddc/.env.example index 7da0bbe..2da6d7f 100644 --- a/scripts/aiddc/.env.example +++ b/scripts/aiddc/.env.example @@ -1,5 +1,8 @@ -# OpenAI API key -OPENAI_API_KEY="YOUR_API_KEY" +# Local LLM +LOCAL_MODEL=qwen2 -# Development purpose +# OpenAI LLM +OPENAI_API_KEY=YOUR_API_KEY + +# Config DEBUG=false diff --git a/scripts/aiddc/README.md b/scripts/aiddc/README.md index b4ff009..aa9a706 100644 --- a/scripts/aiddc/README.md +++ b/scripts/aiddc/README.md @@ -4,6 +4,7 @@ A list of aliases and pre-written scripts to help you inject AI into your dev wo - [Installation](#installation) - [Configuration](#configuration) + - [Ollama support](#ollama-support) - [Guide](#guide) - [Available Commands](#available-commands) - [Ops](#ops) @@ -33,6 +34,16 @@ Or directly in your `.bashrc` file. export OPENAI_API_KEY=sk- ``` +### Ollama support + +If you want to use Ollama, you need to provide the following environment variables. + +```bash +LOCAL_MODEL=codellama # deepseek-coder, qwen2 etc. +``` + +Note: Responses might be way less effective than OpenAI's GPT calls. + ## Guide Use `aiddc-` to run our scripts. diff --git a/scripts/aiddc/aliases.sh b/scripts/aiddc/aliases.sh index 8005538..266e918 100644 --- a/scripts/aiddc/aliases.sh +++ b/scripts/aiddc/aliases.sh @@ -9,6 +9,7 @@ alias aiddc-review='~/.aiddc/scripts/aidd-review.sh' # Commits alias aiddc-commit-msg='~/.aiddc/scripts/aidd-commit-msg.sh' alias aiddc-commit-last='~/.aiddc/scripts/aidd-commit-last.sh' +alias aiddc-commits-diff-main='~/.aiddc/scripts/aidd-commits-diff-main.sh' # Scripts alias aiddc-changes='~/.aiddc/scripts/aidd-changes.sh' diff --git a/scripts/aiddc/main.js b/scripts/aiddc/main.js index 397d145..897a46f 100644 --- a/scripts/aiddc/main.js +++ b/scripts/aiddc/main.js @@ -4,10 +4,6 @@ * It reads environment variables, validates the OpenAI API key, and provides functions to call the OpenAI API. */ -// const fs = require('fs'); -// const path = require('path'); -// const https = require('https'); -// const readline = require('readline'); import path from 'path'; import { fileURLToPath } from 'url'; @@ -16,10 +12,10 @@ const __dirname = fileURLToPath(new URL('.', import.meta.url)); import clipboardy from 'clipboardy'; import fs from 'fs'; +import http from 'http'; import https from 'https'; import readline from 'readline'; -// Redefine console.error to always print in red console.error = (function(origError) { return function(...args) { origError('\x1b[31m', ...args, '\x1b[0m'); @@ -32,7 +28,6 @@ console.warn = (function(origWarn) { }; })(console.warn); - console.info = (function(origInfo) { return function(...args) { origInfo('\x1b[32m', ...args, '\x1b[0m'); @@ -58,23 +53,88 @@ const loadEnv = () => { loadEnv(); -// Exit if OPENAI_API_KEY is not set -if (!process.env.OPENAI_API_KEY) { - console.error('OPENAI_API_KEY is not set. Please set it to your OpenAI API key.'); - console.error('You can find it in your OpenAI dashboard: https://platform.openai.com/api-keys'); - process.exit(1); -} - // Gen-AI parameters -const GEN_AI_MODEL = 'gpt-4o'; +const GEN_AI_MODEL = process.env.LOCAL_MODEL || 'gpt-4o'; const GEN_AI_MAX_TOKENS = 600; -const GEN_AI_TEMPERATURE = 0.7; +const GEN_AI_TEMPERATURE = 1; const GEN_AI_SYSTEM_MESSAGE = ` Act as a Senior Software Engineer that is experienced in software craft. Assist with high-quality, concise, efficient, and scalable software solutions. -Limit the response to minimum tokens. +Limit the response to minimum tokens when possible. + +Remember that code that will be provided to you is the result of a "git diff" command. +"-" means that a line was removed, and "+" means that a line was added, etc. `; +/** + * Calls the Ollama API with a specified prompt and model. + * + * This function sends a POST request to the Ollama API endpoint, submitting a JSON payload + * that includes the model and input data. It logs the API response to the console. + * + * @param {string} prompt - The input data to be processed by the Ollama API. + * @param {string} [model=GEN_AI_MODEL] - The model to use for processing the input. Defaults to GEN_AI_MODEL. + */ +function callOllamaApi(prompt, model=GEN_AI_MODEL) { + + const cleanPrompt = prompt.replace(/[^\x20-\x7E\t]/g, ''); + + const data = JSON.stringify({ + model, + prompt: cleanPrompt, + system: GEN_AI_SYSTEM_MESSAGE, + stream: false, + options: { + temperature: GEN_AI_TEMPERATURE, + }, + keep_alive: '0', + }); + + const options = { + hostname: '127.0.0.1', + port: 11434, + path: '/api/generate', + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Content-Length': data.length + } + }; + + return new Promise((resolve, reject) => { + const req = http.request(options, (res) => { + let responseBody = ''; + + res.on('data', (chunk) => { + responseBody += chunk; + }); + + res.on('end', () => { + const parsedResponse = JSON.parse(responseBody); + + if (parsedResponse.error) { + return reject(new Error(parsedResponse.error)); + } + + console.log(parsedResponse) + console.log(`\n🚚 Usage:`); + console.warn(`--------------------\n`); + console.warn(`Loading time: ${(parsedResponse.total_duration / 1000000000).toFixed(2)} seconds.`); + console.warn(`Number of tokens in prompt: ${parsedResponse.prompt_eval_count}.`); + console.warn(`--------------------\n`); + resolve(parsedResponse.response); + }); + }) + + req.on('error', (error) => { + console.error('Error:', error); + }); + + req.write(data); + req.end(); + }); +} + /** * Calls the OpenAI API with the provided parameters. * @param {string} systemMessage - The system message to send to the API. @@ -83,7 +143,15 @@ Limit the response to minimum tokens. * @param {number} [temperature=GEN_AI_TEMPERATURE] - The temperature to use for the generation. * @returns {Promise} - The response message content from the API. */ -const callOpenAiApi = async (systemMessage, prompt, maxTokens = GEN_AI_MAX_TOKENS, temperature = GEN_AI_TEMPERATURE) => { +const callOpenAiApi = async (prompt, systemMessage = GEN_AI_SYSTEM_MESSAGE, maxTokens = GEN_AI_MAX_TOKENS, temperature = GEN_AI_TEMPERATURE) => { + + // Exit if OPENAI_API_KEY is not set + if (!process.env.OPENAI_API_KEY) { + console.error('OPENAI_API_KEY is not set. Please set it to your OpenAI API key.'); + console.error('You can find it in your OpenAI dashboard: https://platform.openai.com/api-keys'); + process.exit(1); + } + const cleanSystemMessage = systemMessage.replace(/[^\x20-\x7E\t]/g, ''); const cleanPrompt = prompt.replace(/[^\x20-\x7E\t]/g, ''); @@ -174,7 +242,7 @@ const openaiApiCalculateCost = (usage, model = GEN_AI_MODEL) => { console.warn(`Prompt: ${usage.prompt_tokens.toLocaleString()} tokens`); console.warn(`Completion: ${usage.completion_tokens.toLocaleString()} tokens`); console.warn(`Total: ${usage.total_tokens.toLocaleString()} tokens`); - console.warn(`Cost for ${model}: $${parseFloat(totalCost).toFixed(4)}\n`); + console.warn(`Cost for ${model}: $${parseFloat(totalCost).toFixed(2)}\n`); console.warn(`--------------------\n`); return parseFloat(totalCost); @@ -183,8 +251,9 @@ const openaiApiCalculateCost = (usage, model = GEN_AI_MODEL) => { /** * Asks the AI a question. * @param {string} prompt - The prompt to send to the AI. + * @param {Function} callableAPI - The API function to call. */ -const askAi = async (prompt) => { +const askAi = async (prompt, callableAPI) => { console.log(`\nπŸ“ Prompt:`); console.log(`--------------------`); console.warn(prompt); @@ -210,7 +279,7 @@ const askAi = async (prompt) => { } try { - const response = await callOpenAiApi(GEN_AI_SYSTEM_MESSAGE, prompt); + const response = await callableAPI(prompt); console.log("πŸ€– Answer from AI:"); console.warn(`\n--------------------\n${response}\n--------------------\n`); } catch (error) { @@ -220,27 +289,6 @@ const askAi = async (prompt) => { }); }; -/** - * Parses command-line arguments. - * @returns {{ 'no-validate': boolean }} - The parsed arguments as key-value pairs. - */ -const parseArgs = () => { - const args = process.argv.slice(2); - const parsedArgs = {}; - - args.forEach(arg => { - const [key, value] = arg.split('='); - parsedArgs[key.replace(/^--/, '')] = value; - }); - - return parsedArgs; -}; - -/** - * Parses command-line arguments and calls the OpenAI API. - */ -const argv = parseArgs(); - console.log(` _____ _____ _____ _____ /\ |_ _| __ \| __ \ / ____| @@ -274,19 +322,19 @@ for (const file of aiddFiles) { const promptFilePath = path.join(__dirname, '/.prompt'); +let callableAPI = null; + +if (process.env.LOCAL_MODEL) { + console.log('\nπŸ€– Loading local model: ' + process.env.LOCAL_MODEL); + callableAPI = callOllamaApi; +} else { + console.log('\nπŸ€– Using OpenAI API!'); + callableAPI = callOpenAiApi; +} + if (fs.existsSync(promptFilePath)) { const promptContent = fs.readFileSync(promptFilePath, 'utf-8'); - // Proceed with the rest of the logic - if (argv['no-validate'] === 'true') { - callOpenAiApi(GEN_AI_SYSTEM_MESSAGE, promptContent) - .then(response => console.log(response)) - .catch(error => { - console.error(error.message); - process.exit(1); - }); - } else { - askAi(promptContent); - } + askAi(promptContent, callableAPI); } else { console.error('.prompt file not found. Exiting.'); process.exit(1); diff --git a/scripts/aiddc/scripts/aidd-commit-msg.sh b/scripts/aiddc/scripts/aidd-commit-msg.sh index adf9fbb..27a8221 100644 --- a/scripts/aiddc/scripts/aidd-commit-msg.sh +++ b/scripts/aiddc/scripts/aidd-commit-msg.sh @@ -12,20 +12,44 @@ notice "[aidd-commit-msg]: Preparing commit message" PREV_COMMIT_MSG=$(git log -10 --pretty=format:%s) # Current staged git changes. -CHANGES=$(git diff --staged) +CHANGES=$(git diff) +CURRENT_DIR=$(pwd) # If there is no changes, exit. if [ -z "$CHANGES" ]; then error "No changes to commit" - echo "Please stage your changes before generating a commit message." + echo "Please UNSTAGE changes before generating a commit message." exit 1 fi +# FUNCTION +# -------------------- +created_files_prompt() { + + local UNTRACKED=$(git ls-files --others --exclude-standard) + + if [ -z "$UNTRACKED" ]; then + return + fi + + echo "Created files:" + + for file in $UNTRACKED; do + echo "---" + echo "$file" + cat "$file" + echo "---" + echo "" + done +} + # PROMPT # -------------------- PROMPT=$(cat <