code-review

/home/avalon/.hermes/skills/software-development/code-review/SKILL.md · raw

Code Review Skill

Use this skill when reviewing code changes, pull requests, or auditing existing code.

Review Checklist

Architecture / milestone-claim audits

Use this workflow when asked to audit an implementation against docs, roadmap claims, or shipped-milestone claims:

  1. Do not modify files unless explicitly asked; run read-only inspection, builds, health checks, and DB queries only.
  2. Separate claims from evidence. First extract the documented architecture/status claims from README/plan/roadmap docs, then verify against concrete code, routes, packages, DB tables, live processes, and persisted data.
  3. Identify the canonical correction before auditing old plans. If the user says a topology/architecture was “corrected,” treat older docs/ADRs as potentially superseded claims. Report which assumptions remain valid vs which must be rewritten, instead of forcing all docs into one blended architecture.
  4. Map subsystem by subsystem. Produce a table from requested subsystems to concrete files, HTTP routes, background jobs, profile/config files, and database tables.
  5. Verify live/shipped claims with real output where possible: process manager status, public/local health endpoint, build result, database row counts, migration table, audit/activity rows, container status, and git history. Treat docs/commit messages as claims, not proof.
  6. Call out drift precisely. Prefer “documented X, implemented Y” with paths and route/table names. Distinguish: implemented and verified, partially implemented, implemented differently than docs, missing, stale UI/doc text, and safety/security gaps.
  7. Look for wrong-path implementation, not just stale prose. When auditing divergence from a corrected architecture, inspect whether superseded assumptions have already landed in schema, provisioning scripts, env/config, routes, or tests. Separate “docs need rewrite” from “code requires migration/deprecation.”
  8. Check contracts between layers, not just files. For modular architectures, verify that documented extension contracts/manifests actually exist and are used, not bypassed via direct imports.
  9. End with verification + cleanliness. Report build/health checks performed and confirm no files were modified when the task is audit-only.
  10. For dual-use command-layer audits, separate UI routes, agent routes, and business commands. When asked whether a capability works for both humans and Hermes agents, map the human Studio components, admin HTTP routes, agent-gate routes, and underlying state-machine/provider functions independently. Flag duplicated body mapping, module-local schedulers, app-level review hooks, mixed handoff seams, and human-only/agent-only operations. The target architecture is one canonical command definition with thin Studio + typed-tool adapters, not two route families that happen to call the same helper.

Reference: references/caduceus-tenant-topology-audit.md captures a concrete example of auditing Caduceus docs/ADRs/code against a corrected tenant-local Portfolio OS topology. Reference: references/caduceus-dual-use-command-layer-audit.md captures the Caduceus Creative/Social/Ads/Video audit pattern for migrating rich human Studio + Hermes typed tools onto one canonical command layer. Reference: references/caduceus-social-oauth-command-parity-review.md captures the Caduceus Social high-risk review pattern: full OAuth start→state→callback→sync→publish tracing, callback-XSS probes, actual-grant verification, canonical provider-asset metadata, exact surface-bound credential selection, scheduler truth, Studio/Hermes field parity, and behavioral test requirements. Reference: references/caduceus-social-migration-publish-safety-review.md captures exact-commit review of repairable legacy Social migrations and irreversible publish safeguards: partial-target reruns, wrong nonempty mappings, intentional clears, past-due schedule activation, approved-target retry bounds, provider-write zero assertions, concurrency/TOCTOU races, acknowledgement loss, and shared-worktree discipline. Reference: references/caduceus-social-final-release-adversarial-probes.md adds final-release probes for a moving main, missing named bases, first-Meta-connection credential drift, demoted/expired retained-token readiness, multi-item Story partial-publication duplication, past-due migration activation, and malformed OAuth expiry. Reference: references/caduceus-effortless-signup-onboarding-audit.md captures the Caduceus central signup/onboarding audit map: landing Create action, spatial nodes, chat/profile state, passkeys, provisioning progress, tenant handoff, mobile behavior, project canvas reuse, and targeted tests. Reference: references/user-tier-boundary-review.md captures the Caduceus Normal/Pro/Admin tier-boundary audit pattern: role-vs-tier pitfalls, agent-key escalation, unscoped admin APIs, central handoff contract readiness, local-login fallback, and bootstrap seed hazards. Reference: references/caduceus-onboarding-canvas-account-tier-audit.md captures the Caduceus central onboarding canvas audit pattern: ephemeral preview vs tenant truth, Normal one-business semantics, Pro/Admin portfolio semantics, minimal profile handoff, Spawn provisioning status, and Hermes profile/coordinator constraints. Reference: references/caduceus-visual-onboarding-ui-review.md captures the Caduceus visual-onboarding/shared tenant UI review pattern: read untracked UI helpers, run focused central/onboarding tests plus web typecheck, mount the Vite onboarding entry for real DOM measurements, catch clipped dvh/min-height layouts under globally hidden body scroll, and probe optimistic business-name inference regexes.

1. Security First

2. Error Handling

3. Code Quality

4. Testing Considerations

5. Policy/registry/data-contract reviews

Use this extra pass when reviewing manifests, registries, product policy maps, configuration schemas, or account-boundary code:

6. Durable executor / async checkpoint reviews

Use this extra pass when reviewing executors that accept work, persist operation state, then schedule or run side-effect adapters:

7. Tenant appliance / backup-restore security reviews

Use this extra pass when reviewing portable tenant appliance packaging, Docker/Compose runtime contracts, and backup/restore hooks. See references/caduceus-tenant-appliance-backup-review.md for a concrete Caduceus review transcript and adversarial probes. See references/hermes-spawn-caduceus-backup-review.md for Hermes Spawn host-worker probes covering predictable temp symlinks, checksum mismatches, noncanonical duplicate tar paths, and valid restore compatibility.

8. OAuth provider-schema and account-token routing reviews

Use this pass for social/provider OAuth changes where external response schemas, refresh rules, permission-derived readiness, and legacy credential fallbacks meet a publishing or mutation boundary:

See references/instagram-business-login-security-review.md for the current Instagram Business Login response-shape, state, refresh, readiness, credential-routing, UI-shaped publication, encryption-readiness, and adversarial-probe checklist.

9. Shared multi-tenant messaging-router reviews

Use this pass when one provider project, inbound stream, sender registry, or sidecar is shared across tenants:

See references/shared-multitenant-messaging-router-review.md for concrete race, replay, request/result correlation, nested-script, filesystem, lifecycle, and deployment probes.

Review Response Format

When providing review feedback, structure it as:

## Summary
[1-2 sentence overall assessment]

## Critical Issues (Must Fix)
- Issue 1: [description + suggested fix]
- Issue 2: ...

## Suggestions (Nice to Have)
- Suggestion 1: [description]

## Questions
- [Any clarifying questions about intent]

Common Patterns to Flag

Python

# Bad: SQL injection risk
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")

# Good: Parameterized query
cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))

JavaScript

// Bad: XSS risk
element.innerHTML = userInput;

// Good: Safe text content
element.textContent = userInput;

Tone Guidelines