bdougie/test icon
public
Published on 4/24/2025
Jarvis

This is the first assistant I've made work

Rules
Prompts
Models
Context
Data
ollama qwen2.5-coder 1.5b model icon

qwen2.5-coder 1.5b

ollama

anthropic Claude 3.7 Sonnet model icon

Claude 3.7 Sonnet

anthropic

200kinput·8.192koutput
gemini Gemini 2.5 Pro model icon

Gemini 2.5 Pro

gemini

1048kinput·65.536koutput
together Llama 4 Maverick Instruct (17Bx128E) model icon

Llama 4 Maverick Instruct (17Bx128E)

together

openai OpenAI GPT-4.1 model icon

OpenAI GPT-4.1

OpenAI

1047kinput·32.768koutput
gemini Gemini 2.0 Flash model icon

Gemini 2.0 Flash

gemini

1048kinput·8.192koutput
lmstudio deepseek-r1 8b model icon

deepseek-r1 8b

lmstudio

sambanova DeepSeek R1 model icon

DeepSeek R1

sambanova

-	Use gofmt to format your code automatically. Don’t fight the formatter.
-	Write clear and concise package names. Use lowercase, single-word names without underscores -r mixed caps.
-	Follow Go naming conventions:
-	Use MixedCaps or mixedCaps for multiword names, not underscores
-	Capitalize exported names
-	Use short, descriptive names for variables and functions
-	Utilize Go’s built-in error handling. Return errors as values, not exceptions.
-	Take advantage of multiple return values, especially for error handling.
-	Use defer for cleanup operations like closing files or unlocking mutexes.
-	Prefer composition over inheritance. Use embedding to include functionality from other -ypes.
-	Make use of interfaces for abstraction. Define interfaces for the methods you need.
-	Utilize Go’s concurrency primitives:
-	Use goroutines for concurrent tasks
-	Use channels for communication between goroutines
-	Remember: “Don’t communicate by sharing memory; share memory by communicating”
-	Leverage the blank identifier (_) when you need to ignore return values.
-	Use type switches to handle multiple types in interfaces.
-	Write clear documentation comments for packages, functions, and types.
-	Avoid unnecessary else clauses. Handle errors early and return.
-	Use named return values when it improves clarity.
-	Make good use of the init() function for package initialization when needed.
-	Remember that semicolons are mostly implicit in Go. Don’t add them unnecessarily.
-	Use the built-in testing package for unit tests.
-	Utilize Go’s powerful slice and map types effectively.
-	Remember to check for nil before dereferencing pointers.
-	Use the context package for managing cancellations and deadlines across API boundaries.
-	Follow the principle of “Accept interfaces, return structs” in your API design.
-	Use go vet and golint tools regularly to catch common mistakes and style issues.
- Optimize indexes to improve query execution speed.
- Avoid N+1 queries and suggest more efficient alternatives.
- Recommend normalization or denormalization strategies based on use cases.
- Implement transaction management where necessary to ensure data consistency.
- Suggest methods for monitoring database performance.
## Rules for When to Use `useEffect` in React

**Purpose:**  
Guide coding agents to use `useEffect` only when appropriate, avoiding common pitfalls and misuse.

---

**Rule: Use `useEffect` only for true side effects—operations that must happen outside the normal React render flow and cannot be handled by rendering logic, event handlers, or derived state.**

---

### When to Use `useEffect`

Use `useEffect` if your code needs to:

- **Interact with external systems or APIs:**  
  - Fetching data from a server  
  - Subscribing to WebSocket or event listeners  
  - Setting up timers or intervals  
  - Manually manipulating the DOM (rare, but sometimes necessary)[4][7]

- **Synchronize with systems outside React:**  
  - Updating browser title or URL  
  - Managing focus or scroll position  
  - Integrating with third-party libraries that require manual setup/teardown[1][4]

- **Clean up resources:**  
  - Remove event listeners  
  - Cancel network requests  
  - Clear timers or intervals when the component unmounts or dependencies change[4][2]

---

### When Not to Use `useEffect`

Do **not** use `useEffect` for:

- **Deriving state from props or other state:**  
  - If you can compute a value directly in render (e.g., filtering a list based on search input), do it inline or with a memoized value, not in an effect[5][6].
- **Handling user events:**  
  - Use event handlers (e.g., `onClick`, `onSubmit`) directly, not effects triggered by state changes[1][6].
- **Synchronizing state changes:**  
  - Prefer derived/computed state or useMemo for calculations based on other state[3][5].
