codingwithagent 1.0.0 → 1.1.1

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 (34) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE +21 -21
  3. package/README.md +131 -37
  4. package/bin/init.js +257 -257
  5. package/package.json +56 -56
  6. package/templates/accessibility/.cursorrules +342 -342
  7. package/templates/accessibility/README.md +47 -47
  8. package/templates/antigravity/accessibility/.agent/rules/accessibility.md +501 -501
  9. package/templates/antigravity/accessibility/.agent/rules/aria-patterns.md +568 -568
  10. package/templates/antigravity/accessibility/.agent/rules/wcag-standard.md +225 -225
  11. package/templates/antigravity/accessibility/README.md +42 -42
  12. package/templates/antigravity/minimal/.agent/rules/accessibility.md +53 -53
  13. package/templates/antigravity/minimal/.agent/rules/code-quality.md +86 -86
  14. package/templates/antigravity/minimal/.agent/rules/react-components.md +164 -164
  15. package/templates/antigravity/minimal/README.md +34 -34
  16. package/templates/antigravity/standard/.agent/rules/accessibility.md +98 -98
  17. package/templates/antigravity/standard/.agent/rules/code-quality.md +166 -166
  18. package/templates/antigravity/standard/.agent/rules/pull-request-review.md +192 -192
  19. package/templates/antigravity/standard/.agent/rules/react-components.md +204 -204
  20. package/templates/antigravity/standard/.agent/rules/testing.md +197 -197
  21. package/templates/antigravity/standard/README.md +39 -39
  22. package/templates/antigravity/strict/.agent/README.md +46 -46
  23. package/templates/antigravity/strict/.agent/rules/accessibility.md +199 -199
  24. package/templates/antigravity/strict/.agent/rules/code-quality.md +268 -268
  25. package/templates/antigravity/strict/.agent/rules/pull-request-review.md +114 -114
  26. package/templates/antigravity/strict/.agent/rules/react-components.md +423 -423
  27. package/templates/antigravity/strict/.agent/rules/security.md +483 -483
  28. package/templates/antigravity/strict/.agent/rules/testing.md +280 -280
  29. package/templates/minimal/.cursorrules +48 -48
  30. package/templates/minimal/README.md +40 -40
  31. package/templates/standard/.cursorrules +184 -184
  32. package/templates/standard/README.md +43 -43
  33. package/templates/strict/.cursorrules +227 -227
  34. package/templates/strict/README.md +47 -47
