Accelerating Development with Gemini: Prototyping, Implementation, and Code Review¶
In this demo, you prototype and implement application features with Gemini.
This demo guide walks you through the following steps:
- Prepare the environment
- Prototype ADK agents with Gemini CLI
- Implement new features with Gemini CLI
- Automate GitHub Pull Requests reviews with Code Review Agent
Requirements¶
To follow this demo, you need:
- A Google Cloud project with the
Ownerrole. - JIRA/Confluence project
- GitHub account and repository
- Gemini CLI: Installed and configured. For installation instructions, visit geminicli.com.
- GitHub CLI: Installed and configured. For installation instructions, visit Installation.
Detailed setup instructions for each demonstration are located within their respective sections below.
Prototype ADK Agents with Gemini CLI¶
This demonstration guide walks through the process of rapidly prototyping an ADK (Agent Development Kit) agent using the Gemini CLI. You will leverage the Gemini CLI's planning and implementation capabilities to quickly scaffold and refine a functional customer support agent. This "vibe prototyping" approach allows for fast iteration and development, showcasing how AI-assisted tools can accelerate the creation of complex agents and services. By the end of this demo section, you will have a working ADK agent capable of looking up and summarizing in-memory ticket data, all built and debugged primarily through natural language commands in the Gemini CLI.
Key Files¶
- GEMINI.md: Provides instructions on how to use the reference documentation to build ADK agents.
- AGENTS.txt: Contains detailed information and best practices for agent development.
AGENTS.txt file is imported into the GEMINI.md and will be included in the Gemini CLI session’s context when you interact with the Gemini CLI.
This feature facilitates the decomposition of large GEMINI.md files into smaller, more manageable modules that can be seamlessly reused across varied contexts. The import processor supports both relative and absolute paths, incorporating robust safety mechanisms to avoid circular imports and ensure secure file access.
Custom Commands¶
These custom commands help you with planning and implementing ADK agents.
-
/plan:new- this command leverages provided documentation (GEMINI.md, AGENTS.txt) to generate an implementation plan, ensuring adherence to best practices. -
/plan:impl- this command uses the implementation plan to generate the necessary Python files, reducing boilerplate and focusing on ADK requirements.
Prepare the environment for ADK agent development¶
-
Open Cloud Shell.
-
Clone the repository and set the working directory:
Start building the agent¶
-
Change the working directory:
-
Rename
.env.sampleto.envfile and update with your Google Cloud project information: -
Acquire new user credentials:
-
Run Gemini CLI:
-
Send prompt to create implementation plan:
/plan:new Build a customer support ADK agent that allows users to look up the full details of any ticket using its ID and also provide the ability to return a summary for any selected ticket. Generate 20 sample tickets (each with an ID, title, and description) and use them as an in-memory db.Review generated plan and request implementation. You can find an example plan in the
projects/build-with-gemini-demo/prototype-adk-agent-sample/plans/customer_support_agent.mdfile. -
Send prompt to implement the plan:
Review and approve tools and suggested code changes.
The
prototype-adk-agent-samplefolder contains sample implementation plan and customer support agent built with the prompts above. -
Exit from Gemini CLI and run commands to setup virtual environment and install required dependencies for ADK agent:
-
Start ADK Web Server to test the agent:
Click on the link to open application in the browser.
In the Cloud Shell environment, select Web Preview from the menu and change port(eg. 8000) and preview the application.
-
Testing the Agent
After you start the application and select the agent from the dropdown in the top left corner. Send a greeting to the agent and ask how they can help. This will prompt the agent to describe available operations.
Sample queries to try:
You can find an example implementation of this agent in the
projects/build-with-gemini-demo/prototype-adk-agent-sample directory.
Implement features with Gemini CLI¶
This guide demonstrates how Gemini CLI accelerate feature development within the SDLC. Using Model Context Protocol (MCP) servers, it brings requirements from external systems(eg. JIRA, Confluence) into Gemini chat for efficient planning, review, and implementation. The workflow covers setup, code generation (adding rating to a menu service), and automatic JIRA updates.
Prerequisites¶
-
For this demo you need to have JIRA and Confluence projects configured. Sign up.
-
Create Atlassian API token:
You will use
API Token Authenticationto configure Atlassian MCP server. Additional details.Go to API Tokens
Click
Create API token, give it a name and save the generated token to set environment variables. -
Create new Confluence page:
-
Create new JIRA user story and assign it to yourself:
Title: Update Menu service Update Menu service: 1. add new fields: description and rating to Menu entity 2. update other dependencies where Menu entity is used in the code, eg MenuResource. 3. Add unit tests for all methods, including new fields. Link to Confluence page: https://YOUR-ORG.atlassian.net/wiki/spaces/SD/pages/87785484/Menu-Service+Rating+capabilities
Prepare the environment for Atlassian integration¶
-
Open Cloud Shell.
-
Set environment variables:
export USERNAME="your.email@company.com" export JIRA_URL="https://your-company.atlassian.net" export CONFLUENCE_URL="https://your-company.atlassian.net/wiki"Set value in secure manner, after running this command, paste the token value and hit Enter:
Export environment variable:
-
Change the working directory:
-
Review MCP servers configuration in
.gemini/settings.json- no changes are required for this step. -
Update JIRA/Confluence instance in
.gemini/GEMINI.md:
Check MCP server configuration¶
-
Run Gemini CLI:
-
List configured MCP servers and tools:
The output confirms that the
mcp-atlassianserver is configured and ready.
Codebase explanation¶
-
Send the prompt to help you learn the codebase:
Act as a Technical Lead. I am a new developer joining this project. Please analyze this codebase and provide an Onboarding Guide. Include the following: - High-Level Architecture: What is the tech stack, and how do the components interact? - Key Functionality: What are the top 3 primary features this code executes? - Folder Structure: Briefly explain the purpose of the main directories. - Data Flow: Trace the path of a request from the entry point to the database and back.
(Optional) If you did not configure JIRA and Confluence projects¶
-
Send prompt with the task requirements:
Review the code and prepare the implementation plan for requirements below. I will approve the plan before you can start implementation. Update Menu service: 1. add new fields: description and rating to Menu entity 2. update other dependencies where Menu entity is used in the code, eg MenuResource. 3. Add unit tests for all methods, including new fields. Rating must be an integer value from 1 to 5. Can’t be null. Can’t be empty. Can’t be zero.
Bring requirements into the context of Gemini CLI session¶
-
Send prompt to list assigned JIRA tasks:
-
Send prompt to query context of linked Confluence page:
Start implementation¶
-
Send prompt to create an implementation plan:
Review the code and prepare the implementation plan. I will approve it before you can start implementation.Review the plan and request to implement the changes.
-
Send prompt to start the implementation:
Review and approve tools and suggested code changes. If Gemini CLI runs into issues, for example test validation, multiple iterations might be required to fix and re-run until generated code is valid.
-
Send prompt to update JIRA user story:
Automate GitHub Pull Requests reviews with Code Review Agent¶
This section goes over the process of integrating and utilizing Gemini Code Assist to improve GitHub code reviews. The demo will cover essential setup procedures in both Google Cloud and GitHub, followed by a showcase of Gemini Code Assist's capabilities in delivering smart suggestions, clear explanations, and concise summaries to optimize the code review workflow.
GitHub Prerequisites¶
Use existing or create a new GitHub repository to configure Gemini Code Assist on GitHub.
Below are the steps to create a new GitHub repository using gh cli from the
Cloud Shell environment.
-
Authenticate with GitHub using HTTPS option:
-
Create a new private repository:
Google Cloud Project Prerequisites¶
You need Admin or Owner basic roles for your Google Cloud project.
Setup details.
Install Gemini Code Assist application on GitHub¶
Follow instructions to install Gemini Code Assist on GitHub.
Code Review Agent Configuration¶
At this point, Code Review agent is enabled for the selected repositories.
- On the
Settingsscreen for your Developer connection, you have an option to select comment severity level and also enable memory to improve review response quality. - On the
Style Guidetab, you have an option to provide a project specific style guide. If your repository already contains a.gemini/styleguide.mdfile, the instructions from both places will be concatenated and used as an input for the Code Review Agent during the PR review process.
GitHub MCP Server configuration¶
Return to the Cloud Shell terminal and configure GitHub MCP Server:
-
Change into
gemini-code-review-agentfolder: -
Copy
menu-servicefolder into the new project: -
Set environment variable in the terminal:
-
Start Gemini CLI:
-
Commit new changes and open a pull request:
Review and approve tools that Gemini CLI requires to complete this task.
Pull Request Review¶
Open GitHub repository in the browser and observe the Code Review Agent providing a summary and review for the created pull request.
Invoking Gemini¶
You can request assistance from Gemini at any point by creating a PR comment in
the GitHub UI using either /gemini <command> or
@gemini-code-assist <command>.
-
Code Review - Performs a code review of the pull request:
-
Pull Request Summary - Provides a summary of the pull request:
-
Comment - Responds in comments when explicitly tagged, both in pull request comments and review comments: