From 7304afc306c54c138ac69a536fd08529d9a17712 Mon Sep 17 00:00:00 2001 From: Carlos Villanueva Date: Sun, 22 Dec 2024 13:47:20 -0500 Subject: [PATCH 1/4] Adding .cursorrules example + added to .gitignore --- .cursorrules.example | 37 +++++++++++++++++++++++++++++++++++++ .gitignore | 6 +++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .cursorrules.example diff --git a/.cursorrules.example b/.cursorrules.example new file mode 100644 index 00000000..21030ba2 --- /dev/null +++ b/.cursorrules.example @@ -0,0 +1,37 @@ +# [PROJECT NAME] + +## PROJECT DESCRIPTION +- [PROJECT DESCRIPTION - What is the goal of the project? What is the purpose of the project?] + +## AI AGENT ROLE +- [AI AGENT ROLE - What is the role of the AI agent? What is the goal of the AI agent? Example ↴] +- You are a senior software engineer with great experience in [PROJECT LANGUAGE] and [PROJECT TECHNOLOGY]. +- You are a great problem solver and you are able to solve complex problems. + +## CODING STYLE AND STRUCTURE +- [How do you want the agent to write the code? What is the coding style and structure?] +- Prefer iteration and modularization over code duplication +- Use descriptive variable names with auxiliary verbs +- Write concise, technical TypeScript code with accurate examples + +## Error Handling +- [How do you want the agent to handle errors?] +- Implement proper error boundaries +- Log errors appropriately for debugging +- Provide user-friendly error messages +- Handle network failures gracefully + +## Testing +- [How do you want the agent to handle testing?] +- Write unit tests for utilities and components +- Implement E2E tests for critical flows +- Test across different Chrome versions +- Test memory usage and performance + +## Security +- [How do you want the agent to handle security?] +- Implement Content Security Policy +- Sanitize user inputs +- Handle sensitive data properly +- Follow Chrome extension security best practices +- Implement proper CORS handling \ No newline at end of file diff --git a/.gitignore b/.gitignore index d3f91bea..43518810 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,8 @@ yarn-error.log* .env.sentry-build-plugin # BaseHub -.basehub \ No newline at end of file +.basehub + +# AI Rules +.cursorrules +.github/copilot-instructions.md From 9718456846be862779a40105015290b47cadf996 Mon Sep 17 00:00:00 2001 From: Carlos Villanueva Date: Sun, 22 Dec 2024 15:21:03 -0500 Subject: [PATCH 2/4] draft of ai (cursor/copilot) rules Documentation --- docs/features/ai.mdx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/features/ai.mdx b/docs/features/ai.mdx index c1b801a3..474d6e20 100644 --- a/docs/features/ai.mdx +++ b/docs/features/ai.mdx @@ -127,3 +127,27 @@ export const provider = createAnthropic({ apiKey: env.ANTHROPIC_API_KEY, }); ``` + +## Customizing the AI agent rules + +To those that use Cursor or GitHub Copilot - You can customize the AI agent rules by updating the respected file listed below. For context, each chat response will read through the file and repspond with a more currated response based on your rules. It is important to + +> **Important:** +> Keep your instructions short and precise. Poor instructions can degrade Cursor and Copilots quality and performance. + + +#### Cursor + +Update the `.cursorrules` file to customize the AI agent to your project needs. These rules can be updated at any time and will better help you over time. + +Great examples of how to customize your Cursor Rules can be found in this repository: [awesome-cursorrules](https://github.com/PatrickJS/awesome-cursorrules). + +Learn more about [Cursor Rules](https://docs.cursor.com/context/rules-for-ai). + +#### GitHub Copilot + +Update the `.github/copilot-instructions.md` file to customize the AI agent to your project needs. These instructions can be updated at any time and will better help you over time. + +Learn more about [GitHub Copilot Instructions](https://docs.github.com/en/copilot/customizing-copilot/adding-custom-instructions-for-github-copilot). + +*It is important to note that AI outputs may still include hallucinations or inaccuracies, so always review and validate the generated suggestions.* \ No newline at end of file From 864098b97d5f420f78c4c6c606993453a6b70bb5 Mon Sep 17 00:00:00 2001 From: Carlos Villanueva Date: Sun, 22 Dec 2024 15:30:55 -0500 Subject: [PATCH 3/4] Update copilot section to have toggle on for instructions --- docs/features/ai.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/features/ai.mdx b/docs/features/ai.mdx index 474d6e20..e6e979bb 100644 --- a/docs/features/ai.mdx +++ b/docs/features/ai.mdx @@ -146,6 +146,8 @@ Learn more about [Cursor Rules](https://docs.cursor.com/context/rules-for-ai). #### GitHub Copilot +In order to begin using Copilot Instructions, you must first enable the `Use Instruction Files` setting in VSCode. + Update the `.github/copilot-instructions.md` file to customize the AI agent to your project needs. These instructions can be updated at any time and will better help you over time. Learn more about [GitHub Copilot Instructions](https://docs.github.com/en/copilot/customizing-copilot/adding-custom-instructions-for-github-copilot). From fdb6c1ce043d51f70f4049af8fdaea81d72eed7b Mon Sep 17 00:00:00 2001 From: Carlos Villanueva Date: Fri, 27 Dec 2024 18:10:31 -0500 Subject: [PATCH 4/4] Adding copilot-insrtuctions md file --- .github/copilot-instructions.md.example | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/copilot-instructions.md.example diff --git a/.github/copilot-instructions.md.example b/.github/copilot-instructions.md.example new file mode 100644 index 00000000..6a166377 --- /dev/null +++ b/.github/copilot-instructions.md.example @@ -0,0 +1,26 @@ +# Copilot Guidelines + +This project uses . + +## Project Structure +Structure of how project files are setup. Making changes to files should be in their respected file. +``` +| App | Description | +|-----------|-----------------------------------------------------------------------------| +| api | Contains serverless functions designed to run separately from the main app e.g. webhooks and cron jobs. | +| app | The main application, featuring a shadcn/ui template. | +| docs | The documentation, which contains the documentation for the app e.g. guides and tutorials. | +| email | The email preview server from react.email. | +| storybook | The storybook, which contains the storybook for the app. | +| studio | Prisma Studio, which is a graphical editor for the database. | +| web | The website, featuring a twblocks template. | +``` + +## Nesting +- Avoid deeply nested code. Break down logic into smaller functions. +- Opening curly braces should be on the same line as the statement. + +## Error Handling +- Always catch a specific error instead of a generic one. +- Log the error message and stack trace. +