skills/comprehensive-code-review/SKILL.md
Code review for ACE Engine (OpenHarmony ArkUI) covering C++/JS/TS/ArkTS. Analyzes 19+ dimensions: stability, performance, threading, security, memory, Modern C++ practices, SOLID principles, design patterns, robustness, testability, maintainability, observability, API design, technical debt, backward compatibility. Reports severity levels, refactoring suggestions, and ACE Engine checks (Pattern/Model/Property, component lifecycle, RefPtr/WeakPtr, four-layer architecture). Use when: reviewing PRs, analyzing code quality, enforcing standards, identifying technical debt, validating architecture, generating quality reports.
npx skillsauth add openharmonyinsight/openharmony-skills comprehensive-code-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Perform comprehensive code review analysis directly with AI:
"Review the code in frameworks/core/components_ng for memory management issues"
"Analyze this pull request focusing on security vulnerabilities"
"Check path/to/code.cpp for ACE Engine architecture compliance"
AI will analyze code across all relevant dimensions based on:
Review code across 19+ dimensions. See DIMENSIONS.md for complete coverage.
High-Priority Dimensions:
Medium-Priority Dimensions:
AI generates comprehensive review report including:
Quick reference to all dimensions:
| Dimension | Focus | Severity Levels | Reference | |-----------|-------|-----------------|-----------| | Stability | Error handling, boundaries | 🔴🟠🟡🟢 | STABILITY.md | | Performance | Algorithms, optimization | 🔴🟠🟡🟢 | DIMENSIONS.md | | Threading | Concurrency, synchronization | 🔴🟠🟡 | DIMENSIONS.md | | Security | Input validation, vulnerabilities | 🔴🟠🟡 | SECURITY.md | | Memory | Smart pointers, leaks | 🔴🟠🟡 | MEMORY.md | | Modern C++ | C++11/14/17/20 features | 🟠🟡 | DIMENSIONS.md | | Effective C++ | RAII, Rule of Five | 🟠🟡 | DIMENSIONS.md | | Code Smells | 22 types of smells | 🟠🟡 | CODE_SMELLS.md | | SOLID | Design principles | 🟠🟡 | SOLID.md | | Design Patterns | Pattern usage | 🟡🟢 | DIMENSIONS.md | | Robustness | Fault tolerance | 🟠🟡 | DIMENSIONS.md | | Testability | Dependency injection | 🟠🟡 | DIMENSIONS.md | | Maintainability | Code complexity | 🟡🟢 | DIMENSIONS.md | | Observability | Logging, monitoring | 🟡🟢 | DIMENSIONS.md | | API Design | Interface quality | 🟠🟡 | DIMENSIONS.md | | Technical Debt | TODO/FIXME tracking | 🟡🟢 | DIMENSIONS.md | | Backward Compatibility | API stability | 🟠🟡 | DIMENSIONS.md | | Architecture | ACE Engine compliance | 🔴🟠🟡 | ACE_ENGINE_SPECIFIC.md |
Four-Layer Architecture:
Frontend Bridge Layer
↓
Component Framework Layer (Pattern/Model/Property)
↓
Layout/Render Layer
↓
Platform Adapter Layer (OHOS/Preview)
Check:
components_ng/pattern/<component>/
├── *_pattern.h/cpp # Business logic & lifecycle
├── *_model.h/cpp # Data model interface
├── *_layout_property.h/cpp # Layout properties
├── *_paint_property.h/cpp # Render properties
└── *_event_hub.h/cpp # Event handling
// ✅ Creation
auto node = AceType::MakeRefPtr<FrameNode>();
// ✅ Type-safe casting
auto pattern = AceType::DynamicCast<MenuPattern>(node->GetPattern());
if (!pattern) {
LOGE("Failed to get pattern");
return false;
}
// ✅ Breaking cycles with WeakPtr
class Child {
WeakPtr<Parent> parent_; // Use weak, not strong
};
// ✅ Safe callbacks
auto weak = AceType::WeakClaim(this);
PostTask([weak]() {
auto pattern = AceType::DynamicCast<MenuPattern>(weak.Upgrade());
if (pattern) pattern->Update();
});
class MenuPattern { // PascalCase
public:
void OnModifyDone(); // PascalCase
int GetWidth() const; // Get prefix
private:
int width_; // snake_case_ with trailing underscore
std::string component_id_; // Abbreviations lowercase
};
constexpr int MAX_MENU_ITEMS = 100; // UPPER_CASE
🔴 CRITICAL - Must fix before merge
🟠 HIGH - Should fix before merge
🟡 MEDIUM - Fix soon
🟢 LOW - Nice to have
| Pattern | Dimension | Severity | Detection |
|---------|-----------|----------|-----------|
| Raw pointer instead of RefPtr | Memory | HIGH | new T() without RefPtr |
| Command injection | Security | CRITICAL | system(user_input) |
| Buffer overflow | Security | CRITICAL | strcpy(), sprintf() |
| Unsafe this capture | Threading | HIGH | [this] in PostTask |
| Long method (>50 lines) | Code Smell | MEDIUM | Function length |
| Large class (>500 lines) | Code Smell | HIGH | Class size |
| Missing null check | Stability | HIGH | Pointer use without validation |
| static_cast instead of DynamicCast | Memory | MEDIUM | static_cast<T*> |
"Review the changes in this PR with focus on memory management and threading safety"
AI will:
"Perform a security audit of path/to/code, focusing on input validation and potential vulnerabilities"
AI will check for:
"Analyze frameworks/core/components for potential memory leaks and improper RefPtr usage"
AI will identify:
"Verify that components_ng/menu follows the four-layer architecture and Pattern/Model/Property separation"
AI will validate:
For pre-commit hooks, consider using traditional static analysis tools:
#!/bin/bash
# .git/hooks/pre-commit
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(cpp|cc|cxx|h|hpp|ts|tsx)$')
if [ -n "$CHANGED_FILES" ]; then
echo "Running basic static analysis..."
# Use clang-tidy, cppcheck, eslint, etc.
for file in $CHANGED_FILES; do
if [[ $file == *.cpp || $file == *.h ]]; then
clang-tidy $file --checks='*' || true
elif [[ $file == *.ts ]]; then
eslint $file || true
fi
done
fi
For comprehensive AI-powered review:
Detailed documentation for all dimensions in references/:
Before merging code:
Code Quality:
Architecture:
Memory:
Security:
Testing:
testing
--- name: ohos-req-value-decision description: Use after review meeting to record decision and route to next step. Triggers: 评审决策纪要, 评审结论回流, value decision, 评审接纳, 评审不接纳, 评审退回, 下次重新上会. Do NOT use for feature baseline (ohos-req-feature-baseline), review gate checks (ohos-req-review-gate), or IR generation (ohos-req-feature-to-ir). metadata: author: openharmony scope: common stage: requirements capability: value-decision version: 0.3.0 status: draft tags: - sdd - requirements
development
Use when converting an OpenHarmony requirement document, spec, or design proposal into an OpenHarmony review slide deck (需求评审 / 需求变更评审 / 设计评审 PPTX) — produces the fixed OpenHarmony-branded review-deck structure (OH logo on every page) with architecture/flow diagrams and field tables. Triggers on "需求评审PPT", "需求变更评审", "把需求文档转成评审PPT", "spec转评审PPT", "requirement/spec to review deck". NOT for arbitrary or generic slide decks unrelated to OpenHarmony requirement/design review.
testing
Use when performing the Phase 0 Step 0.5 Review Ready Gate on a 04-feature.md, especially when the user says "evaluate gate", "review readiness", "feature ready?", "should we generate IR", or when the ohos-req-intake-orchestration main session needs a structured Ready / Conditional Ready / Not Ready judgment instead of doing the check inline. Reads 01-04, runs seven fixed checks plus a conditional-items check, and returns a machine-readable JSON summary plus a human-readable table that the main session can route on. Do NOT use for feature baseline generation (ohos-req-feature-baseline), value decision recording (ohos-req-value-decision), or IR generation (ohos-req-feature-to-ir).
testing
--- name: ohos-req-requirement-intake description: Use when importing an OHOS requirement into Phase 0.1, especially for 01-requirement.md, requirement intake, background, user value, scenarios, scope, FR/NFR, affected modules, or priority. Triggers: 需求导入, 01-requirement, 需求基线, RR单号. Do NOT use for feasibility analysis (ohos-req-feasibility-analysis), architecture decision (ohos-req-arch-decision), or feature baseline (ohos-req-feature-baseline). metadata: author: openharmony scope: common