Skills2026年3月29日·1 分钟阅读

Gemini CLI Extension: Code Review — Quality Checks

Gemini CLI extension for automated code review. Analyzes code quality, suggests improvements, and checks coding standards.

Agent 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 17/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
CLI Tool
安装
Stage only
信任
信任等级:Community
入口
Gemini CLI Extension: Code Review
安全暂存命令
npx -y tokrepo@latest install 711c04fe-77b2-4553-b28c-da9e1cba3a13 --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

TL;DR
Gemini CLI extension that runs automated code quality checks and suggests improvements.
§01

What it is

This is a Gemini CLI extension that adds automated code review capabilities to your terminal workflow. It analyzes code quality, checks adherence to coding standards, and suggests improvements. The extension leverages Gemini models to provide contextual feedback on code changes.

It is designed for developers who want quick quality feedback without leaving the terminal. Useful for pre-commit checks, pull request preparation, or learning better coding patterns.

§02

How it saves time or tokens

Manual code review is slow and inconsistent. This extension automates the first pass, catching style violations, potential bugs, and complexity issues before a human reviewer sees the code. By running locally in the CLI, it avoids round-trips to web interfaces. The estimated token cost per review is around 500 tokens, making it efficient for frequent use.

§03

How to use

  1. Install the Gemini CLI and configure your API key.
  2. Add the code review extension to your Gemini CLI configuration.
  3. Run the review command against your changed files or a specific file path.
  4. Read the output and apply suggested changes.
# Install Gemini CLI
npm install -g @google/gemini-cli

# Configure API key
gemini auth login

# Run code review on a file
gemini review src/main.ts

# Review staged changes
gemini review --staged

# Review with specific focus
gemini review --focus security src/auth.ts
§04

Example

A typical review output:

[WARN] src/main.ts:42 - Variable 'data' is reassigned but could be const
[ERROR] src/main.ts:78 - Potential null dereference: 'user.name' accessed without null check
[STYLE] src/main.ts:91 - Function exceeds 50 lines, consider extracting helper
[OK] src/utils.ts - No issues found

Summary: 1 error, 1 warning, 1 style suggestion across 2 files
§05

Related on TokRepo

§06

Common pitfalls

  • The extension requires a valid Gemini API key. Free-tier rate limits may throttle frequent use.
  • Large files produce verbose output. Use file-specific or staged-only mode to keep reviews focused.
  • Review suggestions are AI-generated and may not always align with your project conventions. Treat them as a second opinion, not gospel.
  • The extension does not execute code. It cannot catch runtime errors, only static patterns.
  • Network connectivity is required for each review call since it sends code to the Gemini API.
  • Review the official documentation before deploying to production to ensure compatibility with your specific environment and requirements.

常见问题

What coding languages does the Gemini CLI review extension support?+

The extension supports any language that Gemini models can analyze, including TypeScript, JavaScript, Python, Go, Java, Rust, and C++. Quality of suggestions varies by language, with mainstream languages getting better coverage.

Does it work offline?+

No. The extension sends code to the Gemini API for analysis, so an active internet connection is required. This also means your code is transmitted to Google servers during review.

How much does it cost per review?+

Each review consumes roughly 500 tokens depending on file size. With Gemini free tier, you get a generous daily quota. For heavy use, a paid API plan keeps reviews uninterrupted.

Can I customize the review rules?+

Yes. You can pass a --focus flag to prioritize areas like security, performance, or style. You can also provide a custom ruleset file that defines your project-specific coding standards.

How does this compare to ESLint or Prettier?+

ESLint and Prettier enforce deterministic rules (formatting, syntax). The Gemini review extension provides semantic analysis: it catches logic issues, suggests refactoring patterns, and explains why a change matters. They complement each other.

引用来源 (3)
🙏

来源与感谢

Created by Google. Licensed under Apache 2.0. gemini-cli-extensions/code-review Part of Gemini CLI — ⭐ 99,400+

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产