- **Triggering effects that could be handled by React’s rendering:**  
  - If you’re only updating UI in response to state/props, let React handle it[6].

---

### Best Practices

- **Always provide a correct dependency array:**  
  - List all reactive values used inside the effect[3][6].
- **Split effects by concern:**  
  - Use multiple `useEffect` hooks for unrelated side effects[4][6].
- **Use cleanup functions:**  
  - Clean up subscriptions, timers, or listeners to avoid memory leaks[4][2].
- **Avoid unnecessary state:**  
  - Don’t store derived data in state just to trigger effects—compute it during render if possible[5][6].

---

### Quick Decision Table

| Situation                                   | Use `useEffect`? | Alternative                |
|----------------------------------------------|:----------------:|---------------------------|
| Fetching data from API on mount              |       Yes        | —                         |
| Setting up event listeners                   |       Yes        | —                         |
| Filtering a list based on search input       |       No         | Compute in render         |
| Handling form submission                     |       No         | Use event handler         |
| Updating document title                      |       Yes        | —                         |
| Synchronizing two pieces of state            |       No         | Derived/computed state    |

---

### Summary

> Use `useEffect` only for side effects that cannot be achieved by rendering logic, event handlers, or derived state. If you’re tempted to use `useEffect` for something that can be handled during render, reconsider your approach[3][5][6].

By following this rule, you’ll write cleaner, more predictable React code and avoid the common pitfalls associated with unnecessary or misused effects.

Sources
[1] A complete guide to the useEffect React Hook - LogRocket Blog https://blog.logrocket.com/useeffect-react-hook-complete-guide/
[2] Rules of React's useEffect - CoderPad https://coderpad.io/blog/development/rules-of-reacts-useeffect/
[3] Mastering useEffect: Rules, Best Practices, and Pitfalls https://dev.to/cybermaxi7/mastering-useeffect-rules-best-practices-and-pitfalls-353e
[4] ReactJS useEffect Hook - GeeksforGeeks https://www.geeksforgeeks.org/reactjs-useeffect-hook/
[5] Best Practices for useState and useEffect in React - DEV Community https://dev.to/wdp/best-practices-for-usestate-and-useeffect-in-react-4aea
[6] The ultimate guide to using the useEffect hook in React - Zipy.ai https://www.zipy.ai/blog/useeffect-hook-guide
[7] Using the Effect Hook - React https://legacy.reactjs.org/docs/hooks-effect.html
[8] useEffect - React https://react.dev/reference/react/useEffect
[9] UseEffect Best Practices : r/reactjs - Reddit https://www.reddit.com/r/reactjs/comments/18l98mh/useeffect_best_practices/
[10] A Deep Dive into `useEffect`: Best Practices for React Developers https://dev.to/hkp22/a-deep-dive-into-useeffect-best-practices-for-react-developers-3b93
[11] Understanding React hook useEffect & best practice - Stack Overflow https://stackoverflow.com/questions/66267135/understanding-react-hook-useeffect-best-practice
[12] Understanding useEffect() : r/react - Reddit https://www.reddit.com/r/react/comments/tivs7z/understanding_useeffect/
[13] You Might Not Need an Effect - React https://react.dev/learn/you-might-not-need-an-effect
[14] Rules of Hooks - React https://legacy.reactjs.org/docs/hooks-rules.html
[15] Clean Code Hack: A Short Guide to useEffect Usage in React https://itnext.io/clean-code-hack-a-short-guide-to-useeffect-usage-in-react-a0a75d189fdc
[16] What is the good practice to use React.JS useEffect hook for multiple ... https://stackoverflow.com/questions/68713509/what-is-the-good-practice-to-use-react-js-useeffect-hook-for-multiple-states
[17] When to use useEffect? - reactjs - Stack Overflow https://stackoverflow.com/questions/57003084/when-to-use-useeffect
[18] React useEffect() - A complete guide - Hygraph https://hygraph.com/blog/react-useeffect-a-complete-guide
[19] React useEffect: A complete guide with examples - DeadSimpleChat https://deadsimplechat.com/blog/react-useeffect-a-complete-guide-with-examples/
[20] React useEffect Hooks - W3Schools https://www.w3schools.com/react/react_useeffect.asp
## Rules for Testing JavaScript and React Applications

Drawing from the content and philosophy of [TestingJavaScript.com][1][3][2], as well as established industry best practices, here are clear cursor rules to guide coding agents on how to test JavaScript and React applications effectively.

---

### **General JavaScript Testing Rules**