@@ -1,280 +1,280 @@
1
- ---
2
- trigger: always_on
3
- ---
4
-
5
- ---
6
-
7
- # Testing Standards - STRICT (90% Coverage Minimum)
8
-
9
- ## Testing Philosophy - ZERO TOLERANCE
10
-
11
- - 90% coverage MINIMUM (not 80%)
12
- - ALL new code MUST have tests before PR
13
- - Tests are NOT optional
14
- - Coverage decrease = automatic PR rejection
15
- - Flaky tests = automatic PR rejection
16
- - Tests MUST catch real bugs
17
-
18
- ## Coverage Requirements - MANDATORY
19
-
20
- ### Minimum Coverage - HARD LIMITS
21
-
22
- - Overall coverage: 90% (no exceptions)
23
- - Statement coverage: 90%
24
- - Branch coverage: 85%
25
- - Function coverage: 90%
26
- - Line coverage: 90%
27
- - Components: 100% coverage REQUIRED
28
-
29
- ### Coverage Enforcement
30
-
31
- - CI/CD blocks merge if coverage < 90%
32
- - Coverage reports REQUIRED in every PR
33
- - Coverage badge MUST be green
34
- - Coverage decrease by >1% = automatic rejection
35
-
36
- ## Unit Testing - STRICT STANDARDS
37
-
38
- ### What MUST Be Tested - ALL REQUIRED
39
-
40
- - ALL exported functions
41
- - ALL components (100% coverage)
42
- - ALL conditional logic paths
43
- - ALL event handlers
44
- - ALL hooks (custom and standard)
45
- - ALL error states
46
- - ALL loading states
47
- - ALL edge cases
48
-
49
- ### What NOT to Test
50
-
51
- - Third-party library internals ONLY
52
- - Trivial getters/setters ONLY if truly trivial
53
- - Constants (unless computed)
54
-
55
- ### Test Structure - MANDATORY FORMAT
56
-
57
- ```typescript
58
- describe("ComponentName", () => {
59
- // Setup
60
- let wrapper: ShallowWrapper;
61
- let props: Props;
62
-
63
- beforeEach(() => {
64
- props = {
65
- // complete props with realistic values
66
- };
67
- });
68
-
69
- afterEach(() => {
70
- jest.clearAllMocks();
71
- });
72
-
73
- afterAll(() => {
74
- jest.restoreAllMocks();
75
- });
76
-
77
- // Tests grouped by functionality
78
- describe("rendering", () => {
79
- it("should render with required props only", () => {
80
- wrapper = shallow(<ComponentName {...props} />);
81
- expect(wrapper.exists()).toBe(true);
82
- });
83
-
84
- it("should display title when provided", () => {
85
- wrapper = shallow(<ComponentName {...props} title="Test" />);
86
- expect(wrapper.find(".title").text()).toBe("Test");
87
- });
88
- });
89
-
90
- describe("user interactions", () => {
91
- it("should call onClick handler when button clicked", () => {
92
- const mockOnClick = jest.fn();
93
- wrapper = shallow(<ComponentName {...props} onClick={mockOnClick} />);
94
-
95
- wrapper.find("button").simulate("click");
96
-
97
- expect(mockOnClick).toHaveBeenCalledTimes(1);
98
- expect(mockOnClick).toHaveBeenCalledWith(/* expected args */);
99
- });
100
- });
101
-
102
- describe("error handling", () => {
103
- it("should display error message when error prop provided", () => {
104
- wrapper = shallow(<ComponentName {...props} error="Error occurred" />);
105
- expect(wrapper.find(".error").text()).toBe("Error occurred");
106
- });
107
- });
108
- });
109
- ```
110
-
111
- ### Test Naming - STRICT REQUIREMENTS
112
-
113
- - Format: "should [expected behavior] when [condition]"
114
- - Be SPECIFIC (no "works correctly", "renders", "is defined")
115
- - Test names MUST describe user behavior
116
-
117
- ```typescript
118
- // CORRECT
119
- it("should disable submit button when form is invalid", () => {});
120
- it("should display error message when API call fails", () => {});
121
- it("should focus input when modal opens", () => {});
122
-
123
- // INCORRECT - TOO VAGUE
124
- it("works", () => {}); // REJECTED
125
- it("renders correctly", () => {}); // REJECTED
126
- it("handles errors", () => {}); // REJECTED
127
- ```
128
-
129
- ## Component Testing - 100% COVERAGE REQUIRED
130
-
131
- ### ALL These MUST Be Tested
132
-
133
- - Rendering with all prop combinations
134
- - All conditional rendering paths
135
- - All event handlers
136
- - All state changes
137
- - All hooks and their effects
138
- - All error boundaries
139
- - All loading states
140
- - Accessibility (keyboard, ARIA)
141
-
142
- ### Rendering Tests - MANDATORY
143
-
144
- ```typescript
145
- // Test all prop combinations
146
- it("should render with minimal props", () => {});
147
- it("should render with all optional props", () => {});
148
- it("should render in loading state", () => {});
149
- it("should render in error state", () => {});
150
- it("should render when data is empty", () => {});
151
- it("should render when data is populated", () => {});
152
- ```
153
-
154
- ### Interaction Tests - ALL REQUIRED
155
-
156
- ```typescript
157
- // Test ALL user interactions
158
- it("should call onClick when button clicked", () => {});
159
- it("should prevent default on form submit", () => {});
160
- it("should update state when input changes", () => {});
161
- it("should call onSubmit with form data", () => {});
162
- it("should focus input on mount", () => {});
163
- it("should trap focus in modal", () => {});
164
- ```
165
-
166
- ### Accessibility Tests - MANDATORY
167
-
168
- ```typescript
169
- // Test keyboard navigation
170
- it("should be focusable with Tab key", () => {});
171
- it("should activate with Enter key", () => {});
172
- it("should close with Escape key", () => {});
173
-
174
- // Test ARIA attributes
175
- it("should have correct aria-label", () => {});
176
- it("should announce errors to screen readers", () => {});
177
- it("should have proper role attribute", () => {});
178
- ```
179
-
180
- ## Hooks Testing - STRICT REQUIREMENTS
181
-
182
- ### Custom Hooks - 100% Coverage
183
-
184
- ```typescript
185
- import { renderHook, act } from "@testing-library/react-hooks";
186
-
187
- describe("useCustomHook", () => {
188
- it("should initialize with default value", () => {
189
- const { result } = renderHook(() => useCustomHook());
190
- expect(result.current.value).toBe(defaultValue);
191
- });
192
-
193
- it("should update value when action called", () => {
194
- const { result } = renderHook(() => useCustomHook());
195
-
196
- act(() => {
197
- result.current.updateValue(newValue);
198
- });
199
-
200
- expect(result.current.value).toBe(newValue);
201
- });
202
-
203
- it("should cleanup on unmount", () => {
204
- const cleanup = jest.fn();
205
- const { unmount } = renderHook(() => useCustomHook(cleanup));
206
-
207
- unmount();
208
-
209
- expect(cleanup).toHaveBeenCalledTimes(1);
210
- });
211
- });
212
- ```
213
-
214
- ## Mocking - STRICT STANDARDS
215
-
216
- ### MUST Mock These
217
-
218
- - All external API calls
219
- - ALL Redux store and actions
220
- - ALL browser APIs (localStorage, window, document)
221
- - ALL third-party libraries
222
- - ALL time-dependent functions (Date, moment)
223
- - ALL file system operations
224
- - ALL network requests
225
-
226
- ### Mock Pattern - MANDATORY
227
-
228
- ```typescript
229
- // Mock at top of file
230
- jest.mock("../utils/api", () => ({
231
- fetchData: jest.fn(),
232
- postData: jest.fn(),
233
- }));
234
-
235
- // Use in tests
236
- import { fetchData } from "../utils/api";
237
-
238
- describe("Component", () => {
239
- beforeEach(() => {
240
- (fetchData as jest.Mock).mockResolvedValue({ data: "test" });
241
- });
242
-
243
- afterEach(() => {
244
- jest.clearAllMocks();
245
- });
246
-
247
- afterAll(() => {
248
- jest.restoreAllMocks();
249
- });
250
- });
251
- ```
252
-
253
- ### What NOT to Mock
254
-
255
- - Component's own functions (test real behavior)
256
- - Simple utility functions (test actual implementation)
257
- - React internals (useState, useEffect, etc.)
258
- - PropTypes validation
259
-
260
- ## Test Quality - STRICT ENFORCEMENT
261
-
262
- ### Prohibited - AUTOMATIC REJECTION
263
-
264
- - NO snapshot tests (explicit assertions ONLY)
265
- - NO test.skip in committed code
266
- - NO test.only in committed code
267
- - NO fit or fdescribe
268
- - NO flaky tests (must pass 100% of time)
269
- - NO setTimeout > 100ms
270
- - NO tests depending on execution order
271
- - NO tests with side effects
272
-
273
- ### Required - ALL MANDATORY
274
-
275
- - Descriptive test names
276
- - Arrange-Act-Assert pattern
277
- - Independent tests (no shared state)
278
- - Fast tests (<100ms per test)
279
- - Deterministic tests (same input = same output)
280
- - Isolated tests (mock external dependencies)
1
+ ---
2
+ trigger: always_on
3
+ ---
4
+
5
+ ---
6
+
7
+ # Testing Standards - STRICT (90% Coverage Minimum)
8
+
9
+ ## Testing Philosophy - ZERO TOLERANCE
10
+
11
+ - 90% coverage MINIMUM (not 80%)
12
+ - ALL new code MUST have tests before PR
13
+ - Tests are NOT optional
14
+ - Coverage decrease = automatic PR rejection
15
+ - Flaky tests = automatic PR rejection
16
+ - Tests MUST catch real bugs
17
+
18
+ ## Coverage Requirements - MANDATORY
19
+
20
+ ### Minimum Coverage - HARD LIMITS
21
+
22
+ - Overall coverage: 90% (no exceptions)
23
+ - Statement coverage: 90%
24
+ - Branch coverage: 85%
25
+ - Function coverage: 90%
26
+ - Line coverage: 90%
27
+ - Components: 100% coverage REQUIRED
28
+
29
+ ### Coverage Enforcement
30
+
31
+ - CI/CD blocks merge if coverage < 90%
32
+ - Coverage reports REQUIRED in every PR
33
+ - Coverage badge MUST be green
34
+ - Coverage decrease by >1% = automatic rejection
35
+
36
+ ## Unit Testing - STRICT STANDARDS
37
+
38
+ ### What MUST Be Tested - ALL REQUIRED
39
+
40
+ - ALL exported functions
41
+ - ALL components (100% coverage)
42
+ - ALL conditional logic paths
43
+ - ALL event handlers
44
+ - ALL hooks (custom and standard)
45
+ - ALL error states
46
+ - ALL loading states
47
+ - ALL edge cases
48
+
49
+ ### What NOT to Test
50
+
51
+ - Third-party library internals ONLY
52
+ - Trivial getters/setters ONLY if truly trivial
53
+ - Constants (unless computed)
54
+
55
+ ### Test Structure - MANDATORY FORMAT
56
+
57
+ ```typescript
58
+ describe("ComponentName", () => {
59
+ // Setup
60
+ let wrapper: ShallowWrapper;
61
+ let props: Props;
62
+
63
+ beforeEach(() => {
64
+ props = {
65
+ // complete props with realistic values
66
+ };
67
+ });
68
+
69
+ afterEach(() => {
70
+ jest.clearAllMocks();
71
+ });
72
+
73
+ afterAll(() => {
74
+ jest.restoreAllMocks();
75
+ });
76
+
77
+ // Tests grouped by functionality
78
+ describe("rendering", () => {
79
+ it("should render with required props only", () => {
80
+ wrapper = shallow(<ComponentName {...props} />);
81
+ expect(wrapper.exists()).toBe(true);
82
+ });
83
+
84
+ it("should display title when provided", () => {
85
+ wrapper = shallow(<ComponentName {...props} title="Test" />);
86
+ expect(wrapper.find(".title").text()).toBe("Test");
87
+ });
88
+ });
89
+
90
+ describe("user interactions", () => {
91
+ it("should call onClick handler when button clicked", () => {
92
+ const mockOnClick = jest.fn();
93
+ wrapper = shallow(<ComponentName {...props} onClick={mockOnClick} />);
94
+
95
+ wrapper.find("button").simulate("click");
96
+
97
+ expect(mockOnClick).toHaveBeenCalledTimes(1);
98
+ expect(mockOnClick).toHaveBeenCalledWith(/* expected args */);
99
+ });
100
+ });
101
+
102
+ describe("error handling", () => {
103
+ it("should display error message when error prop provided", () => {
104
+ wrapper = shallow(<ComponentName {...props} error="Error occurred" />);
105
+ expect(wrapper.find(".error").text()).toBe("Error occurred");
106
+ });
107
+ });
108
+ });
109
+ ```
110
+
111
+ ### Test Naming - STRICT REQUIREMENTS
112
+
113
+ - Format: "should [expected behavior] when [condition]"
114
+ - Be SPECIFIC (no "works correctly", "renders", "is defined")
115
+ - Test names MUST describe user behavior
116
+
117
+ ```typescript
118
+ // CORRECT
119
+ it("should disable submit button when form is invalid", () => {});
120
+ it("should display error message when API call fails", () => {});
121
+ it("should focus input when modal opens", () => {});
122
+
123
+ // INCORRECT - TOO VAGUE
124
+ it("works", () => {}); // REJECTED
125
+ it("renders correctly", () => {}); // REJECTED
126
+ it("handles errors", () => {}); // REJECTED
127
+ ```
128
+
129
+ ## Component Testing - 100% COVERAGE REQUIRED
130
+
131
+ ### ALL These MUST Be Tested
132
+
133
+ - Rendering with all prop combinations
134
+ - All conditional rendering paths
135
+ - All event handlers
136
+ - All state changes
137
+ - All hooks and their effects
138
+ - All error boundaries
139
+ - All loading states
140
+ - Accessibility (keyboard, ARIA)
141
+
142
+ ### Rendering Tests - MANDATORY
143
+
144
+ ```typescript
145
+ // Test all prop combinations
146
+ it("should render with minimal props", () => {});
147
+ it("should render with all optional props", () => {});
148
+ it("should render in loading state", () => {});
149
+ it("should render in error state", () => {});
150
+ it("should render when data is empty", () => {});
151
+ it("should render when data is populated", () => {});
152
+ ```
153
+
154
+ ### Interaction Tests - ALL REQUIRED
155
+
156
+ ```typescript
157
+ // Test ALL user interactions
158
+ it("should call onClick when button clicked", () => {});
159
+ it("should prevent default on form submit", () => {});
160
+ it("should update state when input changes", () => {});
161
+ it("should call onSubmit with form data", () => {});
162
+ it("should focus input on mount", () => {});
163
+ it("should trap focus in modal", () => {});
164
+ ```
165
+
166
+ ### Accessibility Tests - MANDATORY
167
+
168
+ ```typescript
169
+ // Test keyboard navigation
170
+ it("should be focusable with Tab key", () => {});
171
+ it("should activate with Enter key", () => {});
172
+ it("should close with Escape key", () => {});
173
+
174
+ // Test ARIA attributes
175
+ it("should have correct aria-label", () => {});
176
+ it("should announce errors to screen readers", () => {});
177
+ it("should have proper role attribute", () => {});
178
+ ```
179
+
180
+ ## Hooks Testing - STRICT REQUIREMENTS
181
+
182
+ ### Custom Hooks - 100% Coverage
183
+
184
+ ```typescript
185
+ import { renderHook, act } from "@testing-library/react-hooks";
186
+
187
+ describe("useCustomHook", () => {
188
+ it("should initialize with default value", () => {
189
+ const { result } = renderHook(() => useCustomHook());
190
+ expect(result.current.value).toBe(defaultValue);
191
+ });
192
+
193
+ it("should update value when action called", () => {
194
+ const { result } = renderHook(() => useCustomHook());
195
+
196
+ act(() => {
197
+ result.current.updateValue(newValue);
198
+ });
199
+
200
+ expect(result.current.value).toBe(newValue);
201
+ });
202
+
203
+ it("should cleanup on unmount", () => {
204
+ const cleanup = jest.fn();
205
+ const { unmount } = renderHook(() => useCustomHook(cleanup));
206
+
207
+ unmount();
208
+
209
+ expect(cleanup).toHaveBeenCalledTimes(1);
210
+ });
211
+ });
212
+ ```
213
+
214
+ ## Mocking - STRICT STANDARDS
215
+
216
+ ### MUST Mock These
217
+
218
+ - All external API calls
219
+ - ALL Redux store and actions
220
+ - ALL browser APIs (localStorage, window, document)
221
+ - ALL third-party libraries
222
+ - ALL time-dependent functions (Date, moment)
223
+ - ALL file system operations
224
+ - ALL network requests
225
+
226
+ ### Mock Pattern - MANDATORY
227
+
228
+ ```typescript
229
+ // Mock at top of file
230
+ jest.mock("../utils/api", () => ({
231
+ fetchData: jest.fn(),
232
+ postData: jest.fn(),
233
+ }));
234
+
235
+ // Use in tests
236
+ import { fetchData } from "../utils/api";
237
+
238
+ describe("Component", () => {
239
+ beforeEach(() => {
240
+ (fetchData as jest.Mock).mockResolvedValue({ data: "test" });
241
+ });
242
+
243
+ afterEach(() => {
244
+ jest.clearAllMocks();
245
+ });
246
+
247
+ afterAll(() => {
248
+ jest.restoreAllMocks();
249
+ });
250
+ });
251
+ ```
252
+
253
+ ### What NOT to Mock
254
+
255
+ - Component's own functions (test real behavior)
256
+ - Simple utility functions (test actual implementation)
257
+ - React internals (useState, useEffect, etc.)
258
+ - PropTypes validation
259
+
260
+ ## Test Quality - STRICT ENFORCEMENT
261
+
262
+ ### Prohibited - AUTOMATIC REJECTION
263
+
264
+ - NO snapshot tests (explicit assertions ONLY)
265
+ - NO test.skip in committed code
266
+ - NO test.only in committed code
267
+ - NO fit or fdescribe
268
+ - NO flaky tests (must pass 100% of time)
269
+ - NO setTimeout > 100ms
270
+ - NO tests depending on execution order
271
+ - NO tests with side effects
272
+
273
+ ### Required - ALL MANDATORY
274
+
275
+ - Descriptive test names
276
+ - Arrange-Act-Assert pattern
277
+ - Independent tests (no shared state)
278
+ - Fast tests (<100ms per test)
279
+ - Deterministic tests (same input = same output)
280
+ - Isolated tests (mock external dependencies)
@@ -1,48 +1,48 @@
1
- # Agentic Code Standards - Minimal Profile
2
-
3
- # Version: 1.0.0
4
-
5
- # Profile: Essential rules only - great for getting started
6
-
7
- ## Core Principles
8
-
9
- - Write clean, readable code
10
- - Follow basic accessibility guidelines
11
- - Use modern JavaScript/TypeScript patterns
12
-
13
- ## Accessibility Basics
14
-
15
- - All interactive elements must be keyboard accessible (Tab, Enter, Space)
16
- - Provide alt text for images that convey information
17
- - Use semantic HTML elements (button, nav, main, header, footer)
18
- - Minimum color contrast: 4.5:1 for normal text
19
-
20
- ## Code Quality
21
-
22
- - Use descriptive variable and function names
23
- - Prefer `const` over `let`, never use `var`
24
- - Keep functions small and focused (under 50 lines)
25
- - Remove `console.log` statements before committing
26
-
27
- ## React Essentials
28
-
29
- - Use functional components with hooks
30
- - Destructure props: `const Component = ({prop1, prop2}) => {}`
31
- - Extract reusable logic into custom hooks
32
- - Keep components under 200 lines
33
-
34
- ## Testing
35
-
36
- - Write tests for critical functionality
37
- - Test user behavior, not implementation details
38
- - Mock external dependencies
39
-
40
- ## Security
41
-
42
- - Never commit API keys or secrets
43
- - Validate user inputs
44
- - Use environment variables for configuration
45
-
46
- ---
47
-
48
- Learn more: https://github.com/netshdev/codingwithagent
1
+ # CodingWithAgent - Minimal Profile
2
+
3
+ # Version: 1.0.0
4
+
5
+ # Profile: Essential rules only - great for getting started
6
+
7
+ ## Core Principles
8
+
9
+ - Write clean, readable code
10
+ - Follow basic accessibility guidelines
11
+ - Use modern JavaScript/TypeScript patterns
12
+
13
+ ## Accessibility Basics
14
+
15
+ - All interactive elements must be keyboard accessible (Tab, Enter, Space)
16
+ - Provide alt text for images that convey information
17
+ - Use semantic HTML elements (button, nav, main, header, footer)
18
+ - Minimum color contrast: 4.5:1 for normal text
19
+
20
+ ## Code Quality
21
+
22
+ - Use descriptive variable and function names
23
+ - Prefer `const` over `let`, never use `var`
24
+ - Keep functions small and focused (under 50 lines)
25
+ - Remove `console.log` statements before committing
26
+
27
+ ## React Essentials
28
+
29
+ - Use functional components with hooks
30
+ - Destructure props: `const Component = ({prop1, prop2}) => {}`
31
+ - Extract reusable logic into custom hooks
32
+ - Keep components under 200 lines
33
+
34
+ ## Testing
35
+
36
+ - Write tests for critical functionality
37
+ - Test user behavior, not implementation details
38
+ - Mock external dependencies
39
+
40
+ ## Security
41
+
42
+ - Never commit API keys or secrets
43
+ - Validate user inputs
44
+ - Use environment variables for configuration
45
+
46
+ ---
47
+
48
+ Learn more: https://github.com/netshdev/codingwithagent