@mallardbay/cursor-rules 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,63 @@
1
+ ---
2
+ description: Defines best practices for building consistent, maintainable, and responsive UI in Mallard Bay projects
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # UI Development Standards
7
+
8
+ ## Theme Usage
9
+ Use theme values consistently across all components:
10
+
11
+ ### Colors
12
+ - Use theme colors instead of hardcoded values
13
+ - Example: `theme.colors.primary` instead of `'#000000'`
14
+
15
+ ### Spacing
16
+ - Use theme spacing values for margins and padding
17
+ - Example: `theme.space[4]` instead of `'16px'`
18
+
19
+ ### Typography
20
+ - Use theme typography settings for text styles
21
+ - Example: `theme.fontSizes.md` instead of `'16px'`
22
+
23
+ ### Borders
24
+ - Use theme border styles and radius values
25
+ - Example: `theme.borders.sm` instead of `'1px solid'`
26
+
27
+ ## Component Structure
28
+ Maintain clean and consistent component structure:
29
+
30
+ ### Nesting
31
+ - Limit component nesting to maximum depth of 3
32
+ - Keep component hierarchy readable and maintainable
33
+
34
+ ### Inline Styles
35
+ - Limit inline styles to maximum of 2 per component
36
+ - Prefer theme-based styling
37
+
38
+ ### Component Library
39
+ - Use existing components in @mallardbay/lib-react-components, @mallardbay/lib-react-components is based off Crakra UI v2
40
+ - If no component available in @mallardbay/lib-react-components, create one using Crakra UI and place it under src/components/shared/todo-lib-react-components/ to me moved later
41
+
42
+ ## Responsive Design
43
+ Ensure responsive and accessible design:
44
+
45
+ ### Breakpoints
46
+ - Use theme breakpoints for responsive design
47
+ - Implement mobile-first approach
48
+
49
+ ### Spacing
50
+ - Use responsive spacing values
51
+ - Adapt layouts for different screen sizes
52
+
53
+ ### Animations
54
+ - Use theme transition values for animations
55
+ - Keep animations smooth and performant
56
+
57
+ ### Rendering
58
+ - Optimize component rendering
59
+ - Avoid unnecessary re-renders
60
+ - Use React.memo and useMemo when appropriate
61
+
62
+ ## File Patterns
63
+ These rules apply to all TypeScript and TSX files in the project.
@@ -0,0 +1,63 @@
1
+ ---
2
+ description: Defines best practices for building consistent, maintainable, and responsive UI in Mallard Bay projects
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # UI Development Standards
7
+
8
+ ## Theme Usage
9
+ Use theme values consistently across all components:
10
+
11
+ ### Colors
12
+ - Use theme colors instead of hardcoded values
13
+ - Example: `theme.colors.primary` instead of `'#000000'`
14
+
15
+ ### Spacing
16
+ - Use theme spacing values for margins and padding
17
+ - Example: `theme.space[4]` instead of `'16px'`
18
+
19
+ ### Typography
20
+ - Use theme typography settings for text styles
21
+ - Example: `theme.fontSizes.md` instead of `'16px'`
22
+
23
+ ### Borders
24
+ - Use theme border styles and radius values
25
+ - Example: `theme.borders.sm` instead of `'1px solid'`
26
+
27
+ ## Component Structure
28
+ Maintain clean and consistent component structure:
29
+
30
+ ### Nesting
31
+ - Limit component nesting to maximum depth of 3
32
+ - Keep component hierarchy readable and maintainable
33
+
34
+ ### Inline Styles
35
+ - Limit inline styles to maximum of 2 per component
36
+ - Prefer theme-based styling
37
+
38
+ ### Component Library
39
+ - Use existing components in @mallardbay/lib-react-components, @mallardbay/lib-react-components is based off Crakra UI v2
40
+ - If no component available in @mallardbay/lib-react-components, create one using Crakra UI and place it under src/components/shared/todo-lib-react-components/ to me moved later
41
+
42
+ ## Responsive Design
43
+ Ensure responsive and accessible design:
44
+
45
+ ### Breakpoints
46
+ - Use theme breakpoints for responsive design
47
+ - Implement mobile-first approach
48
+
49
+ ### Spacing
50
+ - Use responsive spacing values
51
+ - Adapt layouts for different screen sizes
52
+
53
+ ### Animations
54
+ - Use theme transition values for animations
55
+ - Keep animations smooth and performant
56
+
57
+ ### Rendering
58
+ - Optimize component rendering
59
+ - Avoid unnecessary re-renders
60
+ - Use React.memo and useMemo when appropriate
61
+
62
+ ## File Patterns
63
+ These rules apply to all TypeScript and TSX files in the project.
@@ -0,0 +1,48 @@
1
+ ---
2
+ description: Defines structure, naming, reuse, and dependency guidelines to ensure clean, maintainable, and consistent TypeScript code across the project—favoring pragmatism, proven libraries, and shared conventions.
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # Code Quality Standards
7
+
8
+ ## Code Structure
9
+ - Maximum file length: 200 lines
10
+ - Maximum function length: 50 lines
11
+ - Naming conventions:
12
+ - Components: PascalCase
13
+ - Functions: camelCase
14
+ - Constants: UPPER_SNAKE_CASE
15
+ - Types: PascalCase
16
+ - Types should be defined at the bottom of files
17
+ - PropTypes should be defined before component definitions
18
+ - Prefer using alias for importing components. Only use relative for tests or when there's a direct sibling
19
+
20
+ ## Code Reuse
21
+ - Use shared libraries to avoid duplication
22
+ - Primary libraries to use:
23
+ - [@mallardbay/lib-react-components](mdc:package.json)
24
+ - [@mallardbay/lib-shared-helpers](mdc:package.json)
25
+
26
+ ## Third party libraries
27
+ - Favor battle-tested libraries over custom solutions. If a well-maintained, widely-used library solves the problem cleanly, use it. Reinventing functionality that’s already solid, reliable, and well-documented usually leads to more bugs, more maintenance, and wasted time.
28
+ - Prioritize stability and ecosystem fit. Pick libraries that are actively maintained, have strong adoption, and fit well within our existing tech stack. Avoid fringe or unmaintained packages unless there’s a strong reason.
29
+ - Suggest existing libraries during code review. If you spot hand-rolled code that could be replaced with a proven library, flag it. Examples:
30
+ - Use zod or yup instead of custom input validation
31
+ - Use date-fns instead of writing date math from scratch
32
+ - Use radash for utility-heavy logic if readability or testability improves
33
+ - Use react-hook-form for complex form state handling
34
+ - Be pragmatic. Sometimes a simple custom solution is faster and easier than pulling in a heavy dependency—but always weigh short-term gains against long-term cost.
35
+ - Make reuse easy. If we do build something custom, design it to be clean, reusable, and well-documented. That way, we’re not creating another wheel, but investing in something worth maintaining.
36
+
37
+ ## String Constants
38
+ - Use constants instead of string literals for:
39
+ - Copy text (UI content)
40
+ - Test IDs
41
+ - Error messages
42
+ - URLs
43
+ - Source constants from:
44
+ - @mallardbay/lib-shared-helpers
45
+ - Local constants files
46
+
47
+ ## Cursor Rules
48
+ - Suggest cursor rules as needed
@@ -0,0 +1,40 @@
1
+ ---
2
+ description: Outlines expectations for pull request size, test coverage, documentation, and review process—promoting focused, well-tested, and maintainable contributions that align with team standards and improve review efficiency.
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # Code Review Standards
7
+
8
+ ## Pull Request Guidelines
9
+
10
+ ### Size Requirements
11
+ - Maximum PR size: 400 lines
12
+ - Split large changes into smaller, focused PRs
13
+ - Keep changes atomic and focused
14
+ - Consider impact on review process
15
+
16
+ ## Testing Requirements
17
+ Ensure comprehensive test coverage:
18
+
19
+ ### Test Coverage
20
+ - All new code must include tests
21
+ - Follow testing standards in [testing.mdc](mdc:.cursor/rules/testing.mdc)
22
+ - Include unit tests for new functionality
23
+ - Avoid making a ton of changes to existing tests while refactoring
24
+
25
+ ### Code Documentation
26
+ - Document complex logic with comments
27
+ - Explain non-obvious implementation details
28
+ - Document features added and important caveats in README
29
+
30
+ ### Review Process
31
+ - Review for code quality
32
+ - Check for test coverage
33
+ - Verify documentation
34
+ - Ensure adherence to project standards
35
+
36
+ ## Best Practices
37
+ - Keep PRs focused and manageable
38
+ - Include clear PR descriptions
39
+ - Reference related issues/tickets
40
+ - Respond to review comments promptly
@@ -0,0 +1,41 @@
1
+ ---
2
+ description: Defines consistent patterns for API and form error handling—focusing on clear user feedback, robust validation, and reliable logging to improve user experience, developer debugging, and overall app resilience.
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # Error Handling Standards
7
+
8
+ ## API Error Handling
9
+ Implement comprehensive API error handling
10
+
11
+ ### Error Types
12
+ - Handle network errors
13
+ - Handle server errors
14
+ - Handle validation errors
15
+ - Handle Apollo-specific errors
16
+
17
+ ### Error Presentation
18
+ - Show error toasts for user feedback
19
+ - Use original error messages when appropriate
20
+ - Provide clear, actionable error messages
21
+ - Log errors for debugging
22
+
23
+ ## Form Validation
24
+ Implement robust form validation
25
+ - Validate all user inputs
26
+ - Show validation errors clearly
27
+ - Handle form submission errors
28
+ - Use [@hookform/resolvers](mdc:package.json) for validation
29
+
30
+ ### Error Display
31
+ - Show validation errors inline
32
+ - Provide clear error messages
33
+ - Highlight invalid fields
34
+ - Prevent form submission with invalid data
35
+
36
+ ## Best Practices
37
+ - Use try-catch blocks appropriately
38
+ - Implement proper error boundaries
39
+ - Log errors for debugging
40
+ - Provide user-friendly error messages
41
+ - Handle edge cases gracefully
@@ -0,0 +1,22 @@
1
+ ---
2
+ description: Describes Mallard Bay’s mission to simplify and scale outfitter operations through purpose-built software—emphasizing real-world impact, outfitter collaboration, and a long-term vision to digitize and unify the outdoor experience industry.
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # Mallard Bay: Outfitter Management System Overview
7
+
8
+ Mallard Bay is a specialized platform designed to streamline operations for outfitters—businesses that offer guided outdoor experiences such as hunting, fishing, and eco-tourism. At its core, Mallard Bay operates as an outfitter management system, purpose-built to reduce administrative burden, improve customer experience, and unlock new revenue channels for guides and lodge operators.
9
+
10
+ # Built for Outfitters, with Outfitters in Mind
11
+
12
+ At Mallard Bay, we’re not just building software — we’re solving real problems for real people in the outfitting industry. Every feature we ship is grounded in one simple principle: if it doesn’t make an outfitter’s life easier or their business better, it doesn’t belong in our product.
13
+
14
+ We work closely with outfitters of all sizes to understand their workflows, pain points, and growth challenges. From there, we prioritize meaningful features that drive efficiency, boost bookings, and enhance the guest experience.
15
+
16
+ Whether it’s reducing no-shows with smart reminders, saving time through automated group booking tools, or enabling instant rebooking with dynamic availability, we’re laser-focused on delivering value — not fluff.
17
+
18
+ We’re building tools that fit into the way outfitters actually work — not the way a generic booking platform thinks they should.
19
+
20
+ # Vision
21
+
22
+ Mallard Bay aims to be the digital backbone for the outfitting industry—a single source of truth for trip logistics, customer interaction, and business growth. The long-term goal is to transform an analog, fragmented market into a digital-first, scalable ecosystem.
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: Defines best practices for optimizing React components, rendering efficiency, and dependency management—focusing on minimizing re-renders, reducing bundle size, and enabling smooth user experiences through memoization, lazy loading, and performance-aware development.
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # Performance Standards
7
+
8
+ ## React Optimization
9
+ Optimize React components for better performance:
10
+
11
+ ### Component Optimization
12
+ - Use `React.memo` for pure components
13
+ - Implement `useCallback` for function props
14
+ - Use `useMemo` for expensive computations
15
+ - Avoid inline function definitions in render
16
+
17
+ ## Rendering Optimization
18
+ Prevent unnecessary re-renders:
19
+ - Avoid inline styles in components
20
+ - Prevent inline object creation in render
21
+ - Use proper key props in lists
22
+ - Memoize complex objects and callbacks
23
+
24
+ ### Dependencies
25
+ - Prefer existing dependencies over new ones
26
+ - Review [package.json](mdc:package.json) before adding new packages
27
+ - Consider bundle size impact of new dependencies
28
+ - Use tree-shaking friendly imports
29
+
30
+ ## Best Practices
31
+ - Implement proper code splitting
32
+ - Use lazy loading for routes and large components
33
+ - Optimize images and assets
34
+ - Monitor performance metrics
35
+ - Use React DevTools for performance profiling
36
+
37
+ ## File Patterns
38
+ These rules apply to all TypeScript and TSX files in the project.
@@ -0,0 +1,61 @@
1
+ ---
2
+ description: Outlines practical, value-driven testing guidelines focused on reliability, developer confidence, and speed. Emphasizes high-impact coverage (not overkill), structured test organization, clear scenarios, and reusable mock/test utilities—enabling fast iteration without sacrificing quality.
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # Testing Standards
7
+
8
+ ## Test Coverage and Structure
9
+ We aim for high-impact test coverage, focused on adding value and improving developer confidence and experience. The priority is to cover critical logic, edge cases, and integration points where bugs would hurt the most. Tests should act as a safety net and enable fast, fearless iteration—not as a box-ticking exercise.
10
+
11
+ We do not chase 100% coverage for its own sake. If a test doesn’t meaningfully reduce risk or help developers move faster, it’s not worth writing. The goal is smart coverage, not maximum coverage—optimize for reliability, clarity, and development speed without overengineering.
12
+
13
+ Avoid e2e tests for UI. Favor unit tests.
14
+
15
+ ### Coverage Requirements
16
+ - Minimum test coverage: 80%
17
+ - Place tests in `_tests_` directory closest to the file being tested
18
+ - Use `.spec.ts` or `.spec.tsx` file extensions
19
+ - Do NOT Use `.test.ts` or `.test.tsx` file extensions
20
+
21
+
22
+ ### Test Organization
23
+ - Maximum nesting level: 2
24
+ - Use `test` or `it` for test cases
25
+ - Keep tests focused and atomic
26
+ - Follow AAA pattern (Arrange, Act, Assert)
27
+
28
+ ### Required Scenarios
29
+ - Happy path testing
30
+ - Error case handling
31
+ - Edge case coverage
32
+ - All tests must pass before completion
33
+
34
+ ### Test Quality
35
+ - Write clear, descriptive test names
36
+ - Test one concept per test case
37
+ - Avoid test interdependence
38
+ - Use meaningful assertions
39
+ - Avoid tests that will make the overall run slower
40
+
41
+ ### Component Testing
42
+ - Use `renderWithProviders` for component tests
43
+ - Use `renderHookWithProviders` for hook tests
44
+ - Avoid mocking dependent components
45
+ - Test component behavior, not implementation
46
+
47
+ ### Mocking Guidelines
48
+ - Use mock helpers instead of inline mocks
49
+ - Follow existing patterns for:
50
+ - Entity mocks
51
+ - Apollo mocks
52
+ - Provider mocks
53
+ - Keep mocks simple and maintainable
54
+
55
+ ### Test Utilities
56
+ - Leverage testing utilities from [@testing-library/react](mdc:package.json)
57
+ - Use [@testing-library/jest-dom](mdc:package.json) for DOM assertions
58
+ - Follow established patterns in existing tests
59
+
60
+ ## File Patterns
61
+ These rules apply to all test files with `.spec.ts` or `.spec.tsx` extensions.
@@ -0,0 +1,24 @@
1
+ ---
2
+ description: Outlines a pragmatic approach to TypeScript—favoring strict type safety where it adds real value in catching bugs and improving developer experience, without unnecessary overhead. Includes file organization, best practices, and consistent use of TypeScript to enforce clarity, maintainability, and confidence in the codebase.
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # TypeScript Development Standards
7
+
8
+ ## Type Safety
9
+ Enforce comprehensive type safety across the codebase:
10
+
11
+ ### Strict Type Checking
12
+ Be as strictly as possible where it delivers clear value—specifically in preventing bugs and improving the developer experience. The goal is to enforce strong types and catch issues early, without introducing excessive friction or overhead. If a strict setting improves safety, maintainability, or clarity, we’ll use it. If it creates noise or slows down iteration without real benefit, we’ll dial it back. This is about pragmatic strictness, not dogmatism.
13
+
14
+ ### File Organization
15
+ - Place types at the bottom of files
16
+ - Define PropTypes before component definitions
17
+
18
+ ## Best Practices
19
+ - Use TypeScript for all new code
20
+ - Leverage TypeScript's type system for better code quality
21
+ - Follow React best practices with TypeScript
22
+ - Use proper type definitions for props and state
23
+ - Utilize TypeScript's utility types when appropriate
24
+ - Suggest existing libaries as needed
@@ -0,0 +1,57 @@
1
+ #!/bin/bash
2
+ # setup-cursor.sh
3
+ # Pulls shared Cursor rules unless running in CI, supports env-specific configs
4
+
5
+ set -e
6
+
7
+ # Detect CI environment
8
+ if [ "$CI" = "true" ] || [ "$GITHUB_ACTIONS" = "true" ] || [ "$GITLAB_CI" = "true" ] || [ "$CIRCLECI" = "true" ]; then
9
+ echo "Detected CI environment – skipping .cursor setup"
10
+ exit 0
11
+ fi
12
+
13
+ # Check if an argument was passed
14
+ ENV_TYPE="$1"
15
+
16
+ if [ -z "$ENV_TYPE" ]; then
17
+ echo "Usage: bash setup-cursor.sh <env-type>"
18
+ echo "Example: bash setup-cursor.sh frontend"
19
+ exit 1
20
+ fi
21
+
22
+ REPO_URL="git@github.com:your-org/cursor-rules.git"
23
+ TMP_DIR=".cursor-tmp"
24
+
25
+ echo "Cloning rules from $REPO_URL..."
26
+
27
+ # Remove existing .cursor and temp dir
28
+ rm -rf .cursor "$TMP_DIR"
29
+
30
+ # Clone into a temporary folder
31
+ git clone --depth=1 "$REPO_URL" "$TMP_DIR"
32
+
33
+ # Check for required rule files
34
+ SHARED_RULES="$TMP_DIR/.cursor/shared/rules"
35
+ ENV_RULES="$TMP_DIR/.cursor/$ENV_TYPE/rules"
36
+
37
+ if [ ! -f "$SHARED_RULES" ]; then
38
+ echo "Shared rules not found in repo."
39
+ rm -rf "$TMP_DIR"
40
+ exit 1
41
+ fi
42
+
43
+ if [ ! -f "$ENV_RULES" ]; then
44
+ echo "Rules for environment '$ENV_TYPE' not found in repo."
45
+ echo "Expected: .cursor/$ENV_TYPE/rules"
46
+ rm -rf "$TMP_DIR"
47
+ exit 1
48
+ fi
49
+
50
+ # Setup final .cursor structure
51
+ mkdir -p .cursor
52
+ cat "$SHARED_RULES" "$ENV_RULES" > .cursor/rules
53
+
54
+ # Clean up
55
+ rm -rf "$TMP_DIR"
56
+
57
+ echo ".cursor/rules setup complete for '$ENV_TYPE' with shared rules."
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@mallardbay/cursor-rules",
3
+ "version": "1.0.0",
4
+ "description": "Mallard Bay shared cursor rules",
5
+ "main": "bin/setup-cursor.sh",
6
+ "repository": "git@github.com:mallardbay/cursor-rules.git",
7
+ "author": "mfrr1118 <mfrr@me.com>",
8
+ "license": "MIT",
9
+ "keywords": [
10
+ "cursor",
11
+ "ide",
12
+ "configuration"
13
+ ],
14
+ "files": [
15
+ "bin",
16
+ ".cursor"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ }
21
+ }