agentleFS
Holetron-labHoletron-lab/fleet-memory/.claude/skills/code-review/SKILL.md

code-review

Skill0 starsChanged 7 months agoMITView on GitHub

Review changed code against project standards. Checks for missing tests, dead code, type safety, lint issues, and coding conventions. Run after completing any implementation work.

194 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use close-spec, design-with-images and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • dzhngSkill

    close-spec

    When a spec under specs/<feature>/ is done shipping (a write-spec build, or any planned task that produced a spec), archive it to specs/done/ and rewrite it from a build-plan into a durable rationale — the why, the principles, the invariants — pointing back to the real code for the how. Use when implementation has landed and the plan no longer matches what shipped, or the user says a feature/spec is finished. Pairs with [write-spec](../write-spec/SKILL.md) (the plan this closes) and [review](../review/SKILL.md) (run before closing).

    Also in 5 projects that use this

  • dzhngSkill

    design-with-images

    Explore UI and visual design with image generation, then iterate the real implementation against the user-selected concept. Use when brainstorming visual directions, offering mockup variants, or implementing an approved generated design; do not stop at the mockups or the first code approximation.

    Also in 5 projects that use this

  • PydanticSkill

    add-new-model

    Add support for a newly-released language or image generation model in pydantic-ai (e.g. openai:gpt-5.6, anthropic:claude-sonnet-5, openai:gpt-image-2). Use when a provider ships a new model id and you need to wire literals, profile flags, adapters, and tests to recognize it. Handles SDK-lag, gateway list conventions, capability probing, and direct image-model geometry.

    Also in 9 projects that use this

  • transitive-bullshitSkill

    compare-screenshots

    Compare screenshots against the intended design, distinguishing approved references from historical baselines. Use for iterative implementation matching, before/after visual review, objective image telemetry, or checking a lone capture for flat, empty, or badly framed content.

    Also in 5 projects that use this

  • Microsoft AzureSkill

    azsdk-common-apiview-feedback-resolution

    Analyze and resolve APIView review feedback on Azure SDK PRs. **UTILITY SKILL**. USE FOR: APIView comments, API review feedback, SDK API surface changes. DO NOT USE FOR: general code review, non-APIView feedback. INVOKES: azure-sdk-mcp:azsdk_apiview_get_comments, azure-sdk-mcp:azsdk_customized_code_update, azure-sdk-mcp:azsdk_typespec_delegate_apiview_feedback, azure-sdk-mcp:azsdk_run_typespec_validation, azure-sdk-mcp:azsdk_package_generate_code.

    Also in 6 projects that use this

  • Microsoft AzureSkill

    azsdk-common-generate-sdk-locally

    Generate and finalize Azure SDKs locally from TypeSpec, including build, checks, tests, changelog, metadata, and version updates by default. WHEN: "generate SDK locally", "build SDK", "run SDK tests", "run CI checks", "validate package", "run checks", "update changelog", "fix SDK build errors", "resolve SDK generation errors", "customize TypeSpec", "rename SDK client", "rename SDK model", "hide operation from SDK", "fix analyzer errors", "resolve customization drift", "create subclient", "update metadata", "update version". INVOKES: azsdk_verify_setup, azsdk_package_generate_code, azsdk_package_build_code, azsdk_package_run_check, azsdk_package_run_tests, azsdk_customized_code_update, azsdk_package_update_changelog_content, azsdk_package_update_metadata, azsdk_package_update_version.

    Also in 6 projects that use this

  • +4 more from dzhng
  • +2 more from Azure

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. 0 are common, 13 are distinctive, and 8 are very specific to this project.

  • 0

    Common

    Most of the 184 edited versions we read keep these.

  • 13

    Distinctive

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read and internalize these standards before writing code.

    line 13
  2. Distinctive:

    No Python files at project root - maintain clean directory structure

    line 20
  3. Very specific:

    Use Pydantic BaseModel for all data structures passed between functions

    line 25
  4. Very specific:

    Use @dataclass for lightweight internal data containers when Pydantic validation isn't needed

    line 26
  5. Very specific:

    Add @field_validator for type coercion (e.g., ensuring datetimes are timezone-aware)

    line 27
  6. Very specific:

    Avoid dict.get() patterns - use typed model attributes instead

    line 28
  7. Distinctive:

    Don't comment obvious code — only where the "why" isn't self-evident from the code itself.

    line 63
  8. Distinctive:

    Don't add features, refactor code, or make "improvements" beyond what was asked

    line 81
  9. Distinctive:

    Don't add unnecessary error handling for impossible scenarios

    line 82
  10. Distinctive:

    Don't create helpers or abstractions for one-time operations

    line 83
  11. Distinctive:

    No backwards-compatibility hacks (unused vars, re-exports, "removed" comments)

    line 84
  12. Distinctive:

    Run git log --oneline main..HEAD to list all commits on the branch.

    line 91
  13. Distinctive:

    Verify every commit is relevant to the feature/PR.

    line 92
  14. Very specific:

    Check the branch is based on a recent origin/main (no stale base).

    line 93
  15. Distinctive:

    Run git diff --name-only HEAD (unstaged) and git diff --cached --name-only (staged) to get all changed files.

    line 97
  16. Distinctive:

    Check if there is a corresponding test addition or update

    line 131
  17. Very specific:

    If any files in hindsight-api-slim/hindsight_api/api/ were changed:

    line 140
  18. Very specific:

    If any files in hindsight-integrations/ were added or changed, verify:

    line 154
  19. Very specific:

    If any new MCP tools were added or existing tools renamed in hindsight-api-slim/hindsight_api/mcp_tools.py:

    line 162
  20. Distinctive:

    Check the diff for violations of the standards listed above:

    line 171
  21. Distinctive:

    Do NOT auto-fix any issues.

    line 205