- **Test Behavior, Not Implementation**
  - Write tests that focus on the observable behavior of your code, not its internal implementation or private variables. This ensures your tests remain robust even as the code evolves[10][7].

- **Keep Tests Small and Focused**
  - Each test should cover a single scenario or behavior. Avoid writing tests that try to verify multiple things at once[4].

- **Use Descriptive Test Names**
  - Name your tests so that anyone can understand what is being tested and why. Good names improve test readability and maintainability[4][8].

- **Organize Tests by Type and Feature**
  - Group related tests together (unit, integration, end-to-end) and structure them to reflect your application's features[4].

- **Mock External Dependencies Only When Necessary**
  - Use mocks and stubs to isolate the unit under test, but avoid over-mocking. Prefer real implementations when possible to keep tests meaningful and less brittle[8][10].

- **Maintain Test Code Quality**
  - Treat test code as production code: keep it clean, organized, and up-to-date[4][6].

---

### **React Application Testing Rules**

- **Test Components as Users Would Use Them**
  - Use tools like React Testing Library to test the behavior of components from the user's perspective, interacting with the DOM as a user would. Avoid testing internal component state or methods directly[5][7][9].

- **Prefer Queries Based on Accessible Attributes**
  - When selecting elements in tests, use queries that reflect how users interact (e.g., by label text, role, or placeholder) rather than brittle selectors like CSS classes or IDs[9].

- **Use the Arrange-Act-Assert (AAA) Pattern**
  - Structure each test to first *arrange* the environment, then *act* (perform user interaction or trigger logic), and finally *assert* the expected outcome[7].

- **Write Unit, Integration, and End-to-End Tests**
  - Unit tests: Test individual functions or components in isolation.
  - Integration tests: Test how multiple components or modules work together.
  - End-to-end tests: Simulate real user workflows in a browser environment[5].

- **Use Jest and React Testing Library for Unit and Component Tests**
  - Jest is the recommended test runner and assertion library for React apps. Use React Testing Library for rendering and interacting with components in tests[5].

- **Automate and Run Tests Regularly**
  - Integrate tests into your development workflow and CI/CD pipelines to catch regressions early[4][6].

---

### **Common Anti-Patterns to Avoid**

- **Don’t Test Private/Internal Implementation Details**
  - Testing internal logic makes tests brittle and harder to maintain[10][7].

- **Don’t Overuse Mocks or Test Helpers**
  - Excessive mocking can make tests less reliable and harder to understand[8][10].

- **Don’t Rely on Unstable Selectors**
  - Avoid querying elements by CSS classes or IDs that may change with design updates; use data attributes or accessible queries instead[9].
- USE VITEST INSTEAD OF JEST ALWAYS 
---

### **Summary Table**

| Rule                                         | Rationale/Example                                                                 |
|-----------------------------------------------|-----------------------------------------------------------------------------------|
| Test behavior, not implementation            | Focus on what the user sees, not how it’s built[10][7]                            |
| Use user-centric queries in React tests      | `getByText`, `getByRole` over `.className`[9]                                     |
| Keep tests small, focused, and descriptive   | Easier to maintain and debug[4][8]                                                |
| Use Arrange-Act-Assert pattern               | Improves clarity and structure[7]                                                 |
| Automate and run tests regularly             | Detects regressions early[4][6]                                                   |
| Avoid over-mocking and unstable selectors    | Keeps tests robust and meaningful[8][9][10]                                       |

---

By following these cursor rules, coding agents can ensure their JavaScript and React application tests are robust, maintainable, and focused on delivering real value to users and developers alike.[1][3][2][4][5][6][7][8][9][10]

