@codeharbor/agent-playbook 0.1.0 → 0.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.
- package/package.json +5 -2
- package/skills/api-designer/README.md +36 -0
- package/skills/api-designer/SKILL.md +232 -0
- package/skills/api-designer/references/graphql-patterns.md +12 -0
- package/skills/api-designer/references/rest-patterns.md +17 -0
- package/skills/api-designer/scripts/generate_api.py +87 -0
- package/skills/api-designer/scripts/validate_api.py +48 -0
- package/skills/api-documenter/README.md +41 -0
- package/skills/api-documenter/SKILL.md +209 -0
- package/skills/api-documenter/references/examples/README.md +3 -0
- package/skills/api-documenter/references/examples/openapi-example.yaml +10 -0
- package/skills/api-documenter/references/openapi-template.yaml +5 -0
- package/skills/api-documenter/scripts/generate_openapi.py +84 -0
- package/skills/api-documenter/scripts/validate_openapi.py +45 -0
- package/skills/architecting-solutions/README.md +22 -0
- package/skills/architecting-solutions/SKILL.md +459 -0
- package/skills/auto-trigger/README.md +23 -0
- package/skills/auto-trigger/SKILL.md +183 -0
- package/skills/code-reviewer/README.md +59 -0
- package/skills/code-reviewer/SKILL.md +220 -0
- package/skills/code-reviewer/references/checklist.md +80 -0
- package/skills/code-reviewer/references/patterns.md +226 -0
- package/skills/code-reviewer/references/security.md +88 -0
- package/skills/code-reviewer/scripts/review_checklist.py +191 -0
- package/skills/commit-helper/README.md +58 -0
- package/skills/commit-helper/SKILL.md +159 -0
- package/skills/commit-helper/references/conventional-commits.md +68 -0
- package/skills/commit-helper/references/examples.md +125 -0
- package/skills/commit-helper/references/scopes.md +49 -0
- package/skills/commit-helper/scripts/validate_commit.py +70 -0
- package/skills/create-pr/README.md +182 -0
- package/skills/create-pr/SKILL.md +340 -0
- package/skills/debugger/README.md +53 -0
- package/skills/debugger/SKILL.md +239 -0
- package/skills/debugger/references/checklist.md +7 -0
- package/skills/debugger/references/errors.md +6 -0
- package/skills/debugger/references/patterns.md +5 -0
- package/skills/debugger/scripts/debug_report.py +77 -0
- package/skills/deployment-engineer/README.md +40 -0
- package/skills/deployment-engineer/SKILL.md +242 -0
- package/skills/deployment-engineer/references/kubernetes.md +23 -0
- package/skills/deployment-engineer/references/monitoring.md +14 -0
- package/skills/deployment-engineer/references/pipelines.md +12 -0
- package/skills/deployment-engineer/scripts/generate_deploy.py +72 -0
- package/skills/deployment-engineer/scripts/validate_deploy.py +46 -0
- package/skills/documentation-engineer/README.md +41 -0
- package/skills/documentation-engineer/SKILL.md +164 -0
- package/skills/documentation-engineer/references/api-template.md +22 -0
- package/skills/documentation-engineer/references/readme-template.md +25 -0
- package/skills/documentation-engineer/references/style-guide.md +13 -0
- package/skills/documentation-engineer/scripts/generate_docs.py +68 -0
- package/skills/documentation-engineer/scripts/validate_docs.py +46 -0
- package/skills/figma-designer/README.md +222 -0
- package/skills/figma-designer/SKILL.md +407 -0
- package/skills/figma-designer/references/example-output.md +86 -0
- package/skills/performance-engineer/README.md +42 -0
- package/skills/performance-engineer/SKILL.md +236 -0
- package/skills/performance-engineer/references/checklist.md +6 -0
- package/skills/performance-engineer/references/monitoring.md +5 -0
- package/skills/performance-engineer/references/optimization.md +7 -0
- package/skills/performance-engineer/scripts/perf_report.py +64 -0
- package/skills/performance-engineer/scripts/profile.py +63 -0
- package/skills/planning-with-files/README.md +27 -0
- package/skills/planning-with-files/SKILL.md +103 -0
- package/skills/prd-implementation-precheck/README.md +97 -0
- package/skills/prd-implementation-precheck/SKILL.md +112 -0
- package/skills/prd-planner/README.md +102 -0
- package/skills/prd-planner/SKILL.md +449 -0
- package/skills/prd-planner/references/edge-case-analysis.md +111 -0
- package/skills/qa-expert/README.md +37 -0
- package/skills/qa-expert/SKILL.md +225 -0
- package/skills/qa-expert/references/gates.md +11 -0
- package/skills/qa-expert/references/metrics.md +6 -0
- package/skills/qa-expert/references/strategy.md +11 -0
- package/skills/qa-expert/scripts/coverage_analysis.py +61 -0
- package/skills/qa-expert/scripts/generate_test_plan.py +68 -0
- package/skills/refactoring-specialist/README.md +37 -0
- package/skills/refactoring-specialist/SKILL.md +283 -0
- package/skills/refactoring-specialist/references/checklist.md +6 -0
- package/skills/refactoring-specialist/references/smells.md +6 -0
- package/skills/refactoring-specialist/references/techniques.md +6 -0
- package/skills/security-auditor/README.md +48 -0
- package/skills/security-auditor/SKILL.md +256 -0
- package/skills/security-auditor/references/checklist.md +7 -0
- package/skills/security-auditor/references/owasp.md +12 -0
- package/skills/security-auditor/references/remediation.md +7 -0
- package/skills/security-auditor/scripts/find_secrets.py +58 -0
- package/skills/security-auditor/scripts/security_audit.py +64 -0
- package/skills/self-improving-agent/README.md +136 -0
- package/skills/self-improving-agent/SKILL.md +407 -0
- package/skills/self-improving-agent/hooks/post-bash.sh +10 -0
- package/skills/self-improving-agent/hooks/pre-tool.sh +10 -0
- package/skills/self-improving-agent/hooks/session-end.sh +4 -0
- package/skills/self-improving-agent/memory/semantic-patterns.json +288 -0
- package/skills/self-improving-agent/references/appendix.md +131 -0
- package/skills/self-improving-agent/templates/correction-template.md +11 -0
- package/skills/self-improving-agent/templates/pattern-template.md +15 -0
- package/skills/self-improving-agent/templates/validation-template.md +14 -0
- package/skills/session-logger/README.md +50 -0
- package/skills/session-logger/SKILL.md +156 -0
- package/skills/skill-router/README.md +155 -0
- package/skills/skill-router/SKILL.md +215 -0
- package/skills/test-automator/README.md +41 -0
- package/skills/test-automator/SKILL.md +202 -0
- package/skills/test-automator/references/best-practices.md +6 -0
- package/skills/test-automator/references/examples/README.md +3 -0
- package/skills/test-automator/references/examples/unit-test-example.md +8 -0
- package/skills/test-automator/references/mocking.md +5 -0
- package/skills/test-automator/scripts/coverage_report.py +59 -0
- package/skills/test-automator/scripts/generate_test.py +66 -0
- package/skills/workflow-orchestrator/README.md +20 -0
- package/skills/workflow-orchestrator/SKILL.md +342 -0
- package/src/cli.js +25 -10
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: auto-trigger
|
|
3
|
+
description: Workflow automation hooks for agent-playbook skills. This skill defines automatic triggers between skills - DO NOT use directly, it's a configuration skill that other skills reference.
|
|
4
|
+
allowed-tools: Read, Write, Edit
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Auto-Trigger Hooks
|
|
8
|
+
|
|
9
|
+
This skill defines automatic trigger relationships between skills. When a skill completes its workflow, it should automatically trigger the next skill in the chain.
|
|
10
|
+
|
|
11
|
+
## Hook Definitions
|
|
12
|
+
|
|
13
|
+
### PRD Creation Chain
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
prd_complete:
|
|
17
|
+
triggers:
|
|
18
|
+
- skill: self-improving-agent
|
|
19
|
+
mode: background
|
|
20
|
+
condition: PRD file exists and is complete
|
|
21
|
+
- skill: session-logger
|
|
22
|
+
mode: auto
|
|
23
|
+
context: "PRD created for {feature_name}"
|
|
24
|
+
|
|
25
|
+
prd_implemented:
|
|
26
|
+
triggers:
|
|
27
|
+
- skill: session-logger
|
|
28
|
+
mode: auto
|
|
29
|
+
context: "Implemented PRD: {feature_name}"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Implementation Chain
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
implementation_complete:
|
|
36
|
+
triggers:
|
|
37
|
+
- skill: code-reviewer
|
|
38
|
+
mode: ask_first
|
|
39
|
+
message: "Implementation complete. Run code review?"
|
|
40
|
+
- skill: create-pr
|
|
41
|
+
mode: auto
|
|
42
|
+
condition: changes_staged
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Session Management
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
session_start:
|
|
49
|
+
auto_triggers:
|
|
50
|
+
- skill: session-logger
|
|
51
|
+
action: create_session_file
|
|
52
|
+
|
|
53
|
+
session_end:
|
|
54
|
+
auto_triggers:
|
|
55
|
+
- skill: session-logger
|
|
56
|
+
action: update_session_file
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Hook Format in Skills
|
|
60
|
+
|
|
61
|
+
To add auto-trigger capability to a skill, add to its front matter:
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
---
|
|
65
|
+
name: my-skill
|
|
66
|
+
description: Skill description
|
|
67
|
+
allowed-tools: Read, Write, Edit
|
|
68
|
+
hooks:
|
|
69
|
+
before_start:
|
|
70
|
+
- trigger: session-logger
|
|
71
|
+
mode: auto
|
|
72
|
+
context: "Start {skill_name}"
|
|
73
|
+
after_complete:
|
|
74
|
+
- trigger: self-improving-agent
|
|
75
|
+
mode: background
|
|
76
|
+
- trigger: session-logger
|
|
77
|
+
mode: auto
|
|
78
|
+
on_error:
|
|
79
|
+
- trigger: self-improving-agent
|
|
80
|
+
mode: background
|
|
81
|
+
---
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Implementation Guide
|
|
85
|
+
|
|
86
|
+
When a skill completes its workflow:
|
|
87
|
+
|
|
88
|
+
1. **Check `hooks`** in its own front matter (`before_start`, `after_complete`, `on_error`, `on_progress`)
|
|
89
|
+
2. **For each hook:**
|
|
90
|
+
- If `mode: auto`, trigger immediately
|
|
91
|
+
- If `mode: background`, trigger without waiting
|
|
92
|
+
- If `mode: ask_first`, ask user before triggering
|
|
93
|
+
- If `condition:` exists, check it first
|
|
94
|
+
3. **Pass context** to the triggered skill
|
|
95
|
+
|
|
96
|
+
## Example Integration
|
|
97
|
+
|
|
98
|
+
### prd-planner should add:
|
|
99
|
+
|
|
100
|
+
```yaml
|
|
101
|
+
---
|
|
102
|
+
name: prd-planner
|
|
103
|
+
description: Creates PRDs using persistent file-based planning...
|
|
104
|
+
allowed-tools: Read, Write, Edit, Bash, Grep, Glob, AskUserQuestion, WebSearch
|
|
105
|
+
hooks:
|
|
106
|
+
after_complete:
|
|
107
|
+
- trigger: self-improving-agent
|
|
108
|
+
mode: background
|
|
109
|
+
context: "PRD created at {prd_file}"
|
|
110
|
+
- trigger: session-logger
|
|
111
|
+
mode: auto
|
|
112
|
+
context: "PRD creation complete"
|
|
113
|
+
---
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### self-improving-agent already has:
|
|
117
|
+
|
|
118
|
+
```yaml
|
|
119
|
+
---
|
|
120
|
+
name: self-improving-agent
|
|
121
|
+
description: Universal self-improvement that learns from all skill experiences...
|
|
122
|
+
allowed-tools: Read, Write,Edit, Bash, Grep, Glob, WebSearch
|
|
123
|
+
hooks:
|
|
124
|
+
after_complete:
|
|
125
|
+
- trigger: create-pr
|
|
126
|
+
mode: ask_first
|
|
127
|
+
condition: skills_modified
|
|
128
|
+
- trigger: session-logger
|
|
129
|
+
mode: auto
|
|
130
|
+
context: "Self-improvement cycle complete"
|
|
131
|
+
on_error:
|
|
132
|
+
- trigger: self-improving-agent
|
|
133
|
+
mode: background
|
|
134
|
+
---
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### create-pr should add:
|
|
138
|
+
|
|
139
|
+
```yaml
|
|
140
|
+
---
|
|
141
|
+
name: create-pr
|
|
142
|
+
description: Creates pull requests with bilingual documentation updates...
|
|
143
|
+
allowed-tools: Read, Write, Edit, Bash, Grep, AskUserQuestion
|
|
144
|
+
hooks:
|
|
145
|
+
after_complete:
|
|
146
|
+
- trigger: session-logger
|
|
147
|
+
mode: auto
|
|
148
|
+
context: "PR created: {pr_title}"
|
|
149
|
+
---
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Chain Visualization
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
┌──────────────┐
|
|
156
|
+
│ prd-planner │
|
|
157
|
+
└──────┬───────┘
|
|
158
|
+
│ after_complete
|
|
159
|
+
├──→ self-improving-agent (background)
|
|
160
|
+
│ └──→ create-pr (ask_first)
|
|
161
|
+
│ └──→ session-logger (auto)
|
|
162
|
+
└──→ session-logger (auto)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Error Correction Chain
|
|
166
|
+
|
|
167
|
+
```yaml
|
|
168
|
+
on_error:
|
|
169
|
+
triggers:
|
|
170
|
+
- skill: self-improving-agent
|
|
171
|
+
mode: background
|
|
172
|
+
context: "Error occurred in {skill_name}"
|
|
173
|
+
- skill: session-logger
|
|
174
|
+
mode: auto
|
|
175
|
+
context: "Error captured for {skill_name}"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Important Rules
|
|
179
|
+
|
|
180
|
+
1. **Don't create infinite loops** - Ensure chains terminate
|
|
181
|
+
2. **Ask before major actions** - Use `mode: ask_first` for PRs, deployments
|
|
182
|
+
3. **Background tasks** - Use `mode: background` for non-blocking tasks
|
|
183
|
+
4. **Pass context** - Always include relevant context to triggered skills
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Code Reviewer
|
|
2
|
+
|
|
3
|
+
> A Claude Code skill for comprehensive code review of pull requests and code changes.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
This skill is part of the [agent-playbook](https://github.com/Charon-Fan/agent-playbook) collection.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
When reviewing code, simply ask:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
You: Review this PR
|
|
15
|
+
You: Check my changes
|
|
16
|
+
You: Review the code in src/auth/
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The skill will:
|
|
20
|
+
1. Analyze the changes
|
|
21
|
+
2. Check against security best practices
|
|
22
|
+
3. Evaluate code quality
|
|
23
|
+
4. Review test coverage
|
|
24
|
+
5. Provide structured feedback
|
|
25
|
+
|
|
26
|
+
## Review Categories
|
|
27
|
+
|
|
28
|
+
| Category | Description |
|
|
29
|
+
|----------|-------------|
|
|
30
|
+
| **Correctness** | Logic, edge cases, error handling |
|
|
31
|
+
| **Security** | OWASP Top 10, secrets, injection prevention |
|
|
32
|
+
| **Performance** | N+1 queries, caching, algorithms |
|
|
33
|
+
| **Code Quality** | DRY, KISS, naming, abstractions |
|
|
34
|
+
| **Testing** | Coverage, edge cases, meaningful assertions |
|
|
35
|
+
| **Documentation** | Comments, API docs, README |
|
|
36
|
+
| **Maintainability** | Modularity, separation of concerns |
|
|
37
|
+
|
|
38
|
+
## Output Format
|
|
39
|
+
|
|
40
|
+
Reviews are structured with severity levels:
|
|
41
|
+
|
|
42
|
+
- **Critical**: Must fix before merge
|
|
43
|
+
- **High**: Should fix before merge
|
|
44
|
+
- **Medium**: Consider fixing
|
|
45
|
+
- **Low**: Nice to have improvements
|
|
46
|
+
|
|
47
|
+
## Scripts
|
|
48
|
+
|
|
49
|
+
Generate a review checklist:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python scripts/review_checklist.py
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## References
|
|
56
|
+
|
|
57
|
+
- [OWASP Top 10](https://owasp.org/www-project-top-ten/)
|
|
58
|
+
- [Google Engineering Practices](https://google.github.io/eng-practices/review/)
|
|
59
|
+
- [Clean Code](https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882)
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-reviewer
|
|
3
|
+
description: Reviews pull requests and code changes for quality, security, and best practices. Use when user asks for code review, PR review, or mentions reviewing changes.
|
|
4
|
+
allowed-tools: Read, Grep, Glob, Bash, WebFetch, WebSearch
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Reviewer
|
|
8
|
+
|
|
9
|
+
A comprehensive code review skill that analyzes pull requests and code changes for quality, security, maintainability, and best practices.
|
|
10
|
+
|
|
11
|
+
## When This Skill Activates
|
|
12
|
+
|
|
13
|
+
This skill activates when you:
|
|
14
|
+
- Ask for a code review
|
|
15
|
+
- Request a PR review
|
|
16
|
+
- Mention reviewing changes
|
|
17
|
+
- Say "review this" or "check this code"
|
|
18
|
+
|
|
19
|
+
## Review Process
|
|
20
|
+
|
|
21
|
+
### Phase 1: Context Gathering
|
|
22
|
+
|
|
23
|
+
1. **Get changed files**
|
|
24
|
+
```bash
|
|
25
|
+
git diff main...HEAD --name-only
|
|
26
|
+
git log main...HEAD --oneline
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
2. **Get the diff**
|
|
30
|
+
```bash
|
|
31
|
+
git diff main...HEAD
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
3. **Understand project context**
|
|
35
|
+
- Read relevant documentation
|
|
36
|
+
- Check existing patterns in similar files
|
|
37
|
+
- Identify project-specific conventions
|
|
38
|
+
|
|
39
|
+
### Phase 2: Analysis Categories
|
|
40
|
+
|
|
41
|
+
#### 1. Correctness
|
|
42
|
+
- [ ] Logic is sound and matches requirements
|
|
43
|
+
- [ ] Edge cases are handled
|
|
44
|
+
- [ ] Error handling is appropriate
|
|
45
|
+
- [ ] No obvious bugs or typos
|
|
46
|
+
|
|
47
|
+
#### 2. Security
|
|
48
|
+
- [ ] No hardcoded secrets or credentials
|
|
49
|
+
- [ ] Input validation and sanitization
|
|
50
|
+
- [ ] SQL injection prevention
|
|
51
|
+
- [ ] XSS prevention (for frontend)
|
|
52
|
+
- [ ] Authentication/authorization checks
|
|
53
|
+
- [ ] Safe handling of user data
|
|
54
|
+
|
|
55
|
+
#### 3. Performance
|
|
56
|
+
- [ ] No N+1 queries
|
|
57
|
+
- [ ] Appropriate caching
|
|
58
|
+
- [ ] Efficient algorithms
|
|
59
|
+
- [ ] No unnecessary computations
|
|
60
|
+
- [ ] Memory efficiency
|
|
61
|
+
|
|
62
|
+
#### 4. Code Quality
|
|
63
|
+
- [ ] Follows DRY principle
|
|
64
|
+
- [ ] Follows KISS principle
|
|
65
|
+
- [ ] Appropriate abstractions
|
|
66
|
+
- [ ] Clear naming conventions
|
|
67
|
+
- [ ] Proper typing (if TypeScript)
|
|
68
|
+
- [ ] No commented-out code
|
|
69
|
+
|
|
70
|
+
#### 5. Testing
|
|
71
|
+
- [ ] Tests cover new functionality
|
|
72
|
+
- [ ] Tests cover edge cases
|
|
73
|
+
- [ ] Test assertions are meaningful
|
|
74
|
+
- [ ] No brittle tests
|
|
75
|
+
|
|
76
|
+
#### 6. Documentation
|
|
77
|
+
- [ ] Complex logic is explained
|
|
78
|
+
- [ ] Public APIs have documentation
|
|
79
|
+
- [ ] JSDoc/TSDoc for functions
|
|
80
|
+
- [ ] README updated if needed
|
|
81
|
+
|
|
82
|
+
#### 7. Maintainability
|
|
83
|
+
- [ ] Code is readable
|
|
84
|
+
- [ ] Consistent style
|
|
85
|
+
- [ ] Modular design
|
|
86
|
+
- [ ] Separation of concerns
|
|
87
|
+
|
|
88
|
+
### Phase 3: Output Format
|
|
89
|
+
|
|
90
|
+
Use this structured format for review feedback:
|
|
91
|
+
|
|
92
|
+
```markdown
|
|
93
|
+
# Code Review
|
|
94
|
+
|
|
95
|
+
## Summary
|
|
96
|
+
Brief overview of the changes (2-3 sentences).
|
|
97
|
+
|
|
98
|
+
## Issues by Severity
|
|
99
|
+
|
|
100
|
+
### Critical
|
|
101
|
+
Must fix before merge.
|
|
102
|
+
|
|
103
|
+
- [ ] **Issue Title**: Description with file:line reference
|
|
104
|
+
|
|
105
|
+
### High
|
|
106
|
+
Should fix before merge unless there's a good reason.
|
|
107
|
+
|
|
108
|
+
- [ ] **Issue Title**: Description with file:line reference
|
|
109
|
+
|
|
110
|
+
### Medium
|
|
111
|
+
Consider fixing, can be done in follow-up.
|
|
112
|
+
|
|
113
|
+
- [ ] **Issue Title**: Description with file:line reference
|
|
114
|
+
|
|
115
|
+
### Low
|
|
116
|
+
Nice to have improvements.
|
|
117
|
+
|
|
118
|
+
- [ ] **Issue Title**: Description with file:line reference
|
|
119
|
+
|
|
120
|
+
## Positive Highlights
|
|
121
|
+
What was done well in this PR.
|
|
122
|
+
|
|
123
|
+
## Suggestions
|
|
124
|
+
Optional improvements that don't require immediate action.
|
|
125
|
+
|
|
126
|
+
## Approval Status
|
|
127
|
+
- [ ] Approved
|
|
128
|
+
- [ ] Approved with suggestions
|
|
129
|
+
- [ ] Request changes
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Common Issues to Check
|
|
133
|
+
|
|
134
|
+
### Security Issues
|
|
135
|
+
|
|
136
|
+
| Issue | Pattern | Recommendation |
|
|
137
|
+
|-------|----------|----------------|
|
|
138
|
+
| Hardcoded secrets | `const API_KEY = "sk-"` | Use environment variables |
|
|
139
|
+
| SQL injection | `\"SELECT * FROM...\" + user_input` | Use parameterized queries |
|
|
140
|
+
| XSS vulnerability | `innerHTML = user_input` | Sanitize or use textContent |
|
|
141
|
+
| Missing auth check | New endpoint without `@RequireAuth` | Add authentication middleware |
|
|
142
|
+
|
|
143
|
+
### Performance Issues
|
|
144
|
+
|
|
145
|
+
| Issue | Pattern | Recommendation |
|
|
146
|
+
|-------|----------|----------------|
|
|
147
|
+
| N+1 query | Loop with database call | Use eager loading or batch queries |
|
|
148
|
+
| Unnecessary re-render | Missing dependencies in `useEffect` | Fix dependency array |
|
|
149
|
+
| Memory leak | Event listener not removed | Add cleanup in useEffect return |
|
|
150
|
+
| Inefficient loop | Nested loops O(n²) | Consider hash map or different algorithm |
|
|
151
|
+
|
|
152
|
+
### Code Quality Issues
|
|
153
|
+
|
|
154
|
+
| Issue | Pattern | Recommendation |
|
|
155
|
+
|-------|----------|----------------|
|
|
156
|
+
| Duplicate code | Similar blocks repeated | Extract to function |
|
|
157
|
+
| Magic number | `if (status === 5)` | Use named constant |
|
|
158
|
+
| Long function | Function >50 lines | Split into smaller functions |
|
|
159
|
+
| Complex condition | `a && b || c && d` | Extract to variable with descriptive name |
|
|
160
|
+
|
|
161
|
+
### Testing Issues
|
|
162
|
+
|
|
163
|
+
| Issue | Pattern | Recommendation |
|
|
164
|
+
|-------|----------|----------------|
|
|
165
|
+
| No tests | New feature without test file | Add unit tests |
|
|
166
|
+
| Untested edge case | Test only covers happy path | Add edge case tests |
|
|
167
|
+
| Brittle test | Test relies on implementation details | Test behavior, not implementation |
|
|
168
|
+
| Missing assertion | Test doesn't assert anything | Add proper assertions |
|
|
169
|
+
|
|
170
|
+
## Language-Specific Guidelines
|
|
171
|
+
|
|
172
|
+
### TypeScript
|
|
173
|
+
- Use `unknown` instead of `any` for untyped values
|
|
174
|
+
- Prefer `interface` for public APIs, `type` for unions
|
|
175
|
+
- Use strict mode settings
|
|
176
|
+
- Avoid `as` assertions when possible
|
|
177
|
+
|
|
178
|
+
### React
|
|
179
|
+
- Follow Hooks rules
|
|
180
|
+
- Use `useCallback`/`useMemo` appropriately (not prematurely)
|
|
181
|
+
- Prefer function components
|
|
182
|
+
- Use proper key props in lists
|
|
183
|
+
- Avoid prop drilling with Context
|
|
184
|
+
|
|
185
|
+
### Python
|
|
186
|
+
- Follow PEP 8 style guide
|
|
187
|
+
- Use type hints
|
|
188
|
+
- Use f-strings for formatting
|
|
189
|
+
- Prefer list comprehensions over map/filter
|
|
190
|
+
- Use context managers for resources
|
|
191
|
+
|
|
192
|
+
### Go
|
|
193
|
+
- Handle errors explicitly
|
|
194
|
+
- Use named returns for clarity
|
|
195
|
+
- Keep goroutines simple
|
|
196
|
+
- Use channels for communication
|
|
197
|
+
- Avoid package-level state
|
|
198
|
+
|
|
199
|
+
## Before Approving
|
|
200
|
+
|
|
201
|
+
Confirm the following:
|
|
202
|
+
- [ ] All critical issues are addressed
|
|
203
|
+
- [ ] Tests pass locally
|
|
204
|
+
- [ ] No merge conflicts
|
|
205
|
+
- [ ] Commit messages are clear
|
|
206
|
+
- [ ] Documentation is updated
|
|
207
|
+
- [ ] Breaking changes are documented
|
|
208
|
+
|
|
209
|
+
## Scripts
|
|
210
|
+
|
|
211
|
+
Run the review checklist script:
|
|
212
|
+
```bash
|
|
213
|
+
python scripts/review_checklist.py <pr-number>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## References
|
|
217
|
+
|
|
218
|
+
- `references/checklist.md` - Complete review checklist
|
|
219
|
+
- `references/security.md` - Security review guidelines
|
|
220
|
+
- `references/patterns.md` - Common patterns and anti-patterns
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Code Review Checklist
|
|
2
|
+
|
|
3
|
+
Use this checklist for systematic code reviews.
|
|
4
|
+
|
|
5
|
+
## Pre-Review
|
|
6
|
+
|
|
7
|
+
- [ ] I understand what this PR is trying to achieve
|
|
8
|
+
- [ ] I have read the linked issues/tickets
|
|
9
|
+
- [ ] I have checked the base branch is correct
|
|
10
|
+
- [ ] I have verified the PR is not a draft
|
|
11
|
+
|
|
12
|
+
## Code Review
|
|
13
|
+
|
|
14
|
+
### Correctness
|
|
15
|
+
- [ ] Code implements the stated requirements
|
|
16
|
+
- [ ] Edge cases are handled
|
|
17
|
+
- [ ] Error handling is appropriate
|
|
18
|
+
- [ ] No obvious bugs
|
|
19
|
+
- [ ] Input validation is present
|
|
20
|
+
|
|
21
|
+
### Security
|
|
22
|
+
- [ ] No hardcoded secrets/credentials
|
|
23
|
+
- [ ] User input is validated/sanitized
|
|
24
|
+
- [ ] SQL/NoSQL injection prevention
|
|
25
|
+
- [ ] XSS prevention (for web)
|
|
26
|
+
- [ ] CSRF protection (for state-changing operations)
|
|
27
|
+
- [ ] Authentication/authorization is correct
|
|
28
|
+
- [ ] Sensitive data is handled securely
|
|
29
|
+
|
|
30
|
+
### Performance
|
|
31
|
+
- [ ] No N+1 queries
|
|
32
|
+
- [ ] Appropriate caching (if applicable)
|
|
33
|
+
- [ ] Efficient algorithm/data structure choice
|
|
34
|
+
- [ ] No unnecessary database/network calls
|
|
35
|
+
- [ ] Pagination for large datasets
|
|
36
|
+
- [ ] Indexes used where appropriate
|
|
37
|
+
|
|
38
|
+
### Code Quality
|
|
39
|
+
- [ ] Code is readable and understandable
|
|
40
|
+
- [ ] Naming is clear and consistent
|
|
41
|
+
- [ ] No dead/commented-out code
|
|
42
|
+
- [ ] No duplicate code
|
|
43
|
+
- [ ] Appropriate abstractions
|
|
44
|
+
- [ ] Follows DRY, KISS, YAGNI
|
|
45
|
+
- [ ] Type definitions are accurate (if typed)
|
|
46
|
+
|
|
47
|
+
### Testing
|
|
48
|
+
- [ ] Tests cover new functionality
|
|
49
|
+
- [ ] Tests cover edge cases
|
|
50
|
+
- [ ] Tests are meaningful (not tautologies)
|
|
51
|
+
- [ ] No hardcoded test data that makes tests brittle
|
|
52
|
+
- [ ] All tests pass
|
|
53
|
+
- [ ] Test coverage not decreased
|
|
54
|
+
|
|
55
|
+
### Documentation
|
|
56
|
+
- [ ] Complex logic has comments
|
|
57
|
+
- [ ] Public APIs are documented
|
|
58
|
+
- [ ] Breaking changes are noted
|
|
59
|
+
- [ ] README/API docs updated if needed
|
|
60
|
+
- [ ] Migration guide provided for breaking changes
|
|
61
|
+
|
|
62
|
+
### Maintainability
|
|
63
|
+
- [ ] Code is modular
|
|
64
|
+
- [ ] Separation of concerns
|
|
65
|
+
- [ ] Easy to modify
|
|
66
|
+
- [ ] Easy to test
|
|
67
|
+
- [ ] Follows project conventions
|
|
68
|
+
|
|
69
|
+
### Style
|
|
70
|
+
- [ ] Consistent formatting
|
|
71
|
+
- [ ] Follows project style guide
|
|
72
|
+
- [ ] No lint errors
|
|
73
|
+
- [ ] No console.log/debugger left in
|
|
74
|
+
|
|
75
|
+
## Post-Review
|
|
76
|
+
|
|
77
|
+
- [ ] Provided clear, actionable feedback
|
|
78
|
+
- [ ] Explained reasoning for suggestions
|
|
79
|
+
- [ ] Flagged blocking issues separately from nice-to-haves
|
|
80
|
+
- [ ] Recognized good work in the PR
|