From claude-harness
Architecture compliance code review. Used by Reviewer agent after IMPLEMENTATION. Two-stage sequential review: spec compliance first, then code quality. Each stage must pass independently. Produces PASS/FAIL verdict.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-harness:code-review-archThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**两个阶段顺序执行,不可合并,不可跳过。**
两个阶段顺序执行,不可合并,不可跳过。 第一阶段(规范合规)通过后才能开始第二阶段(代码质量)。 开场假设:"这个实现完成得过于顺利了,某处一定藏着问题。"
核心问题:实现是否精确地做了 PRD 和 API spec 要求的事——不多也不少?
开场假设(对抗性):
"实现者完成得太快了。他们可能跳过了某些 PRD Must 功能,或者用了更简单的替代方案来规避困难需求。"
# 检查追溯矩阵 Must 条目完成情况
if [ -f "docs/traceability-matrix.md" ]; then
UNFINISHED=$(grep -c "⬜\|🔧" docs/traceability-matrix.md 2>/dev/null || echo 0)
MUST_COUNT=$(grep -c "| Must |" docs/traceability-matrix.md 2>/dev/null || echo 0)
echo "Must 条目:${MUST_COUNT} 个 | 未完成:${UNFINISHED} 个"
[ "$UNFINISHED" -gt 0 ] && echo "❌ SPEC-001: ${UNFINISHED} 个 Must 条目未完成"
fi
# 检查 api-spec.md 中的端点是否全部有路由实现
node scripts/workflow.js integration-check
# 检查关键交互状态是否实现
node scripts/workflow.js validate-doc interaction-spec
# 确认没有偏离架构决策(静默偏离 = FAIL,有说明 = PASS WITH NOTES)
grep -rn "from 'express'\|from 'fastify'\|from 'redux'" apps/ 2>/dev/null | grep -v "test\|spec"
Phase 1 判定:
| 编号 | 问题 | 判定 |
|---|---|---|
| SPEC-001 | PRD Must 功能代码缺失 | FAIL |
| SPEC-002 | API 端点覆盖率 < 80% | FAIL |
| SPEC-003 | ADR 技术选型静默偏离 | FAIL |
| SPEC-004 | Interaction-Spec 可交互元素状态机未实现 | FAIL |
Phase 1 FAIL → 停止,不执行 Phase 2,直接报告。
前提:Phase 1 已通过(全绿)。
开场假设(对抗性):
"代码通过了规范检查,但实现质量可能很差——临时 hack、未处理的边缘案例、安全漏洞或性能地雷。"
node scripts/workflow.js check-code FE
node scripts/workflow.js check-code BE
node scripts/workflow.js verify-code FE
node scripts/workflow.js verify-code BE
# Biome Lint + Format
cd apps/web && npx biome check --reporter=github .
cd apps/server && npx biome check --reporter=github .
# Token 存储检查
grep -rn "localStorage" apps/web/src --include="*.ts" --include="*.tsx" | grep -v "test\|spec"
# 原始 SQL 检查
grep -rn "sql\`\|rawQuery" apps/server/src | grep -v "drizzle"
# 敏感数据日志
grep -rn "console\.\|logger\." apps/server/src --include="*.ts" | grep -i "password\|token\|secret"
cd apps/web && npm audit --audit-level=high 2>/dev/null | grep -c "vulnerabilities" || echo "clean"
Phase 2 判定:
| 编号 | 问题 | 判定 |
|---|---|---|
| QUAL-001 | 构建失败(FE 或 BE) | FAIL |
| QUAL-002 | Biome 有错误(非警告) | FAIL |
| QUAL-003 | TypeScript 类型错误 | FAIL |
| QUAL-004 | 生产代码中有 mock 数据 | FAIL |
| QUAL-005 | 违反安全基线约束 | FAIL |
| QUAL-006 | High/Critical 依赖漏洞 | FAIL |
| QUAL-007 | BE Smoke Test 失败 | FAIL |
写入 docs/code-review.md,必须包含:
总体结论为 FAIL 时,在报告末尾写明:
> ❌ FAIL — Orchestrator 必须执行 rollback IMPLEMENTATION 并清理本文件
prepare-tests(QA 测试阶段)rollback IMPLEMENTATION,加载 systematic-debugging 定位问题node scripts/workflow.js check-code FE
node scripts/workflow.js check-code BE
node scripts/workflow.js verify-code FE
node scripts/workflow.js verify-code BE
node scripts/workflow.js integration-check
对照 docs/arch-decision.md 技术约束:
对照 docs/security-baseline.md 安全约束:
# 快速安全检查
grep -rn "localStorage" apps/web/src --include="*.ts" --include="*.tsx" | grep -v "test\|spec"
grep -rn "md5\|Math.random()" apps/server/src
grep -rn "sql\`\|rawQuery" apps/server/src | grep -v "drizzle"
| 编号 | 问题 | 判定 |
|---|---|---|
| FAIL-001 | 构建失败(FE 或 BE) | FAIL |
| FAIL-002 | Biome 有错误(非警告) | FAIL |
| FAIL-003 | TypeScript 类型错误 | FAIL |
| FAIL-004 | 前端使用 mock 数据 | FAIL |
| FAIL-005 | API 客户端未配置 | FAIL |
| FAIL-006 | 后端无路由定义 | FAIL |
| FAIL-007 | 接口契约与实现不一致(>20% 缺失) | FAIL |
| FAIL-008 | 违反安全基线约束 | FAIL |
| FAIL-009 | PRD Must 级功能代码缺失 | FAIL |
写入 docs/code-review.md,必须包含:
结论为 FAIL 时,在报告末尾写明:
> ❌ FAIL — Orchestrator 必须执行 rollback IMPLEMENTATION 并清理本文件
npx claudepluginhub poz110/claude-harness --plugin claude-harnessReviews implementation code quality across 8 dimensions including correctness, design conformance, state/error/security, readability, architectural health, and UI consistency. Used after test review.
Verifies codebase quality by reviewing architecture consistency, convention compliance, and performing gap analysis. Activates on code review or quality checks.
Reviews code for spec compliance, test coverage, quality, architecture, error handling, docs, and ADD adherence. Produces report after verifying tests pass via npm test or pytest.