codingwithagent 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.
Files changed (33) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/bin/init.js +257 -0
  4. package/package.json +56 -0
  5. package/templates/accessibility/.cursorrules +342 -0
  6. package/templates/accessibility/README.md +47 -0
  7. package/templates/antigravity/accessibility/.agent/rules/accessibility.md +501 -0
  8. package/templates/antigravity/accessibility/.agent/rules/aria-patterns.md +568 -0
  9. package/templates/antigravity/accessibility/.agent/rules/wcag-standard.md +225 -0
  10. package/templates/antigravity/accessibility/README.md +42 -0
  11. package/templates/antigravity/minimal/.agent/rules/accessibility.md +53 -0
  12. package/templates/antigravity/minimal/.agent/rules/code-quality.md +86 -0
  13. package/templates/antigravity/minimal/.agent/rules/react-components.md +164 -0
  14. package/templates/antigravity/minimal/README.md +34 -0
  15. package/templates/antigravity/standard/.agent/rules/accessibility.md +98 -0
  16. package/templates/antigravity/standard/.agent/rules/code-quality.md +166 -0
  17. package/templates/antigravity/standard/.agent/rules/pull-request-review.md +192 -0
  18. package/templates/antigravity/standard/.agent/rules/react-components.md +204 -0
  19. package/templates/antigravity/standard/.agent/rules/testing.md +197 -0
  20. package/templates/antigravity/standard/README.md +39 -0
  21. package/templates/antigravity/strict/.agent/README.md +46 -0
  22. package/templates/antigravity/strict/.agent/rules/accessibility.md +199 -0
  23. package/templates/antigravity/strict/.agent/rules/code-quality.md +268 -0
  24. package/templates/antigravity/strict/.agent/rules/pull-request-review.md +114 -0
  25. package/templates/antigravity/strict/.agent/rules/react-components.md +423 -0
  26. package/templates/antigravity/strict/.agent/rules/security.md +483 -0
  27. package/templates/antigravity/strict/.agent/rules/testing.md +280 -0
  28. package/templates/minimal/.cursorrules +48 -0
  29. package/templates/minimal/README.md +40 -0
  30. package/templates/standard/.cursorrules +184 -0
  31. package/templates/standard/README.md +43 -0
  32. package/templates/strict/.cursorrules +227 -0
  33. package/templates/strict/README.md +47 -0
