init: common-skills v1

This commit is contained in:
Team
2026-03-26 21:00:51 +08:00
commit 264dacf157
16 changed files with 859 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
---
name: codereview-skill
description: Code review best practices and checklist. Use when reviewing PRs, analyzing code quality, or checking for bugs and anti-patterns.
---
# Code Review Skill
## Review Checklist
When reviewing code, check the following:
### Correctness
- Logic is correct and handles edge cases
- No off-by-one errors in loops
- Null/None checks where needed
### Readability
- Variable and function names are descriptive
- Functions do one thing (single responsibility)
- No magic numbers — use named constants
### Security
- No hardcoded secrets or credentials
- User inputs are validated/sanitized
- No SQL injection or command injection risks
## Example: Bad vs Good
```python
# Bad
def f(x):
return x * 86400 # magic number
# Good
SECONDS_PER_DAY = 86400
def to_seconds(days: int) -> int:
return days * SECONDS_PER_DAY
```
## Common Anti-patterns to Flag
- Functions longer than 40 lines → suggest splitting
- Deeply nested conditionals (>3 levels) → suggest early return
- Duplicate code blocks → suggest extracting to function