Notes and example from course:
https://learn.deeplearning.ai/courses/gemini-cli-code-and-create-with-an-open-source-agent
https://geminicli.com/docs/get-started/examples/
Repo of files used in the examples: https://github.com/https-deeplearning-ai/sc-gemini-cli-files
https://codelabs.developers.google.com/gemini-cli-deep-dive#0
-
Prime Gemini CLI with context to make more effective use of it
-
Context is a collection of information an AI agent uses to understand the user's requests. This may include:
- General instructions
- Project specific instructions
- Define Persona i.e. system prompt
- Define Best practices
- Coding style Guides
-
Gemini CLI reads context from GEMINI.md
-
Context file GEMINI.md can exists at the following levels:
-
Global context file Location: ~/.gemini Scope: Default instructions for all your projects
-
Current folder and ancestor context files Location: Current workinf directory and each parent directory up to the folder with a .git Scope: Project specific instructions
-
Sub-directory context files Location: Subdirectories below current working directory Scope: Highly specific instructions for particular components or modules
-
-
MCP is an open standard enabling AI agents to securely connect with external tools, APIs and data sources e.g. MongoDB MCP server and connect to Gemini CLI
-
Extensions bundle 1 or more MCP servers, a context file, and custom commands into a simple package that teaches Gemini how to use any tool; expand the capabilities of the Gemini CLI
-
To install an extension use the following command but before running the gemini cli:
gemini extensions install https://github.com/gemini-cli-extensions/workspace
to list extensions from within CLI:
/extensions list
-
Can create custom commands in gemini CLI REF: https://geminicli.com/docs/cli/custom-commands/
-
Custom commands can be global or local: Global: User commands (global): Located in ~/.gemini/commands/. These commands are available in any project you are working on.
Local: Located in /.gemini/commands/. These commands are specific to the current project and can be checked into version control to be shared with your team
if command in project directory has same name as command in user directory, then the project command will always be used. This allows projects to ovrride global commands with project specific versions
-
Name of a command is determined by its file path relative to its
commandsdirectory Sub directories are used to create namespaced commands, with path separator/being converted to a:e.g. file at
~/.gemini/commands/test.tomlbecomes the command/teste.g. file at
<project>/.gemini/commands/git/commit.tomlbecomes the namespaced command/git:commit -
All command definition files must be in TOML V1 format with the
.tomlextension -
TODO: Format of TOML file https://geminicli.com/docs/cli/custom-commands/#toml-file-format-v1
-
Gemini CLI can also perform data analysis
-
Gemini CLI for content creation e.g. using nanobanana extension
-
Gemini CLI for Learning
e.g. used as Personal Tutor