codingbuddy-rules 2.0.0 → 2.1.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,132 @@
1
+ {
2
+ "domain": "accessibility",
3
+ "icon": "♿",
4
+ "description": "Accessibility (a11y) review items for WCAG 2.1 AA compliance",
5
+ "categories": [
6
+ {
7
+ "name": "forms",
8
+ "triggers": {
9
+ "files": [
10
+ "**/form/**",
11
+ "**/input/**",
12
+ "**/login/**",
13
+ "**/signup/**",
14
+ "**/contact/**"
15
+ ],
16
+ "imports": ["react-hook-form", "formik", "@radix-ui/react-form"],
17
+ "patterns": ["<form", "<input", "<select", "<textarea", "onSubmit"]
18
+ },
19
+ "items": [
20
+ {
21
+ "id": "a11y-form-001",
22
+ "text": "Associate labels with form inputs using htmlFor/id",
23
+ "priority": "critical",
24
+ "reason": "Screen readers need label association to announce field purpose",
25
+ "reference": "WCAG 1.3.1"
26
+ },
27
+ {
28
+ "id": "a11y-form-002",
29
+ "text": "Provide clear error messages with aria-describedby",
30
+ "priority": "high",
31
+ "reason": "Users need to understand what went wrong"
32
+ },
33
+ {
34
+ "id": "a11y-form-003",
35
+ "text": "Mark required fields with aria-required",
36
+ "priority": "medium",
37
+ "reason": "Assistive technologies should announce required fields"
38
+ },
39
+ {
40
+ "id": "a11y-form-004",
41
+ "text": "Ensure form can be submitted with keyboard (Enter key)",
42
+ "priority": "high",
43
+ "reason": "Keyboard-only users must be able to submit forms"
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "name": "interactive_elements",
49
+ "triggers": {
50
+ "files": [
51
+ "**/button/**",
52
+ "**/modal/**",
53
+ "**/dialog/**",
54
+ "**/dropdown/**",
55
+ "**/menu/**",
56
+ "**/components/**"
57
+ ],
58
+ "imports": [
59
+ "@radix-ui/*",
60
+ "@headlessui/*",
61
+ "react-aria",
62
+ "react-modal"
63
+ ],
64
+ "patterns": ["onClick", "onKeyDown", "role=", "aria-", "<button", "<a "]
65
+ },
66
+ "items": [
67
+ {
68
+ "id": "a11y-interactive-001",
69
+ "text": "Ensure all interactive elements are keyboard accessible",
70
+ "priority": "critical",
71
+ "reason": "Not all users can use a mouse",
72
+ "reference": "WCAG 2.1.1"
73
+ },
74
+ {
75
+ "id": "a11y-interactive-002",
76
+ "text": "Provide visible focus indicators",
77
+ "priority": "critical",
78
+ "reason": "Keyboard users need to see where focus is",
79
+ "reference": "WCAG 2.4.7"
80
+ },
81
+ {
82
+ "id": "a11y-interactive-003",
83
+ "text": "Use semantic HTML elements (button, a) instead of div with onClick",
84
+ "priority": "high",
85
+ "reason": "Semantic elements have built-in accessibility"
86
+ },
87
+ {
88
+ "id": "a11y-interactive-004",
89
+ "text": "Manage focus when opening/closing modals",
90
+ "priority": "high",
91
+ "reason": "Focus should move to modal and return when closed"
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ "name": "content",
97
+ "triggers": {
98
+ "files": ["**/page/**", "**/layout/**", "**/*.tsx", "**/*.jsx"],
99
+ "imports": ["next/image", "next/link"],
100
+ "patterns": ["<img", "<Image", "<h1", "<h2", "<main", "<nav", "<aside"]
101
+ },
102
+ "items": [
103
+ {
104
+ "id": "a11y-content-001",
105
+ "text": "Provide alt text for all meaningful images",
106
+ "priority": "critical",
107
+ "reason": "Screen reader users cannot see images",
108
+ "reference": "WCAG 1.1.1"
109
+ },
110
+ {
111
+ "id": "a11y-content-002",
112
+ "text": "Use proper heading hierarchy (h1 > h2 > h3)",
113
+ "priority": "high",
114
+ "reason": "Headings provide document structure for navigation"
115
+ },
116
+ {
117
+ "id": "a11y-content-003",
118
+ "text": "Ensure sufficient color contrast (4.5:1 for text)",
119
+ "priority": "high",
120
+ "reason": "Low contrast text is hard to read",
121
+ "reference": "WCAG 1.4.3"
122
+ },
123
+ {
124
+ "id": "a11y-content-004",
125
+ "text": "Use landmark regions (main, nav, aside, footer)",
126
+ "priority": "medium",
127
+ "reason": "Landmarks help screen reader users navigate"
128
+ }
129
+ ]
130
+ }
131
+ ]
132
+ }
@@ -0,0 +1,97 @@
1
+ {
2
+ "domain": "code-quality",
3
+ "icon": "📏",
4
+ "description": "Code quality and maintainability review items",
5
+ "categories": [
6
+ {
7
+ "name": "general",
8
+ "triggers": {
9
+ "files": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
10
+ "imports": [],
11
+ "patterns": []
12
+ },
13
+ "items": [
14
+ {
15
+ "id": "cq-gen-001",
16
+ "text": "Use explicit TypeScript types (avoid 'any')",
17
+ "priority": "high",
18
+ "reason": "Type safety catches errors at compile time"
19
+ },
20
+ {
21
+ "id": "cq-gen-002",
22
+ "text": "Keep functions small (10-20 lines max)",
23
+ "priority": "medium",
24
+ "reason": "Small functions are easier to understand and test"
25
+ },
26
+ {
27
+ "id": "cq-gen-003",
28
+ "text": "Use meaningful variable and function names",
29
+ "priority": "high",
30
+ "reason": "Code should be self-documenting"
31
+ },
32
+ {
33
+ "id": "cq-gen-004",
34
+ "text": "Remove dead code and unused imports",
35
+ "priority": "medium",
36
+ "reason": "Dead code adds confusion and maintenance burden"
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "name": "solid_principles",
42
+ "triggers": {
43
+ "files": ["**/service/**", "**/util/**", "**/lib/**", "**/core/**"],
44
+ "imports": [],
45
+ "patterns": ["class ", "interface ", "abstract "]
46
+ },
47
+ "items": [
48
+ {
49
+ "id": "cq-solid-001",
50
+ "text": "Single Responsibility: Each module has one reason to change",
51
+ "priority": "high",
52
+ "reason": "Focused modules are easier to maintain"
53
+ },
54
+ {
55
+ "id": "cq-solid-002",
56
+ "text": "Dependency Inversion: Depend on abstractions, not concretions",
57
+ "priority": "medium",
58
+ "reason": "Makes code more flexible and testable"
59
+ },
60
+ {
61
+ "id": "cq-solid-003",
62
+ "text": "DRY: Eliminate code duplication",
63
+ "priority": "high",
64
+ "reason": "Duplicated code means duplicated bugs"
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ "name": "error_handling",
70
+ "triggers": {
71
+ "files": ["**/api/**", "**/service/**", "**/handler/**"],
72
+ "imports": [],
73
+ "patterns": ["try", "catch", "throw", "Error", "Promise"]
74
+ },
75
+ "items": [
76
+ {
77
+ "id": "cq-error-001",
78
+ "text": "Handle all error cases explicitly",
79
+ "priority": "high",
80
+ "reason": "Unhandled errors crash applications"
81
+ },
82
+ {
83
+ "id": "cq-error-002",
84
+ "text": "Provide meaningful error messages",
85
+ "priority": "medium",
86
+ "reason": "Good error messages help debugging"
87
+ },
88
+ {
89
+ "id": "cq-error-003",
90
+ "text": "Use custom error types for domain errors",
91
+ "priority": "low",
92
+ "reason": "Enables specific error handling"
93
+ }
94
+ ]
95
+ }
96
+ ]
97
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "domains": [
4
+ {
5
+ "id": "security",
6
+ "name": "Security",
7
+ "icon": "🔒",
8
+ "file": "security.json",
9
+ "description": "Security-related review items (authentication, input validation, data protection)"
10
+ },
11
+ {
12
+ "id": "accessibility",
13
+ "name": "Accessibility",
14
+ "icon": "♿",
15
+ "file": "accessibility.json",
16
+ "description": "WCAG 2.1 AA compliance items (forms, interactive elements, content)"
17
+ },
18
+ {
19
+ "id": "performance",
20
+ "name": "Performance",
21
+ "icon": "⚡",
22
+ "file": "performance.json",
23
+ "description": "Performance optimization items (rendering, loading, data fetching)"
24
+ },
25
+ {
26
+ "id": "testing",
27
+ "name": "Testing",
28
+ "icon": "🧪",
29
+ "file": "testing.json",
30
+ "description": "Testing strategy items (unit, component, API testing)"
31
+ },
32
+ {
33
+ "id": "code-quality",
34
+ "name": "Code Quality",
35
+ "icon": "📏",
36
+ "file": "code-quality.json",
37
+ "description": "Code quality items (TypeScript, SOLID principles, error handling)"
38
+ },
39
+ {
40
+ "id": "seo",
41
+ "name": "SEO",
42
+ "icon": "🔍",
43
+ "file": "seo.json",
44
+ "description": "SEO optimization items (metadata, structure, links)"
45
+ }
46
+ ]
47
+ }
@@ -0,0 +1,97 @@
1
+ {
2
+ "domain": "performance",
3
+ "icon": "⚡",
4
+ "description": "Performance optimization review items",
5
+ "categories": [
6
+ {
7
+ "name": "rendering",
8
+ "triggers": {
9
+ "files": ["**/components/**", "**/page/**", "**/*.tsx", "**/*.jsx"],
10
+ "imports": ["react", "next", "useMemo", "useCallback", "memo"],
11
+ "patterns": ["useState", "useEffect", "useMemo", "useCallback", "memo("]
12
+ },
13
+ "items": [
14
+ {
15
+ "id": "perf-render-001",
16
+ "text": "Memoize expensive calculations with useMemo",
17
+ "priority": "medium",
18
+ "reason": "Prevents unnecessary recalculations on re-render"
19
+ },
20
+ {
21
+ "id": "perf-render-002",
22
+ "text": "Use useCallback for callback props to child components",
23
+ "priority": "medium",
24
+ "reason": "Prevents unnecessary child re-renders"
25
+ },
26
+ {
27
+ "id": "perf-render-003",
28
+ "text": "Avoid inline object/array creation in JSX",
29
+ "priority": "low",
30
+ "reason": "New references cause unnecessary re-renders"
31
+ },
32
+ {
33
+ "id": "perf-render-004",
34
+ "text": "Use React.memo for pure presentational components",
35
+ "priority": "low",
36
+ "reason": "Skip re-renders when props haven't changed"
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "name": "loading",
42
+ "triggers": {
43
+ "files": ["**/page/**", "**/layout/**", "**/app/**"],
44
+ "imports": ["next/dynamic", "next/image", "react-lazy-load"],
45
+ "patterns": ["dynamic(", "lazy(", "Suspense", "loading"]
46
+ },
47
+ "items": [
48
+ {
49
+ "id": "perf-load-001",
50
+ "text": "Use code splitting with dynamic imports",
51
+ "priority": "high",
52
+ "reason": "Reduces initial bundle size"
53
+ },
54
+ {
55
+ "id": "perf-load-002",
56
+ "text": "Optimize images (WebP, proper sizing, lazy loading)",
57
+ "priority": "high",
58
+ "reason": "Images are often the largest assets"
59
+ },
60
+ {
61
+ "id": "perf-load-003",
62
+ "text": "Implement loading skeletons for async content",
63
+ "priority": "medium",
64
+ "reason": "Improves perceived performance"
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ "name": "data_fetching",
70
+ "triggers": {
71
+ "files": ["**/api/**", "**/hook/**", "**/query/**"],
72
+ "imports": ["@tanstack/react-query", "swr", "axios"],
73
+ "patterns": ["useQuery", "useSWR", "fetch(", "getServerSideProps"]
74
+ },
75
+ "items": [
76
+ {
77
+ "id": "perf-data-001",
78
+ "text": "Implement proper caching strategy",
79
+ "priority": "high",
80
+ "reason": "Reduces unnecessary network requests"
81
+ },
82
+ {
83
+ "id": "perf-data-002",
84
+ "text": "Use stale-while-revalidate pattern where appropriate",
85
+ "priority": "medium",
86
+ "reason": "Shows cached data while fetching fresh data"
87
+ },
88
+ {
89
+ "id": "perf-data-003",
90
+ "text": "Paginate or virtualize large lists",
91
+ "priority": "high",
92
+ "reason": "Rendering thousands of items kills performance"
93
+ }
94
+ ]
95
+ }
96
+ ]
97
+ }
@@ -0,0 +1,119 @@
1
+ {
2
+ "domain": "security",
3
+ "icon": "🔒",
4
+ "description": "Security-related review items",
5
+ "categories": [
6
+ {
7
+ "name": "authentication",
8
+ "triggers": {
9
+ "files": [
10
+ "**/auth/**",
11
+ "**/login/**",
12
+ "**/session/**",
13
+ "**/password/**",
14
+ "**/signin/**",
15
+ "**/signup/**"
16
+ ],
17
+ "imports": [
18
+ "bcrypt",
19
+ "argon2",
20
+ "jsonwebtoken",
21
+ "passport",
22
+ "next-auth",
23
+ "@auth/*",
24
+ "jose"
25
+ ],
26
+ "patterns": [
27
+ "password",
28
+ "token",
29
+ "credential",
30
+ "session",
31
+ "authenticate"
32
+ ]
33
+ },
34
+ "items": [
35
+ {
36
+ "id": "sec-auth-001",
37
+ "text": "Hash passwords using bcrypt/argon2 (never store plaintext)",
38
+ "priority": "critical",
39
+ "reason": "Plaintext passwords can be stolen if database is compromised",
40
+ "reference": "OWASP Authentication Cheatsheet"
41
+ },
42
+ {
43
+ "id": "sec-auth-002",
44
+ "text": "Implement rate limiting on login attempts",
45
+ "priority": "high",
46
+ "reason": "Prevents brute force attacks"
47
+ },
48
+ {
49
+ "id": "sec-auth-003",
50
+ "text": "Use secure session management (HttpOnly, Secure, SameSite cookies)",
51
+ "priority": "critical",
52
+ "reason": "Prevents session hijacking and XSS attacks"
53
+ },
54
+ {
55
+ "id": "sec-auth-004",
56
+ "text": "Implement proper logout (invalidate session server-side)",
57
+ "priority": "high",
58
+ "reason": "Ensures complete session termination"
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "name": "input_validation",
64
+ "triggers": {
65
+ "files": ["**/api/**", "**/form/**", "**/input/**", "**/handler/**"],
66
+ "imports": ["zod", "yup", "joi", "validator"],
67
+ "patterns": ["validate", "sanitize", "input", "formData"]
68
+ },
69
+ "items": [
70
+ {
71
+ "id": "sec-input-001",
72
+ "text": "Validate all user input server-side",
73
+ "priority": "critical",
74
+ "reason": "Client-side validation can be bypassed"
75
+ },
76
+ {
77
+ "id": "sec-input-002",
78
+ "text": "Sanitize input to prevent XSS attacks",
79
+ "priority": "critical",
80
+ "reason": "Unsanitized input can execute malicious scripts"
81
+ },
82
+ {
83
+ "id": "sec-input-003",
84
+ "text": "Use parameterized queries to prevent SQL injection",
85
+ "priority": "critical",
86
+ "reason": "Raw queries with user input enable SQL injection"
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "name": "data_protection",
92
+ "triggers": {
93
+ "files": ["**/api/**", "**/data/**", "**/user/**", "**/profile/**"],
94
+ "imports": ["crypto", "node:crypto"],
95
+ "patterns": ["encrypt", "decrypt", "secret", "private", "pii"]
96
+ },
97
+ "items": [
98
+ {
99
+ "id": "sec-data-001",
100
+ "text": "Encrypt sensitive data at rest",
101
+ "priority": "high",
102
+ "reason": "Protects data if storage is compromised"
103
+ },
104
+ {
105
+ "id": "sec-data-002",
106
+ "text": "Use HTTPS for all data transmission",
107
+ "priority": "critical",
108
+ "reason": "Prevents man-in-the-middle attacks"
109
+ },
110
+ {
111
+ "id": "sec-data-003",
112
+ "text": "Never log sensitive information (passwords, tokens, PII)",
113
+ "priority": "high",
114
+ "reason": "Logs can be accessed by unauthorized parties"
115
+ }
116
+ ]
117
+ }
118
+ ]
119
+ }
@@ -0,0 +1,97 @@
1
+ {
2
+ "domain": "seo",
3
+ "icon": "🔍",
4
+ "description": "SEO optimization review items",
5
+ "categories": [
6
+ {
7
+ "name": "metadata",
8
+ "triggers": {
9
+ "files": ["**/page/**", "**/layout/**", "**/app/**", "**/head/**"],
10
+ "imports": ["next/head", "react-helmet"],
11
+ "patterns": ["<title", "<meta", "metadata", "generateMetadata"]
12
+ },
13
+ "items": [
14
+ {
15
+ "id": "seo-meta-001",
16
+ "text": "Set unique, descriptive title for each page",
17
+ "priority": "critical",
18
+ "reason": "Titles appear in search results and browser tabs"
19
+ },
20
+ {
21
+ "id": "seo-meta-002",
22
+ "text": "Write compelling meta descriptions (150-160 chars)",
23
+ "priority": "high",
24
+ "reason": "Descriptions appear in search result snippets"
25
+ },
26
+ {
27
+ "id": "seo-meta-003",
28
+ "text": "Set canonical URL to prevent duplicate content issues",
29
+ "priority": "medium",
30
+ "reason": "Helps search engines understand the primary URL"
31
+ },
32
+ {
33
+ "id": "seo-meta-004",
34
+ "text": "Add Open Graph and Twitter Card meta tags",
35
+ "priority": "medium",
36
+ "reason": "Controls appearance when shared on social media"
37
+ }
38
+ ]
39
+ },
40
+ {
41
+ "name": "structure",
42
+ "triggers": {
43
+ "files": ["**/page/**", "**/layout/**", "**/*.tsx", "**/*.jsx"],
44
+ "imports": [],
45
+ "patterns": ["<h1", "<h2", "<main", "<article", "<nav"]
46
+ },
47
+ "items": [
48
+ {
49
+ "id": "seo-struct-001",
50
+ "text": "Use exactly one h1 per page",
51
+ "priority": "high",
52
+ "reason": "H1 signals main topic to search engines"
53
+ },
54
+ {
55
+ "id": "seo-struct-002",
56
+ "text": "Use semantic HTML elements (article, section, nav)",
57
+ "priority": "medium",
58
+ "reason": "Semantic markup helps search engines understand content"
59
+ },
60
+ {
61
+ "id": "seo-struct-003",
62
+ "text": "Implement breadcrumb navigation with structured data",
63
+ "priority": "low",
64
+ "reason": "Helps users and search engines navigate site hierarchy"
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ "name": "links",
70
+ "triggers": {
71
+ "files": ["**/page/**", "**/*.tsx", "**/*.jsx"],
72
+ "imports": ["next/link"],
73
+ "patterns": ["<a ", "<Link", "href="]
74
+ },
75
+ "items": [
76
+ {
77
+ "id": "seo-link-001",
78
+ "text": "Use descriptive link text (avoid 'click here')",
79
+ "priority": "medium",
80
+ "reason": "Link text signals page content to search engines"
81
+ },
82
+ {
83
+ "id": "seo-link-002",
84
+ "text": "Add rel='noopener noreferrer' to external links",
85
+ "priority": "medium",
86
+ "reason": "Security and performance best practice"
87
+ },
88
+ {
89
+ "id": "seo-link-003",
90
+ "text": "Ensure all internal links use relative paths",
91
+ "priority": "low",
92
+ "reason": "Maintains link equity within the site"
93
+ }
94
+ ]
95
+ }
96
+ ]
97
+ }