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.
- package/LICENSE +21 -0
- package/README.md +37 -0
- package/bin/init.js +257 -0
- package/package.json +56 -0
- package/templates/accessibility/.cursorrules +342 -0
- package/templates/accessibility/README.md +47 -0
- package/templates/antigravity/accessibility/.agent/rules/accessibility.md +501 -0
- package/templates/antigravity/accessibility/.agent/rules/aria-patterns.md +568 -0
- package/templates/antigravity/accessibility/.agent/rules/wcag-standard.md +225 -0
- package/templates/antigravity/accessibility/README.md +42 -0
- package/templates/antigravity/minimal/.agent/rules/accessibility.md +53 -0
- package/templates/antigravity/minimal/.agent/rules/code-quality.md +86 -0
- package/templates/antigravity/minimal/.agent/rules/react-components.md +164 -0
- package/templates/antigravity/minimal/README.md +34 -0
- package/templates/antigravity/standard/.agent/rules/accessibility.md +98 -0
- package/templates/antigravity/standard/.agent/rules/code-quality.md +166 -0
- package/templates/antigravity/standard/.agent/rules/pull-request-review.md +192 -0
- package/templates/antigravity/standard/.agent/rules/react-components.md +204 -0
- package/templates/antigravity/standard/.agent/rules/testing.md +197 -0
- package/templates/antigravity/standard/README.md +39 -0
- package/templates/antigravity/strict/.agent/README.md +46 -0
- package/templates/antigravity/strict/.agent/rules/accessibility.md +199 -0
- package/templates/antigravity/strict/.agent/rules/code-quality.md +268 -0
- package/templates/antigravity/strict/.agent/rules/pull-request-review.md +114 -0
- package/templates/antigravity/strict/.agent/rules/react-components.md +423 -0
- package/templates/antigravity/strict/.agent/rules/security.md +483 -0
- package/templates/antigravity/strict/.agent/rules/testing.md +280 -0
- package/templates/minimal/.cursorrules +48 -0
- package/templates/minimal/README.md +40 -0
- package/templates/standard/.cursorrules +184 -0
- package/templates/standard/README.md +43 -0
- package/templates/strict/.cursorrules +227 -0
- package/templates/strict/README.md +47 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: always_on
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Code Quality Standards - STRICT (Maximum Enforcement)
|
|
6
|
+
|
|
7
|
+
## Why Maximum Quality Matters
|
|
8
|
+
|
|
9
|
+
- ZERO tolerance for technical debt
|
|
10
|
+
- Production defects are unacceptable
|
|
11
|
+
- Code MUST be maintainable by any team member
|
|
12
|
+
- Every line of code is reviewed for quality
|
|
13
|
+
- Quality metrics MUST be met before merge
|
|
14
|
+
|
|
15
|
+
### File Organization - ZERO TOLERANCE
|
|
16
|
+
|
|
17
|
+
- One component per file (no exceptions)
|
|
18
|
+
- Maximum file size: 300 lines (includes comments)
|
|
19
|
+
- Related files grouped in directories
|
|
20
|
+
- Import order MUST be: React, third-party, local (enforced by ESLint)
|
|
21
|
+
|
|
22
|
+
## Naming Conventions - STRICT ENFORCEMENT
|
|
23
|
+
|
|
24
|
+
### MUST Follow These Rules
|
|
25
|
+
|
|
26
|
+
- **Variables**: camelCase, min 3 chars, max 30 chars (isUserAuthenticated)
|
|
27
|
+
- **Functions**: camelCase, verb-based (getUserData, not user)
|
|
28
|
+
- **Components**: PascalCase, noun-based (UserProfile, not Profile)
|
|
29
|
+
- **Constants**: UPPER_SNAKE_CASE (MAX_RETRY_ATTEMPTS)
|
|
30
|
+
- **Booleans**: is/has/should prefix (isLoading, hasError, shouldDisplay)
|
|
31
|
+
- **Event handlers**: handle prefix (handleClick, handleSubmit)
|
|
32
|
+
- **Files**: kebab-case (user-profile.jsx, not UserProfile.jsx)
|
|
33
|
+
|
|
34
|
+
### Naming Violations = PR Rejection
|
|
35
|
+
|
|
36
|
+
- Abbreviations (use full words)
|
|
37
|
+
- Generic names (data, info, temp, result)
|
|
38
|
+
- Single letter variables (except i, j in loops)
|
|
39
|
+
- Unclear names (doStuff, process, handle)
|
|
40
|
+
|
|
41
|
+
## TypeScript - MANDATORY
|
|
42
|
+
|
|
43
|
+
### Type Safety - STRICT
|
|
44
|
+
|
|
45
|
+
- TypeScript REQUIRED for ALL new code
|
|
46
|
+
- Strict mode enabled in tsconfig.json
|
|
47
|
+
- NO `any` type (use `unknown` if needed, with validation)
|
|
48
|
+
- NO `@ts-ignore` without written approval
|
|
49
|
+
- NO implicit returns
|
|
50
|
+
- ALL functions MUST have explicit return types
|
|
51
|
+
- ALL props MUST be typed (interfaces, not types)
|
|
52
|
+
|
|
53
|
+
### Type Violations = PR Rejection
|
|
54
|
+
|
|
55
|
+
- Any use of `any` type
|
|
56
|
+
- Missing type annotations
|
|
57
|
+
- Implicit any
|
|
58
|
+
- Type assertions without justification
|
|
59
|
+
|
|
60
|
+
## JavaScript/TypeScript - ZERO TOLERANCE
|
|
61
|
+
|
|
62
|
+
### Prohibited Patterns - IMMEDIATE REJECTION
|
|
63
|
+
|
|
64
|
+
- NO `var` declarations (use const/let)
|
|
65
|
+
- NO `console.log`, `console.warn`, `console.error` (use logging utility)
|
|
66
|
+
- NO `debugger` statements
|
|
67
|
+
- NO `==` or `!=` (use `===` and `!==`)
|
|
68
|
+
- NO `eval()` or `Function()` constructor
|
|
69
|
+
- NO `with` statements
|
|
70
|
+
- NO `for...in` loops (use Object.keys(), Object.entries())
|
|
71
|
+
- NO `forEach` (use map, filter, reduce, for...of)
|
|
72
|
+
- NO anonymous functions as event handlers
|
|
73
|
+
- NO `window` or `document` access (use approved utilities)
|
|
74
|
+
- NO `Date()` constructor (use moment or date-fns)
|
|
75
|
+
- NO mutations of props or state
|
|
76
|
+
- NO eslint-disable without architect approval
|
|
77
|
+
|
|
78
|
+
### Code Metrics - MANDATORY LIMITS
|
|
79
|
+
|
|
80
|
+
- Maximum function length: 40 lines
|
|
81
|
+
- Maximum file length: 300 lines
|
|
82
|
+
- Maximum cyclomatic complexity: 10
|
|
83
|
+
- Maximum function parameters: 4
|
|
84
|
+
- Maximum nesting depth: 3
|
|
85
|
+
- Minimum test coverage: 90%
|
|
86
|
+
|
|
87
|
+
### Function Requirements - STRICT
|
|
88
|
+
|
|
89
|
+
- Functions MUST be pure when possible (no side effects)
|
|
90
|
+
- Functions MUST do ONE thing only
|
|
91
|
+
- Functions MUST have explicit return types (TypeScript)
|
|
92
|
+
- Functions MUST be documented with JSDoc
|
|
93
|
+
- Complex functions MUST include examples in JSDoc
|
|
94
|
+
|
|
95
|
+
## Component Standards - MAXIMUM ENFORCEMENT
|
|
96
|
+
|
|
97
|
+
### Component Requirements - ALL MANDATORY
|
|
98
|
+
|
|
99
|
+
- Functional components with hooks ONLY (no class components)
|
|
100
|
+
- Maximum component size: 150 lines (not 200)
|
|
101
|
+
- PropTypes AND TypeScript interfaces REQUIRED
|
|
102
|
+
- JSDoc comments REQUIRED for all exported components
|
|
103
|
+
- Performance budget: <100ms render time
|
|
104
|
+
- ALL components MUST be testable (no untestable code)
|
|
105
|
+
|
|
106
|
+
### Props - STRICT RULES
|
|
107
|
+
|
|
108
|
+
- Destructure props at function signature (MANDATORY)
|
|
109
|
+
- PropTypes marked .isRequired for ALL required props
|
|
110
|
+
- defaultProps provided for ALL optional props
|
|
111
|
+
- NO prop drilling beyond 2 levels (not 3 - stricter)
|
|
112
|
+
- Props MUST be immutable (no mutations)
|
|
113
|
+
|
|
114
|
+
### Hooks - ZERO TOLERANCE
|
|
115
|
+
|
|
116
|
+
- useEffect dependencies MUST be complete (exhaustive-deps enforced)
|
|
117
|
+
- Cleanup functions REQUIRED for ALL subscriptions
|
|
118
|
+
- NO hooks in loops, conditions, or nested functions
|
|
119
|
+
- Custom hooks MUST start with "use" prefix
|
|
120
|
+
- useCallback REQUIRED for ALL callback props
|
|
121
|
+
- useMemo REQUIRED for objects/arrays passed as props
|
|
122
|
+
|
|
123
|
+
## JSX - STRICT ENFORCEMENT
|
|
124
|
+
|
|
125
|
+
### MANDATORY Rules
|
|
126
|
+
|
|
127
|
+
- NO anonymous functions in JSX
|
|
128
|
+
- NO inline styles (styled-components or CSS modules ONLY)
|
|
129
|
+
- NO array index as key (data-based keys ONLY)
|
|
130
|
+
- NO non-boolean conditional rendering
|
|
131
|
+
- NO nested ternaries (extract to variables or functions)
|
|
132
|
+
- NO complex logic in JSX (extract to functions)
|
|
133
|
+
- Fragments `<></>` instead of divs (when no styling needed)
|
|
134
|
+
|
|
135
|
+
## State Management - STRICT
|
|
136
|
+
|
|
137
|
+
### Redux - MANDATORY PATTERNS
|
|
138
|
+
|
|
139
|
+
- Redux Toolkit REQUIRED for ALL state management
|
|
140
|
+
- NO Redux Thunk (use Redux Saga only)
|
|
141
|
+
- Immutability MUST be maintained (no mutations)
|
|
142
|
+
- State MUST be normalized (no nested structures)
|
|
143
|
+
- Selectors REQUIRED for ALL state access
|
|
144
|
+
- NO direct state access in components
|
|
145
|
+
|
|
146
|
+
### Local State - STRICT LIMITS
|
|
147
|
+
|
|
148
|
+
- Local state ONLY for UI (modals, toggles, focus)
|
|
149
|
+
- NO business logic in local state
|
|
150
|
+
- NO API data in local state (use Redux)
|
|
151
|
+
- NO shared state in local state (use Redux)
|
|
152
|
+
|
|
153
|
+
## Styling - STRICT REQUIREMENTS
|
|
154
|
+
|
|
155
|
+
### CSS/SCSS - MANDATORY
|
|
156
|
+
|
|
157
|
+
- Mobile-first approach ONLY (no max-width queries)
|
|
158
|
+
- NO `:global` styles (automatic PR rejection)
|
|
159
|
+
- Atmos utility classes ONLY (atm-u, not atm-c)
|
|
160
|
+
- ALL CSS MUST have parent class selector
|
|
161
|
+
- NO `!important` (find proper solution)
|
|
162
|
+
- Color contrast MUST meet 4.5:1 (tested with analyzer)
|
|
163
|
+
|
|
164
|
+
### Performance - MANDATORY
|
|
165
|
+
|
|
166
|
+
- Critical CSS must be inline
|
|
167
|
+
- Non-critical CSS must be deferred
|
|
168
|
+
- CSS bundle < 50KB gzipped
|
|
169
|
+
- NO unused CSS (purge in build)
|
|
170
|
+
|
|
171
|
+
## Security - ZERO TOLERANCE
|
|
172
|
+
|
|
173
|
+
### Mandatory Security Practices
|
|
174
|
+
|
|
175
|
+
- ALL user inputs MUST be validated with schemas
|
|
176
|
+
- ALL data MUST be sanitized before rendering
|
|
177
|
+
- ALL API responses MUST be validated
|
|
178
|
+
- NO `dangerouslySetInnerHTML` without sanitization
|
|
179
|
+
- NO inline event handlers in HTML
|
|
180
|
+
- NO sensitive data in localStorage (use secure alternatives)
|
|
181
|
+
- NO API keys in code (environment variables ONLY)
|
|
182
|
+
|
|
183
|
+
### PII/PCI - STRICT COMPLIANCE
|
|
184
|
+
|
|
185
|
+
- Credit cards MUST show only last 4 digits
|
|
186
|
+
- PII MUST be masked in ALL logs
|
|
187
|
+
- Passwords MUST NEVER be logged
|
|
188
|
+
- Session tokens MUST use httpOnly cookies
|
|
189
|
+
- NO PII/PCI data in Redux DevTools
|
|
190
|
+
|
|
191
|
+
## Testing - 90% COVERAGE MINIMUM
|
|
192
|
+
|
|
193
|
+
### Coverage Requirements - MANDATORY
|
|
194
|
+
|
|
195
|
+
- Overall coverage: 90% minimum (not 80%)
|
|
196
|
+
- Statement coverage: 90%
|
|
197
|
+
- Branch coverage: 85%
|
|
198
|
+
- Function coverage: 90%
|
|
199
|
+
- Line coverage: 90%
|
|
200
|
+
- Coverage decrease = automatic PR rejection
|
|
201
|
+
|
|
202
|
+
### Test Quality - STRICT
|
|
203
|
+
|
|
204
|
+
- NO snapshot tests (explicit assertions ONLY)
|
|
205
|
+
- NO `test.skip` or `test.only` in committed code
|
|
206
|
+
- NO flaky tests (must pass 100% of time)
|
|
207
|
+
- Mock ALL external dependencies
|
|
208
|
+
- Cleanup ALL mocks with afterEach
|
|
209
|
+
- Test names MUST be descriptive
|
|
210
|
+
|
|
211
|
+
## Performance - STRICT BUDGETS
|
|
212
|
+
|
|
213
|
+
### Performance Budgets - MANDATORY
|
|
214
|
+
|
|
215
|
+
- Initial bundle size: <200KB gzipped
|
|
216
|
+
- Time to Interactive: <3s on 3G
|
|
217
|
+
- Lighthouse performance score: >90
|
|
218
|
+
- Largest Contentful Paint: <2.5s
|
|
219
|
+
- First Input Delay: <100ms
|
|
220
|
+
- Cumulative Layout Shift: <0.1
|
|
221
|
+
|
|
222
|
+
### Optimization - REQUIRED
|
|
223
|
+
|
|
224
|
+
- Code splitting REQUIRED for ALL routes
|
|
225
|
+
- Lazy loading REQUIRED for images
|
|
226
|
+
- Tree shaking REQUIRED
|
|
227
|
+
- Bundle analysis REQUIRED before release
|
|
228
|
+
- List virtualization REQUIRED for >50 items
|
|
229
|
+
|
|
230
|
+
## Documentation - MANDATORY
|
|
231
|
+
|
|
232
|
+
### Required Documentation
|
|
233
|
+
|
|
234
|
+
- JSDoc for ALL exported functions
|
|
235
|
+
- JSDoc for ALL components
|
|
236
|
+
- README updates for new features
|
|
237
|
+
- CHANGELOG entry for ALL changes
|
|
238
|
+
- Architecture Decision Records for major changes
|
|
239
|
+
- Migration guides for breaking changes
|
|
240
|
+
|
|
241
|
+
## PR Requirements - STRICT ENFORCEMENT
|
|
242
|
+
|
|
243
|
+
### Pre-PR Checklist - ALL REQUIRED
|
|
244
|
+
|
|
245
|
+
- [ ] ALL tests pass (no exceptions)
|
|
246
|
+
- [ ] ZERO linting errors or warnings
|
|
247
|
+
- [ ] Coverage at 90%+ (not decreased)
|
|
248
|
+
- [ ] Bundle size within budget
|
|
249
|
+
- [ ] Performance tests pass
|
|
250
|
+
- [ ] Security scan passes (no vulnerabilities)
|
|
251
|
+
- [ ] Accessibility audit passes (Lighthouse 100)
|
|
252
|
+
- [ ] Self-review completed with checklist
|
|
253
|
+
- [ ] Documentation updated
|
|
254
|
+
|
|
255
|
+
## Enforcement - AUTOMATIC REJECTION
|
|
256
|
+
|
|
257
|
+
### These Cause Immediate PR Rejection
|
|
258
|
+
|
|
259
|
+
- Extreme use of `any` type in TypeScript
|
|
260
|
+
- console.log statements
|
|
261
|
+
- Failing tests
|
|
262
|
+
- Coverage below 90%
|
|
263
|
+
- Linting errors
|
|
264
|
+
- Accessibility score < 100
|
|
265
|
+
- Security vulnerabilities
|
|
266
|
+
- Bundle size over budget
|
|
267
|
+
- Missing documentation
|
|
268
|
+
- Incomplete checklist
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: always_on
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Pull Request Standards - STRICT (Maximum Enforcement)
|
|
6
|
+
|
|
7
|
+
## PR Requirements - ALL MANDATORY
|
|
8
|
+
|
|
9
|
+
### Pre-PR Checklist - MUST BE COMPLETE
|
|
10
|
+
|
|
11
|
+
- [ ] ALL tests pass locally (100% pass rate)
|
|
12
|
+
- [ ] ZERO linting errors or warnings
|
|
13
|
+
- [ ] Coverage at 90%+ (component coverage 100%)
|
|
14
|
+
- [ ] Bundle size within budget (<200KB gzipped)
|
|
15
|
+
- [ ] Performance tests pass (Lighthouse >90)
|
|
16
|
+
- [ ] Security scan passes (zero vulnerabilities)
|
|
17
|
+
- [ ] Accessibility audit passes (Lighthouse 100)
|
|
18
|
+
- [ ] Type checking passes (zero TypeScript errors)
|
|
19
|
+
- [ ] Self-review completed with full checklist
|
|
20
|
+
- [ ] Documentation updated (README, JSDoc)
|
|
21
|
+
- [ ] CHANGELOG.md updated
|
|
22
|
+
- [ ] Migration guide written (if breaking changes)
|
|
23
|
+
- [ ] Desk check completed with accessibility tools
|
|
24
|
+
- [ ] Screen reader testing completed (for UI changes)
|
|
25
|
+
|
|
26
|
+
### PR Description - STRICT FORMAT REQUIRED
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
## Description
|
|
30
|
+
|
|
31
|
+
[Clear explanation of changes and WHY, not just WHAT]
|
|
32
|
+
|
|
33
|
+
## Type of Change
|
|
34
|
+
|
|
35
|
+
- [ ] Bug fix
|
|
36
|
+
- [ ] New feature
|
|
37
|
+
- [ ] Breaking change
|
|
38
|
+
- [ ] Documentation update
|
|
39
|
+
- [ ] Performance improvement
|
|
40
|
+
- [ ] Refactoring
|
|
41
|
+
|
|
42
|
+
## Related Issues
|
|
43
|
+
|
|
44
|
+
Fixes #[issue-number]
|
|
45
|
+
Relates to #[issue-number]
|
|
46
|
+
|
|
47
|
+
## Testing
|
|
48
|
+
|
|
49
|
+
### Test Coverage
|
|
50
|
+
|
|
51
|
+
- Previous: X%
|
|
52
|
+
- Current: Y%
|
|
53
|
+
- Change: +Z%
|
|
54
|
+
|
|
55
|
+
### Manual Testing
|
|
56
|
+
|
|
57
|
+
- [ ] Tested on Chrome
|
|
58
|
+
- [ ] Tested on Firefox
|
|
59
|
+
- [ ] Tested on Safari
|
|
60
|
+
- [ ] Tested on Edge
|
|
61
|
+
- [ ] Tested on mobile (iOS)
|
|
62
|
+
- [ ] Tested on mobile (Android)
|
|
63
|
+
- [ ] Keyboard navigation tested
|
|
64
|
+
- [ ] Screen reader tested (NVDA/VoiceOver)
|
|
65
|
+
|
|
66
|
+
### Testing Instructions
|
|
67
|
+
|
|
68
|
+
1. Step-by-step instructions to test the changes
|
|
69
|
+
2. Include specific test cases
|
|
70
|
+
3. Include edge cases tested
|
|
71
|
+
|
|
72
|
+
## Performance Impact
|
|
73
|
+
|
|
74
|
+
- Bundle size change: +X KB
|
|
75
|
+
- Lighthouse score: X/100
|
|
76
|
+
- Load time impact: +X ms
|
|
77
|
+
- Render time: X ms
|
|
78
|
+
|
|
79
|
+
## Accessibility Impact
|
|
80
|
+
|
|
81
|
+
- Lighthouse accessibility score: 100/100
|
|
82
|
+
- Keyboard navigation: Fully supported
|
|
83
|
+
- Screen reader: Tested with [NVDA/VoiceOver]
|
|
84
|
+
- Color contrast: All ratios >4.5:1
|
|
85
|
+
|
|
86
|
+
## Screenshots/Videos
|
|
87
|
+
|
|
88
|
+
[Include for ALL UI changes]
|
|
89
|
+
|
|
90
|
+
### Before
|
|
91
|
+
|
|
92
|
+
[Screenshot/video of old behavior]
|
|
93
|
+
|
|
94
|
+
### After
|
|
95
|
+
|
|
96
|
+
[Screenshot/video of new behavior]
|
|
97
|
+
|
|
98
|
+
## Breaking Changes
|
|
99
|
+
|
|
100
|
+
[If any, list them with migration instructions]
|
|
101
|
+
|
|
102
|
+
## Checklist
|
|
103
|
+
|
|
104
|
+
- [ ] Code follows style guidelines
|
|
105
|
+
- [ ] Self-review completed
|
|
106
|
+
- [ ] Comments added for complex logic
|
|
107
|
+
- [ ] Documentation updated
|
|
108
|
+
- [ ] No new warnings
|
|
109
|
+
- [ ] Tests added/updated
|
|
110
|
+
- [ ] All tests pass
|
|
111
|
+
- [ ] Coverage maintained/increased
|
|
112
|
+
- [ ] Accessibility tested
|
|
113
|
+
- [ ] Performance tested
|
|
114
|
+
```
|