“Common” is measured: kept by at least 6 in 10 of the 184 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Code Review

Review all changed code against the project's quality standards and coding conventions.

Code Standards

Read and internalize these standards before writing code. The review steps below verify compliance.

Python Style

  • Python 3.11+, type hints required
  • Async throughout (asyncpg, async FastAPI)
  • Pydantic models for request/response
  • Ruff for linting (line-length 120)
  • No Python files at project root - maintain clean directory structure
  • Never use multi-item tuple return values — not even for internal/private functions. Always use a dataclass or Pydantic model. No exceptions, no "it's just two values" shortcuts. If a function returns more than one value, define a named type for it.

Type Safety with Pydantic Models

NEVER use raw dict types for structured data — this applies to all code, including internal helpers and private functions. If the dict has known keys, it must be a dataclass or Pydantic model:

  • Use Pydantic BaseModel for all data structures passed between functions
  • Use @dataclass for lightweight internal data containers when Pydantic validation isn't needed
  • Add @field_validator for type coercion (e.g., ensuring datetimes are timezone-aware)
  • Avoid dict.get() patterns - use typed model attributes instead
  • Parse external data (JSON, API responses) into Pydantic models at the boundary
  • This catches type errors at parse time, not deep in business logic
  • The only acceptable dict usage is for truly dynamic/unknown keys (e.g., arbitrary metadata, JSON blobs with no fixed schema)
# BAD - error-prone dict access
def process(data: dict) -> str:
    return data.get("name", "")  # No validation, silent failures

# GOOD - typed and validated
class UserData(BaseModel):
    name: str
    created_at: datetime

    @field_validator("created_at", mode="before")
    @classmethod
    def ensure_tz_aware(cls, v):
        if isinstance(v, str):
            v = datetime.fromisoformat(v.replace("Z", "+00:00"))
        if v.tzinfo is None:
            return v.replace(tzinfo=timezone.utc)
        return v

def process(data: UserData) -> str:
    return data.name  # Type-safe, validated at construction

TypeScript Style

  • Next.js App Router for control plane
  • Tailwind CSS with shadcn/ui components

Code Comments

  • Always comment non-trivial technical decisions with the reasoning behind the choice. If someone would ask "why is it done this way?", there should be a comment.
  • Keep comments up to date with history — when changing an approach, update the comment to explain what was tried before and why it was changed. Comments serve as a tracker of previous implementations that likely had problems.
  • Don't comment obvious code — only where the "why" isn't self-evident from the code itself.
# BAD - no context for future readers
results = await asyncio.gather(*tasks, return_exceptions=True)

# GOOD - explains the non-obvious choice
# Use return_exceptions=True to avoid cancelling sibling tasks on failure.
# Previously we used TaskGroup but it cancelled all tasks when one failed,
# causing partial writes that left orphaned entity links (see #412).
results = await asyncio.gather(*tasks, return_exceptions=True)

Branch Hygiene

  • Always start new feature branches from origin/main — rebase to ensure a clean base.
  • Only include commits relevant to the PR/branch/feature — no unrelated changes. If the branch contains commits that don't belong, they must be removed before merging.

General Principles

  • Don't add features, refactor code, or make "improvements" beyond what was asked
  • Don't add unnecessary error handling for impossible scenarios
  • Don't create helpers or abstractions for one-time operations
  • No backwards-compatibility hacks (unused vars, re-exports, "removed" comments)
  • Three similar lines of code is better than a premature abstraction

Review Steps

1. Check branch hygiene

  • Run git log --oneline main..HEAD to list all commits on the branch.
  • Verify every commit is relevant to the feature/PR. Flag any unrelated commits.
  • Check the branch is based on a recent origin/main (no stale base).

