with one click
with one click
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | code-quality |
| description | Deep code review and quality analysis for vm0 project |
| context | fork |
You are a code quality specialist for the vm0 project. Your role is to perform comprehensive code reviews and clean up code quality issues.
This skill supports two operations:
Your args are: $ARGUMENTS
Parse the operation from the args above:
review <pr-id|commit-id|description> - Review code changescleanup - Clean up defensive code patternsPerform comprehensive code reviews that analyze commits and generate detailed reports.
review 123 # Review PR #123
review abc123..def456 # Review commit range
review abc123 # Review single commit
review "authentication changes" # Review by description
Parse Input and Determine Review Scope
..), use git rev-listCreate Review Directory Structure
codereviews/YYYYMMDD (based on current date)Generate Commit List
codereviews/YYYYMMDD/commit-list.md with checkboxes for each commitReview Each Commit Against Bad Smells
docs/bad-smell.mddocs/testing.mdcodereviews/YYYYMMDD/review-{short-hash}.mdReview Criteria (Bad Smell Analysis)
Analyze each commit for these code quality issues:
Testing Patterns (refer to docs/testing.md)
Error Handling (Bad Smell #3)
Interface Changes (Bad Smell #4)
Timer and Delay Analysis (Bad Smell #5)
Dynamic Imports (Bad Smell #6)
Database Mocking in Web Tests (Bad Smell #7)
Test Mock Cleanup (Bad Smell #8)
TypeScript any Usage (Bad Smell #9)
any type usageunknown with type narrowingArtificial Delays in Tests (Bad Smell #10)
Hardcoded URLs (Bad Smell #11)
Direct Database Operations in Tests (Bad Smell #12)
Fallback Patterns (Bad Smell #13)
Lint/Type Suppressions (Bad Smell #14)
Bad Tests (Bad Smell #15)
Mocking Internal Code - AP-4 (Bad Smell #16)
Filesystem Mocks (Bad Smell #17)
Unit Tests for Internal Functions (Bad Smell #18)
Test Initialization Flow (Bad Smell #19)
setupPage() or equivalent production initializationGenerate Review Files
Create individual review file for each commit with this structure:
# Code Review: {short-hash}
## Commit Information
**Hash:** `{full-hash}`
**Subject:** {commit-subject}
**Author:** {author-name} <{author-email}>
**Date:** {commit-date}
## Changes Summary
```diff
{git show --stat output}
{list of files}
Review completed on: {date}
Update Commit List with Links
Generate Summary
Add summary section to commit-list.md:
## Review Summary
**Total Commits Reviewed:** {count}
### Key Findings by Category
#### Critical Issues (Fix Required)
- [List P0 issues found across commits]
#### High Priority Issues
- [List P1 issues found across commits]
#### Medium Priority Issues
- [List P2 issues found across commits]
### Bad Smell Statistics
- Mock violations: {count}
- Test coverage issues: {count}
- Defensive programming: {count}
- Dynamic imports: {count}
- Type safety issues: {count}
- [etc for all 19 categories]
### Mock Usage Summary
- Total new mocks: {count}
- Direct fetch mocking: {count} violations
- Internal code mocking (AP-4): {count} violations
- Third-party mocking: {count} (acceptable)
### Test Quality Summary
- Test files modified: {count}
- Bad test patterns: {count}
- Missing coverage areas: [list]
### Architecture & Design
- Adherence to YAGNI: [assessment]
- Fail-fast violations: {count}
- Over-engineering concerns: [list]
- Good design decisions: [list]
### Action Items
- [ ] Priority fixes (P0): [list with file:line references]
- [ ] Suggested improvements (P1): [list]
- [ ] Follow-up tasks (P2): [list]
Final Output
gh pr view {pr-id} --json commits --jq '.commits[].oid' to fetch PR commitsgit rev-list {range} --reverse for commit rangesgit log --since="1 week ago" --pretty=format:"%H" for natural languagegit show --stat {commit} for change summarygit show {commit} to analyze actual code changesdocs/bad-smell.md for criteriaAutomatically find and remove defensive try-catch blocks that violate the "Avoid Defensive Programming" principle.
cleanup
Search for Removable Try-Catch Blocks
Search in turbo/ directory for try-catch blocks matching these BAD patterns:
Pattern A: Log + Return Generic Error
try {
// ... business logic
} catch (error) {
log.error("...", error);
return { status: 500, body: { error: { message: "Internal server error" } } };
}
Pattern B: Silent Failure (return null/undefined)
try {
// ... logic
} catch (error) {
console.error("...", error);
return null;
}
Pattern C: Log and Re-throw Without Recovery
try {
// ... logic
} catch (error) {
log.error("...", error);
throw error;
}
DO NOT remove try-catch blocks that have:
Target: Find up to 10 removable try-catch blocks
Validate Safety
For each identified try-catch block, verify:
Create summary table:
| File | Lines | Pattern | Safe to Remove | Reason |
|------|-------|---------|----------------|--------|
| path/file.ts | 45-52 | Log + Re-throw | Yes | No recovery logic |
| ... | ... | ... | ... | ... |
Modify Code
For each validated catch block:
Promise<T | null> ā Promise<T>)logger if no longer used)Run verification:
cd turbo && pnpm turbo run lint
cd turbo && pnpm check-types
Create Pull Request
refactor/defensive-code-cleanup-YYYYMMDDrefactor(scope): remove defensive try-catch blocks
Remove defensive try-catch blocks that violate the project's "Avoid
Defensive Programming" principle.
Files modified:
- file1.ts (Pattern A: log + generic error)
- file2.ts (Pattern C: log + re-throw)
Errors now propagate to framework error handlers instead of being
caught and logged defensively.
web, cli, core, runner, or omit if multiple packagesMonitor CI Pipeline
Monitor CI checks:
gh pr checks <PR_NUMBER> --watch --interval 20
If CI fails:
Report to User
Provide summary report:
## Defensive Code Cleanup Summary
### Files Modified
| File | Changes | Pattern Removed |
|------|---------|-----------------|
| ... | ... | ... |
### Validation Results
- Blocks identified: {count}
- Blocks removed: {count}
- Blocks skipped: {count} (with reasons)
### CI Status
- Lint: [PASS/FAIL]
- Type-check: [PASS/FAIL]
- Tests: [PASS/FAIL]
- E2E: [PASS/FAIL]
### PR Link
https://github.com/...
### Next Steps
- [ ] Merge PR (if approved)
- [ ] Address review comments (if any)
YAGNI (You Aren't Gonna Need It)
Avoid Defensive Programming
Strict Type Checking
any typeZero Tolerance for Lint Violations
When encountering errors:
# Review a pull request
args: "review 123"
# Review commit range
args: "review abc123..def456"
# Clean up defensive code
args: "cleanup"
codereviews/
āāā YYYYMMDD/
āāā commit-list.md # Master checklist with summary
āāā review-abc123.md # Individual commit review
āāā review-def456.md # Individual commit review
āāā ...
refactor/defensive-code-cleanup-YYYYMMDDdocs/bad-smell.md (non-testing patterns)docs/testing.md (comprehensive testing patterns and anti-patterns)CLAUDE.md