Sources
[1] www.testingjavascript.com https://www.testingjavascript.com
[2] Testing JavaScript | Testing JavaScript https://www.testingjavascript.com/
[3] Testing JavaScript | Testing JavaScript https://www.testingjavascript.com
[4] How to Test JavaScript Applications: Tools, Techniques, and Best ... https://codedamn.com/news/programming/test-javascript-applications-tools-techniques
[5] How to test React Apps - BrowserStack https://www.browserstack.com/guide/how-to-test-react-apps
[6] Testing in JavaScript: Best Practices and Tools - DEV Community https://dev.to/mattryanmtl/testing-in-javascript-best-practices-and-tools-4bkb
[7] Testing React Components: Best Practices and Tools - LinkedIn https://www.linkedin.com/pulse/testing-react-components-best-practices-tools-alex-lomia
[8] Javascript Unit Testing Best Practices to Follow - BrowserStack https://www.browserstack.com/guide/javascript-testing-best-practices
[9] goldbergyoni/javascript-testing-best-practices - GitHub https://github.com/goldbergyoni/javascript-testing-best-practices
[10] 13 JavaScript Testing Best Practices You Should Know [2025] https://www.lambdatest.com/blog/javascript-testing-best-practices-you-should-know/
[11] Testing JavaScript Applications | <Blog /> - Colin Brooks https://colinrobertbrooks.github.io/blog/testing-javascript-applications/
[12] How to properly test react applications? What are the best ways to ... https://www.reddit.com/r/reactjs/comments/17kfmuf/how_to_properly_test_react_applications_what_are/
[13] Effective Testing in JavaScript | AppSignal Blog https://blog.appsignal.com/2024/05/08/effective-testing-in-javascript.html
[14] React Functional Testing Best Practices - Daily.dev https://daily.dev/blog/react-functional-testing-best-practices
[15] How to properly learn testing in JavaScript/TypeScript in 2022 - Reddit https://www.reddit.com/r/reactjs/comments/y4qbap/how_to_properly_learn_testing_in/
[16] How to properly unit test a React component? - Stack Overflow https://stackoverflow.com/questions/38815439/how-to-properly-unit-test-a-react-component
[17] JavaScript Unit Testing Tutorial | BrowserStack https://www.browserstack.com/guide/unit-testing-in-javascript
[18] React Testing for Beginners: Start Here! - YouTube https://www.youtube.com/watch?v=8Xwq35cPwYg
[19] Testing Your JavaScript: Best Practices for Robust Applications. https://dev.to/dharamgfx/testing-your-javascript-best-practices-for-robust-applications-428a
[20] Testing React Apps - Jest https://jestjs.io/docs/tutorial-react
[21] JavaScript testing: 9 best practices to learn - LogRocket Blog https://blog.logrocket.com/javascript-testing-best-practices/
[22] Best practices for writing good unit tests for components? : r/reactjs https://www.reddit.com/r/reactjs/comments/wqy6rz/best_practices_for_writing_good_unit_tests_for/
[23] How to quickly test some javascript code? [closed] - Stack Overflow https://stackoverflow.com/questions/8869783/how-to-quickly-test-some-javascript-code
Effective gohttps://go.dev/doc/effective_go
Reacthttps://react.dev/reference/
React Testing Library Docshttps://testing-library.com/docs/react-testing-library/intro/

Prompts

Learn more
Go Hype Beast
Create a new golang
You are a Golang programming assistant. Your task is to help developers write clean, idiomatic, and efficient Go code following these best practices:

1.	Use gofmt for consistent formatting.
2.	Follow Go naming conventions:
	•	Use CamelCase for exported names, camelCase for unexported.
	•	Avoid stuttering in package names (e.g., vectordb.New() instead of vectordb.NewVectorDB()).
	•	Name interfaces as “doers” (e.g., Reader, Writer).
3.	Write clear and concise code:
	•	Keep functions small and focused.
	•	Use meaningful variable and function names.
	•	Limit line length, but don’t obsess over it.	
4.	Handle errors explicitly:
	•	Check and handle errors immediately.
	•	Avoid using panic.
5.	Utilize Go’s concurrency features effectively:
	•	Use goroutines for concurrent operations.
	•	Employ channels for communication between goroutines.
6.	Optimize for readability and maintainability:
	•	Write comments that explain “why” rather than “what”.
	•	Use defer for cleanup operations.
7.	Leverage Go’s type system:
	•	Use structs to group related data.
	•	Implement interfaces implicitly.
8.	Follow idiomatic Go patterns:
	•	Prefer composition over inheritance.
	•	Use slices instead of arrays when possible.
9.	Optimize performance:
	•	Use efficient data structures and algorithms.
	•	Profile and benchmark code when necessary.
10.	Ensure code safety and security:
	•	Use go vet and golint to catch potential issues.
	•	Avoid global variables when possible.

When providing code examples or suggestions, always adhere to these principles and explain the rationale behind your recommendations. If asked about specific style decisions, refer to the Go Style Guide and Effective Go documentation for authoritative answers.

Context

Learn more
@terminal
Reference the last command you ran in your IDE's terminal and its output
@open
Reference the contents of all of your open files
@commit
@clipboard
Reference recent clipboard items
@repo-map
Reference the outline of your codebase
@diff
Reference all of the changes you've made to your current branch

S3

${{ secrets.bdougie/test/continuedev/s3-dev-data/AWS_SERVER_URL }}

MCP Servers

Learn more

Docker MCP Github

docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN mcp/github