2. Identify changed files

Run git diff --name-only HEAD (unstaged) and git diff --cached --name-only (staged) to get all changed files. If there are no local changes, diff against the base branch using git diff main...HEAD --name-only and git diff main...HEAD to review all commits on the current branch.

3. Run linters

./scripts/hooks/lint.sh

Report any failures. Do NOT fix them yourself — just report.

4. Check for dead code

For each changed Python file, check for:

  • Unused imports (Ruff should catch these, but verify)
  • Functions/methods/classes that were added but are never called from anywhere
  • Variables assigned but never read
  • Commented-out code blocks that should be removed

For each changed TypeScript file, check for:

  • Unused imports
  • Unused variables or functions
  • Commented-out code

5. Check type safety (Python)

For each changed Python file, check for violations:

  • No raw dict for structured data — must use Pydantic model or dataclass, even for internal/private functions (only exception: truly dynamic/unknown keys)
  • No multi-item tuple returns — must use dataclass or Pydantic model, even for internal/private functions (no exceptions)
  • Missing type hints on function parameters and return types
  • Missing @field_validator for datetime fields that should be timezone-aware

6. Check for missing tests

For each new or significantly changed function/endpoint/class:

  • Check if there is a corresponding test addition or update
  • New API endpoints MUST have integration tests
  • New utility functions MUST have unit tests
  • Bug fixes SHOULD have a regression test

Flag any new logic that lacks test coverage.

7. Check API consistency

If any files in hindsight-api-slim/hindsight_api/api/ were changed:

  • Were the OpenAPI specs regenerated? (./scripts/generate-openapi.sh)
  • Were the client SDKs regenerated? (./scripts/generate-clients.sh)
  • Were the control plane proxy routes updated? (hindsight-control-plane/src/app/api/)

8. Check code comments

For each non-trivial change:

  • New non-obvious logic — is there a comment explaining the reasoning?
  • Changed approach — does the comment include what was done before and why it changed?
  • Stale comments — do existing comments near the changed code still accurately describe the behavior?

9. Check integration completeness

If any files in hindsight-integrations/ were added or changed, verify:

  • Tests exist — the integration must have tests that simulate/exercise the external framework (not just pure unit tests of helpers). Check for a tests/ directory with meaningful test files.
  • CI job exists — check .github/workflows/test.yml for a corresponding test-<name>-integration job. If missing, flag it.
  • Release process — check that the integration name is in the VALID_INTEGRATIONS array in scripts/release-integration.sh. If missing, flag it.
  • Code standards — the integration code must follow all Python style rules (type hints, no raw dicts, no tuple returns, etc.).

10. Check MCP tool registration completeness

If any new MCP tools were added or existing tools renamed in hindsight-api-slim/hindsight_api/mcp_tools.py:

  • _ALL_TOOLS set in mcp_tools.py — must include the new tool name
  • tools_to_register default set in register_mcp_tools() in mcp_tools.py — must include the new tool name
  • _SINGLE_BANK_TOOLS set in hindsight-api-slim/hindsight_api/api/mcp.py — must include the new tool if it is bank-scoped (not a bank-management tool like list_banks/create_bank)
  • MCP_TOOL_GROUPS in hindsight-control-plane/src/components/bank-config-view.tsx — must include the new tool in the appropriate group for the UI tool selector
  • Tool count assertions in tests (e.g., test_mcp_tools.py) — must be updated to reflect the new count

11. Review against other coding standards

Check the diff for violations of the standards listed above:

  • Python files at project root (not allowed)
  • Missing async patterns (should be async throughout)
  • Pydantic models for request/response
  • Line length > 120 chars
  • New features/code beyond what was asked (over-engineering)
  • Unnecessary error handling for impossible scenarios
  • Premature abstractions or speculative helpers
  • Backwards-compatibility hacks (unused vars, re-exports, "removed" comments)

12. Report findings

Present a clear summary organized by severity:

Must fix — issues that will break CI or violate hard project rules:

  • Unrelated commits on the branch
  • Lint failures
  • Missing type hints on public functions
  • Raw dict usage for structured data (including internal code)
  • Multi-item tuple returns (including internal code)
  • Missing tests for new endpoints
  • New integration missing tests, CI job, or release-integration.sh entry

Should fix — issues that hurt code quality:

  • Dead code / unused imports missed by linter
  • Missing tests for non-trivial utility functions
  • Over-engineering beyond the task scope

Note — observations that may or may not need action:

  • API changes that might need client regeneration
  • Patterns that deviate from nearby code style

For each finding, include the file path, line number, and a brief explanation.

Do NOT auto-fix any issues. Report all findings and let the user decide what to address. If there are no findings, confirm the code looks good.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.