@@ -0,0 +1,166 @@
1
+ ---
2
+ trigger: always_on
3
+ ---
4
+
5
+ # Code Quality and Standards
6
+
7
+ ## Why Code Quality Matters
8
+
9
+ - Prevents production defects and reduces technical debt
10
+ - Ensures maintainable and debuggable code
11
+ - Enables predictable enhancements without side effects
12
+ - Reduces legal, security, and brand risks
13
+ - Improves developer experience and team efficiency
14
+
15
+ ## Folder Structure and Architecture
16
+
17
+ - Follow strict pod-based architecture
18
+ - Structure: `<podName>/<flowName>/container/<containerName>`
19
+ - Structure: `<podName>/<flowName>/component/<componentName>`
20
+ - Structure: `<podName>/<flowName>/feature/<featureName>`
21
+ - Structure: `<podName>/common/utils|constants|feature`
22
+ - Structure: `/common/<domainName>/utils|constants|feature`
23
+ - Do NOT breach pod boundaries without architecture approval
24
+
25
+ ## Naming Conventions
26
+
27
+ - **Variables**: camelCase (thisIsAVariable)
28
+ - **Functions**: camelCase (thisIsAFunction)
29
+ - **Constants**: UPPER_SNAKE_CASE (THIS_IS_A_CONSTANT)
30
+ - **Acronyms**: UPPER_CASE (TIA = "This Is an Acronym")
31
+ - **Components**: PascalCase (ThisIsAComponent)
32
+ - **Object Props**: camelCase ({amount: 1, currency: 'USD'})
33
+ - **URLs**: lowercase with "-" or "/" separators
34
+ - Use descriptive names, avoid abbreviations (shouldDisplayTravelWaiverMessage NOT shouldDsplyTrvlWavrMsg)
35
+
36
+ ## JavaScript Best Practices
37
+
38
+ ### General Rules
39
+
40
+ - Use ES6+ syntax (arrow functions, destructuring, template literals)
41
+ - Prefer `const` over `let`, avoid `var` completely
42
+ - Avoid `let` whenever possible - seek immutability
43
+ - No anonymous functions as event handlers - declare named functions
44
+ - Remove all console.log and debugger statements before PR
45
+ - No eslint-disable-line without architecture team approval
46
+
47
+ ### Prohibited or Restricted Patterns
48
+
49
+ - Do NOT use `window` object (except with arch team clearance)
50
+ - Do NOT import entire lodash library: `import get from 'lodash/get'` (allowed but discouraged)
51
+ - Do NOT use `Date()` - use moment instead
52
+ - Do NOT use `forEach` - use map, filter, reduce, or for...of
53
+ - Do NOT use "will" lifecycle methods except componentWillUnmount
54
+ - Do NOT trust BFF responses - always validate and set defaults
55
+ - Do NOT use `tabIndex > 0`
56
+
57
+ ### Props and State Management
58
+
59
+ - Destructure props at function signature level
60
+ - Avoid prop drilling beyond 3 levels - use intermediate containers
61
+ - Use Redux for global state, local state only for UI-specific concerns
62
+ - Required props: Mark functions and data needed for functionality as required
63
+ - PropTypes: Define in external file at wrapper level for reusability
64
+ - Use null chain operator for service responses with mapper layer
65
+
66
+ ### Pure Functions and Complexity
67
+
68
+ - Write pure functions whenever possible (no side effects)
69
+ - Functions should do one thing well
70
+ - Maximum function length: 50 lines
71
+ - Remove dormant (dead) code immediately
72
+ - Refactor when components exceed 200 lines
73
+ - Extract complex logic to utility functions or selectors
74
+
75
+ ### Data Handling
76
+
77
+ - Always validate service responses with null checks
78
+ - Create mappers between services and store
79
+ - Use selectors for all data transformations
80
+ - Move data processing from render to selectors
81
+ - Use constants file for string values and configuration
82
+
83
+ ## Component Standards
84
+
85
+ ### Component Types
86
+
87
+ - Prefer functional components with hooks over class components
88
+ - Use PureComponent ONLY if props are immutable (primitives or ImmutableJS)
89
+ - Stateless pure presentational components preferred
90
+ - Return `false` instead of `null` to keep children linked to tree
91
+
92
+ ### React Hooks
93
+
94
+ - **useEffect**: Stay reactive, be mindful of dependencies array
95
+ - **useMemo**: Use for expensive calculations only
96
+ - **useCallback**: Use to prevent unnecessary re-renders
97
+ - **useRef**: Bridge between JS DOM and React context
98
+ - Custom hooks: Declare at component level or in hooks directory
99
+
100
+ ### Component Requirements
101
+
102
+ - All components must have PropTypes defined
103
+ - Provide defaultProps for optional props
104
+ - Use fragments `<></>` instead of empty divs
105
+ - Keys must come from data props, NOT array index or random IDs
106
+ - Conditional rendering: All conditionals must be boolean (non-boolean values render)
107
+ - Avoid prop drilling: Use intermediate containers beyond 3 levels
108
+
109
+ ### JSX Best Practices
110
+
111
+ - Presentational components should receive data via props only
112
+ - No business logic in JSX components - use selectors
113
+ - Extract methods returning JSX as separate components
114
+ - Use memoization for expensive rendering logic
115
+ - Keep components small and reusable (<200 lines)
116
+ - One responsibility per component
117
+
118
+ ## Styling
119
+
120
+ ### CSS/SCSS Standards
121
+
122
+ - Use mobile-first approach (avoid max-width)
123
+ - Do NOT use `:global` without architecture approval
124
+ - Use `atm-u` utility classes, NOT `atm-c` component classes
125
+ - All CSS must have parent class selector (no global impact)
126
+ - Use Atmos components and design system
127
+ - Maintain 4.5:1 contrast ratio for text, 3:1 for UI elements
128
+
129
+ ### Emotion/CSS-in-JS
130
+
131
+ - Follow Atmos styling patterns
132
+ - Use JSON theme values when available
133
+ - Avoid inline styles unless absolutely necessary
134
+
135
+ ## Redux and State Management
136
+
137
+ ### Redux Patterns
138
+
139
+ - Use Redux Toolkit for all new state management
140
+ - Local state for UI-only concerns (modals, tooltips)
141
+ - Global state for shared data and server responses
142
+ - Do NOT use react-redux-form state - use model instead
143
+ - Define actions and reducers in feature folders
144
+
145
+ ### Sagas
146
+
147
+ - Follow saga implementation patterns
148
+ - Handle async operations in sagas, not components
149
+ - Use try-catch for error handling
150
+ - Implement request/response cycle properly
151
+ - Maintain immutability with "Current" record pattern
152
+
153
+ ## Internationalization (i18n)
154
+
155
+ - Use `<FormattedMessage>` instead of `intl.formatMessage` in JSX
156
+ - Extract messages after every change (provide screenshot for context)
157
+ - Verify scope and ID match file location
158
+ - Do NOT send variable messages to intl - validate existence with defaults
159
+ - Inject intl at container level only once
160
+
161
+ ## Security and PII
162
+
163
+ - Mask credit cards: First 12 digits as asterisks/bullets, last 4 visible
164
+ - Follow PII masking guidelines for all personal data
165
+ - No PCI/PII data in logs or monitoring
166
+ - Validate and sanitize all user inputs
@@ -0,0 +1,192 @@
1
+ ---
2
+ trigger: always_on
3
+ ---
4
+
5
+ # Pull Request Standards and Review Guidelines
6
+
7
+ ## PR Submission Requirements
8
+
9
+ ### Must-Have Checklist
10
+
11
+ - [ ] PR form properly filled (checkmarks, labels, ticket number, description)
12
+ - [ ] Code coverage provided (previous vs current)
13
+ - [ ] Unit tests added/updated for all changed code
14
+ - [ ] Screenshots of new functionality included
15
+ - [ ] Team review completed before requesting merge
16
+ - [ ] All Jira tickets linked and valid
17
+ - [ ] No TODOs or incomplete work (create enabler if urgent)
18
+
19
+ ### PR Form Structure
20
+
21
+ - **Ticket Number**: Link to Jira/Github issue
22
+ - **Description**: Clear explanation of changes and why
23
+ - **Testing Instructions**: How to manually verify changes
24
+ - **Coverage**: Previous and current test coverage percentage
25
+ - **Screenshots**: Before/after for UI changes
26
+ - **Team Review**: At least one peer approval
27
+ - **Release Notes**: User-facing changes documented
28
+
29
+ ## Branching and Merging Strategy
30
+
31
+ ### Branch Types
32
+
33
+ - **Feature/Epic Branches**: New functionality development
34
+ - **Pod Branches**: Maintenance or combined testing
35
+ - **Development Branch**: Integration branch for release candidates
36
+
37
+ ### Merge Rules
38
+
39
+ - All PRs go to feature/epic/pod branch, NEVER directly to development
40
+ - One PR per user story
41
+ - Do NOT "Squash and merge" downstreams (difficult to solve issues)
42
+ - Upstream PRs require:
43
+ - Intended release documented
44
+ - List of all Jira/Github tickets
45
+ - Git log command output: `git log --no-merges --format=oneline origin/development..origin/epicbranch`
46
+ - eQA sign-off on ALL tickets
47
+ - Each change must relate to a ticket
48
+ - Global/semiglobal changes require architecture team review
49
+
50
+ ### Release Readiness
51
+
52
+ - All user stories in epic/feature must have eQA sign-off
53
+ - Stories tested together in dev environment before merge
54
+ - Time allocated for code reviews, downstream and upstream merges
55
+ - Epic/feature scope properly defined in Jira/Github
56
+
57
+ ## Code Review Standards
58
+
59
+ ### Architecture and Structure
60
+
61
+ - [ ] Folder structure follows pod-based architecture
62
+ - [ ] No pod bubble breaches
63
+ - [ ] Component placed in correct directory
64
+ - [ ] Imports follow approved patterns
65
+ - [ ] No circular dependencies
66
+
67
+ ### JavaScript Review
68
+
69
+ - [ ] No `window` object usage (unless approved)
70
+ - [ ] Lodash imports are scoped (not entire library)
71
+ - [ ] Keys in lists from data props, not index
72
+ - [ ] No eslint-disable-line without validation
73
+ - [ ] No `tabIndex > 0`
74
+ - [ ] Props drilling limited to 3 levels
75
+ - [ ] No console.log or debugger statements
76
+ - [ ] Conditional rendering uses boolean values only
77
+ - [ ] No code duplication
78
+ - [ ] String values moved to constants file
79
+ - [ ] Gremlins checked (invisible harmful characters)
80
+
81
+ ### Component Review
82
+
83
+ - [ ] Functional components with hooks (not class components)
84
+ - [ ] PropTypes defined and accurate
85
+ - [ ] Required props marked with .isRequired
86
+ - [ ] Components under 200 lines
87
+ - [ ] No anonymous functions as event handlers
88
+ - [ ] Fragments used instead of empty divs
89
+ - [ ] useEffect dependencies correct
90
+ - [ ] No stale closures
91
+
92
+ ### Styles Review
93
+
94
+ - [ ] Mobile-first approach used (avoid max-width)
95
+ - [ ] No `:global` styles (unless scoped and approved)
96
+ - [ ] Atmos utility classes used (atm-u, not atm-c)
97
+ - [ ] No CSS without parent class selector
98
+ - [ ] Color contrast meets 4.5:1 ratio
99
+
100
+ ### Accessibility Review
101
+
102
+ - [ ] All interactive elements keyboard accessible
103
+ - [ ] Proper ARIA labels (not overused)
104
+ - [ ] role="alert" not misused
105
+ - [ ] External links have extDisclaimer for screen readers
106
+ - [ ] Color not sole information indicator
107
+ - [ ] Alt text provided for meaningful images
108
+ - [ ] Form fields have labels
109
+
110
+ ### Testing Review
111
+
112
+ - [ ] Tests added for new functionality
113
+ - [ ] Tests updated for changed code
114
+ - [ ] Tests not using mock data excessively
115
+ - [ ] Shallow render preferred over mount (unless hooks require mount)
116
+ - [ ] External dependencies mocked
117
+ - [ ] beforeEach and afterAll for mock cleanup
118
+ - [ ] No setTimeout over 100ms
119
+ - [ ] Snapshots avoided (remove when possible)
120
+
121
+ ### App-Specific Review
122
+
123
+ - [ ] Atmos components used (headers, buttons, form fields)
124
+ - [ ] `<TextPassage>` for paragraphs, not `<p>`
125
+ - [ ] `<Currency>` or getFormattedCurrency used, never type: currency
126
+ - [ ] pushRouteWithLocale for navigation
127
+ - [ ] cmsContainer for CMS content
128
+ - [ ] react-redux-form uses model, not state
129
+ - [ ] intl injected at container level only
130
+ - [ ] Variable messages validated before intl usage
131
+
132
+ ### Data and Date Handling
133
+
134
+ - [ ] Service responses validated with null chain operator
135
+ - [ ] Mapper layer between services and store
136
+ - [ ] moment used instead of Date()
137
+ - [ ] Dates not mocked in future
138
+ - [ ] moment.now overridden in tests if needed
139
+
140
+ ## Strongly Recommended Practices
141
+
142
+ ### Review Process
143
+
144
+ - Ask for second review if uncertain about changes
145
+ - Involve previous developers/pod for context
146
+ - Check if data transformations can move to selectors
147
+ - Avoid mocked a11y implementations with aria-label
148
+ - Provide enabler option only for urgent blockers
149
+
150
+ ### Code Quality
151
+
152
+ - Naming is critical: camelCase, PascalCase, UPPER_CASE used correctly
153
+ - Intermediate containers reduce prop drilling
154
+ - DRY principle: Save repeated data in defaulted constants
155
+ - PropTypes in external file for reusability
156
+ - Containers without JSX are easier to maintain
157
+ - Required props clearly marked
158
+
159
+ ### Testing Quality
160
+
161
+ - Use shallow render when possible (less memory)
162
+ - Single component instance per test scope
163
+ - Avoid snapshots
164
+ - Mock external dependencies
165
+ - Quick timeouts (<100ms)
166
+
167
+ ### Optimization
168
+
169
+ - isMobile/IsTablet in CSS preferred over JSX
170
+ - Use reduce loop instead of multiple loops
171
+ - Check `if(array.length)` instead of `if(array.length > 0)`
172
+ - No `!important` in CSS
173
+ - Direct children selector `>` avoided
174
+
175
+ ## Auto-Merge Requirements
176
+
177
+ Auto-merge enabled when:
178
+
179
+ - [ ] Team reviewer approved PR
180
+ - [ ] Approver approved PR
181
+ - [ ] File owners approved (if applicable)
182
+ - [ ] No dismissals from updates (requires re-review)
183
+ - [ ] For release branch: Designated approver signed off
184
+
185
+ ## What NOT to Merge
186
+
187
+ - Global/semiglobal changes without architect review
188
+ - PRs impacting multiple pages/flows without extensive review
189
+ - Missing eQA sign-offs on upstream PRs
190
+ - TODOs or incomplete work
191
+ - Failing tests or coverage decrease
192
+ - Security vulnerabilities
@@ -0,0 +1,204 @@
1
+ ---
2
+ trigger: always_on
3
+ ---
4
+
5
+ # React Component Standards
6
+
7
+ ## Component Architecture
8
+
9
+ ### Separation of Concerns
10
+
11
+ - **Containers**: Connect to Redux, handle business logic, pass props to components
12
+ - **Components**: Pure presentational, receive data via props only
13
+ - **Utils**: Pure functions, no side effects, reusable across project
14
+ - **Selectors**: Data transformation and derivation from Redux state
15
+ - **Sagas**: Side effects and async operations
16
+
17
+ ### Component Design Principles
18
+
19
+ - Keep components stateless whenever possible
20
+ - Single Responsibility Principle: One component, one purpose
21
+ - Composition over inheritance
22
+ - Allow containment through props.children
23
+ - No dependencies on rest of app outside props
24
+
25
+ ## Functional vs Class Components
26
+
27
+ ### Use Functional Components
28
+
29
+ - All new components must be functional with hooks
30
+ - Class components supported but not recommended
31
+ - Lifecycle methods replaced with useEffect
32
+ - Local state managed with useState
33
+
34
+ ### Hooks Usage
35
+
36
+ #### Standard Hooks
37
+
38
+ - **useState**: Local UI state only
39
+ - **useEffect**: Side effects, subscriptions, API calls
40
+ - Be explicit with dependency array
41
+ - Return cleanup functions for subscriptions
42
+ - Avoid infinite loops by managing dependencies carefully
43
+ - **useMemo**: Expensive calculations only (don't overuse)
44
+ - **useCallback**: Prevent unnecessary child re-renders
45
+ - **useRef**: DOM access, storing mutable values that don't trigger re-renders
46
+
47
+ #### Custom Hooks
48
+
49
+ - Declare in `/hooks` directory or component-level
50
+ - Prefix with "use" (e.g., useFormValidation)
51
+ - Extract reusable stateful logic
52
+ - Return values and functions for component use
53
+
54
+ ## JSX Standards
55
+
56
+ ### What TO Put in JSX
57
+
58
+ - Presentational markup and structure
59
+ - Props destructuring and usage
60
+ - Conditional rendering (boolean only)
61
+ - Event handler bindings
62
+ - Component composition
63
+ - Rendering logic from props
64
+
65
+ ### What NOT TO Put in JSX
66
+
67
+ - Business logic - belongs in selectors or utils
68
+ - API calls - belongs in sagas or useEffect
69
+ - Complex data transformations - belongs in selectors
70
+ - Direct DOM manipulation - use refs sparingly
71
+ - State mutations - use setState or Redux actions
72
+
73
+ ### JSX Best Practices
74
+
75
+ - Destructure props at function signature: `const Component = ({prop1, prop2}) => {}`
76
+ - Return early for null/loading states
77
+ - Extract complex conditional JSX to separate components
78
+ - Use ternary or && for simple conditionals only
79
+ - Avoid inline functions in render (use useCallback)
80
+ - Add comments for unclear rendering logic only
81
+
82
+ ## Props Management
83
+
84
+ ### Props Access and Destructuring
85
+
86
+ ```javascript
87
+ // GOOD: Destructure at signature level
88
+ const Component = ({ title, onClick, children }) => {
89
+ return <button onClick={onClick}>{title}</button>;
90
+ };
91
+
92
+ // BAD: Accessing props object
93
+ const Component = (props) => {
94
+ return <button onClick={props.onClick}>{props.title}</button>;
95
+ };
96
+ ```
97
+
98
+ ### Prop Types
99
+
100
+ - Define PropTypes for ALL components
101
+ - Mark required props with .isRequired
102
+ - Use shape() for complex objects
103
+ - Extract shared PropTypes to shapes.js file
104
+ - Provide defaultProps for optional props
105
+
106
+ ### Props Drilling
107
+
108
+ - Maximum 3 levels of prop drilling
109
+ - Beyong 3 levels: Create intermediate container
110
+ - Consider React Context for deep tree data
111
+ - Use Redux for truly global state
112
+
113
+ ## Local State
114
+
115
+ ### When to Use Local State
116
+
117
+ - UI-only concerns (modal open/closed, input focus)
118
+ - Temporary form data before submission
119
+ - Component-specific toggles and flags
120
+ - Animation states
121
+
122
+ ### When NOT to Use Local State
123
+
124
+ - Data from API responses - use Redux
125
+ - Shared data between components - use Redux
126
+ - Form data managed by react-redux-form - use model
127
+ - Data that needs to persist across component unmounts
128
+
129
+ ## Component Complexity
130
+
131
+ ### When to Refactor
132
+
133
+ - Component exceeds well over 200 lines
134
+ - More than 10 props being passed
135
+ - Nested ternary operators (>2 levels)
136
+ - Duplicate logic across components
137
+ - Difficult to write tests for
138
+
139
+ ### Refactoring Strategies
140
+
141
+ - Extract child components
142
+ - Create custom hooks for complex logic
143
+ - Move business logic to selectors
144
+ - Use composition with props.children
145
+ - Split container and presentational concerns
146
+
147
+ ## DOM Access and Manipulation
148
+
149
+ ### Avoid Direct DOM Manipulation
150
+
151
+ - Stay in React domain whenever possible
152
+ - Do NOT use document.querySelector
153
+ - Do NOT manipulate DOM with vanilla JS
154
+ - Use React refs only when necessary
155
+
156
+ ### When to Use Refs
157
+
158
+ - Focus management
159
+ - Integration with third-party DOM libraries
160
+ - Measuring DOM nodes (scroll position, dimensions)
161
+ - Triggering imperative animations
162
+
163
+ ### Ref Best Practices
164
+
165
+ - Use useRef hook in functional components
166
+ - Assign refs to DOM elements, not React components
167
+ - Access refs in useEffect or event handlers, not render
168
+ - Clean up refs in useEffect return function
169
+
170
+ ## Methods Returning JSX
171
+
172
+ ### Create Proper Components
173
+
174
+ ```jsx
175
+ // GOOD: Separate component
176
+ const FeatureDisplay = ({ feature, value }) => (
177
+ <div>
178
+ {feature}: {value}
179
+ </div>
180
+ );
181
+
182
+ const ParentComponent = ({ data }) => (
183
+ <FeatureDisplay feature={data.name} value={data.value} />
184
+ );
185
+
186
+ // BAD: Method returning JSX
187
+ const ParentComponent = ({ data }) => {
188
+ const renderFeature = (name, value) => (
189
+ <div>
190
+ {name}: {value}
191
+ </div>
192
+ );
193
+
194
+ return renderFeature(data.name, data.value);
195
+ };
196
+ ```
197
+
198
+ ### Why Proper Components
199
+
200
+ - Clear component interface (props)
201
+ - Easier to test
202
+ - Avoids stale closures
203
+ - Enables reusability
204
+ - Better React DevTools visibility