File size: 3,945 Bytes
fbf3c28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# My Gemini CLI Extensions, Commands, and Settings

This repository is a collection of my personal extensions, custom commands, and settings for the [Google Gemini CLI](https://github.com/google-gemini/gemini-cli). If you are looking for a cheat sheet, see the [cheatsheet here](https://www.philschmid.de/gemini-cli-cheatsheet).

## 🚀 How to Use
    
You can install these configurations globally for all projects or locally for a single project.

**Global Installation:**

```bash
git clone --depth 1 https://github.com/philschmid/gemini-cli-extension.git ~/.gemini-tmp && rsync -av ~/.gemini-tmp/.gemini/ ~/.gemini/ && rm -rf ~/.gemini-tmp
```

**Project-Specific Installation:**

```bash
git clone --depth 1 https://github.com/philschmid/gemini-cli-extension.git .gemini-tmp && rsync -av .gemini-tmp/.gemini/ ./.gemini/ && rm -rf .gemini-tmp
```

**Note:** Both methods may overwrite existing configuration files with the same name.

## 🛠️ Custom Commands

Custom commands allow you to create powerful, reusable prompts. They are defined in TOML files and stored in a `commands` directory.

-   **Global commands:** `~/.gemini/commands/`
-   **Project-specific commands:** `<project>/.gemini/commands/`

### Example Command

Here is an example of a custom command definition in a `.../commands/test/gen.toml` file:

```toml
# Invoked as: /test:gen "Create a test for the login button"
description = "Generates a unit test based on a description."
prompt = """
You are an expert test engineer. Based on the following requirement, please write a comprehensive unit test using the Jest testing framework.

Requirement: {{args}}
"""
```

See the [custom commands guide](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/commands.md#custom-commands) for more details.

---

## ✨ Extensions

Extensions allow you to bundle tools, context, and configurations. Each extension is a directory with a `gemini-extension.json` file.

-   **Global extensions:** `~/.gemini/extensions/`
-   **Project-specific extensions:** `<workspace>/.gemini/extensions/`

### Example Extension

An extension is defined by a `gemini-extension.json` file inside its own directory, for example `<workspace>/.gemini/extensions/my-extension/gemini-extension.json`:

```json
{
  "name": "my-extension",
  "version": "1.0.0",
  "mcpServers": {
    "my-server": {
      "command": "node my-server.js"
    }
  },
  "contextFileName": "GEMINI.md",
  "excludeTools": ["run_shell_command"]
}
```

For more details, see the [extensions guide](https://github.com/google-gemini/gemini-cli/blob/main/docs/extension.md).

---

## ⚙️ Settings (`settings.json`)

You can customize the Gemini CLI's behavior by creating a `settings.json` file.

-   **Project-level:** `.gemini/settings.json`
-   **User-level:** `~/.gemini/settings.json`
-   **System-level:** `/etc/gemini-cli/settings.json`

### Example `settings.json`

```json
{
  "theme": "GitHub",
  "autoAccept": false,
  "sandbox": "docker",
  "checkpointing": {
    "enabled": true
  },
  "fileFiltering": {
    "respectGitIgnore": true
  },
  "usageStatisticsEnabled": true
}
```

All details are in the [configuration guide](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md).

---

## 📄 Context Files (`GEMINI.md`)

Use `GEMINI.md` files to provide instructions and context to the model for your projects. The CLI loads these files hierarchically.

-   **Global context:** `~/.gemini/GEMINI.md`
-   **Project/Ancestor context:** `GEMINI.md` files from the current directory up to the root.

You can use imports to modularize your context: `@./path/to/another.md`.

### Example `GEMINI.md`

```markdown
# Main Project Context: My Awesome App

## General Instructions
- All Python code must be PEP 8 compliant.
- Use 2-space indentation for all new files.

## Component-Specific Style Guides
@./src/frontend/react-style-guide.md
@./src/backend/fastapi-style-guide.md
```