この記事の内容
実際に
Gemini CLIで エージェント型コーディングを 実践する 5つの ヒント
今や、
ここ
1. GEMINI.mdを使う
エージェント型コーディングは、
Cursorの
プロジェクトのGEMINI.mdファイルを
コーディング規約:変数には
camelCaseを 使う、 JSDocコメントを 必須に するなど、 好みの スタイルを 定義します。 技術スタック:使用している
フレームワークや ライブラリ ( 例: React、 Next.js、 Express)を 伝え、 互換性の ない コードが 提案されないようにします。 テストの
ガイドライン:好みの テストフレームワーク (私の お気に入りは Node.js組み込みの テストランナー)を 使って 常に ユニットテストを 書くよう 指示したり、 特定の テストパターンに 従うよう 指示したりできます。 プロジェクト固有の
情報:データベースの スキーマや APIエンドポイントなど、 プロジェクトに 欠かせない 情報を 記載します。
GEMINI.mdの
# Coding conventions
- Use ESM modules in this project for modern Node.js conventions
- Use camelCase for functions
- Use `<name>.route.js` for route definitions
- Don't use semicolons
# Development guidelines
- Always add a relevant test case when fixing a bug, refactoring or creating a new feature
- Always add tests in `__tests__/` directory
- Always add fixtures in `__tests__/fixtures/` directory
- Always run `npm run lint` after you finished your tasks and fix any errors
- Always run `npm run test` after you finished your tasks and fix any errors
Gemini CLIは
2. Gemini CLIが安全でないコードや脆弱な依存関係を追加しないか心配ですか?Snyk MCP Serverを追加しましょう
AIコーディングエージェントを
エージェントが
以前の

この
注: Model Context Protocol
簡単に
.gemini/settings.jsonファイルで
{
"mcpServers": {
"Snyk Security": {
"command": "npx",
"args": ["-y", "snyk@latest", "mcp", "-t", "stdio"],
"trust": true
}
}
}
設定が
「
package.jsonファイルに安全でない 依存関係が ないか 確認して。」 「書いたばかりの
コードを スキャンして、 潜在的な セキュリティ上の 欠陥が ないか 確認し、 修正案を 提案して。」
この
MCPに
3. Gemini CLIのネイティブなGoogle検索
Gemini CLIに
Gemini CLIに
特別な

4. Gemini -pを使った単発のターミナル作業ヘルパー
プロジェクト全体を
gemini -p <prompt>と
複雑な
状況で git rebaseを正しく 使う 方法を 尋ねる。 APIエンドポイントの
テストに 適した curlコマンドを確認する。 特定の
パターンに 使う 正規表現を すばやく 生成する。
この

5. Gemini CLIのカスタムコマンド
エージェントに
手作業で/code:reviewのような

例と.gemini/commands ディレクトリに/code:reviewに
コードレビュー用カスタムコマンドの
description="Reviews a pull request based on issue number."
prompt = """
Please provide a detailed pull request review on GitHub issue: {{args}}.
Follow these steps:
1. Use `gh pr view {{args}}` to pull the information of the PR.
2. Use `gh pr diff {{args}}` to view the diff of the PR.
3. Understand the intent of the PR using the PR description.
4. If PR description is not detailed enough to understand the intent of the PR,
make sure to note it in your review.
5. Make sure the PR title follows Conventional Commits, here are the last five
commits to the repo as examples: !{git log --pretty=format:"%s" -n 5}
6. Search the codebase if required.
7. Write a concise review of the PR, keeping in mind to encourage strong code
quality and best practices.
8. Use `gh pr comment {{args}} --body {{review}}` to post the review to the PR.
Remember to use the GitHub CLI (`gh`) with the Shell tool for all
GitHub-related tasks.
"""
この
AIへの信頼は、開発の初期段階から安全を確保すること
AIコーディングエージェントは
Snykなら、
Snykは
Snyk CLIを 使い始める
Snyk CLIを
npm install snyk -g