10 Task 2: Working with Tools and Skills
In this task, you will use the Gemini CLI agent to explore a project, run code, and apply your first automated fix. We will use the task-03-demotools project.
10.1 Setting the Scene
Navigate to the project folder in your terminal:
cd userspace/projects/task-03-demotoolsThis folder contains a small R analysis and some sample data.
10.2 Step 1: Exploratory Analysis
Launch the agent and ask it to describe the project.
Prompt to try: > “Explore this directory. What data is here, and what does the analysis.R script do?”
Observation: Watch the agent use ls and read_file to build its understanding. It should identify the CSV file and the R script’s purpose.
10.3 Step 2: Activating a Skill
Let’s ensure the agent is in the right “mindset” for R data analysis.
Prompt to try: > “Activate the r-data-analysis skill and run the analysis.R script. Does it produce any output or errors?”
Observation: The agent will likely use run_shell_command to execute the R script. It might encounter an error if a package is missing or if there’s a bug in the code.
10.4 Step 3: Fixing a Bug
If the script failed (or even if it succeeded), let’s ask the agent to improve it.
Prompt to try: > “The script needs to calculate the growth rate of the population by region. Can you modify analysis.R to add this calculation and save the result to a new file called growth_rates.csv?”
Action: Watch the agent: 1. Read the current script. 2. Formulate a plan to add the dplyr logic. 3. Use the replace or write_file tool to update the code. 4. Run the script again to verify the output exists.
Tip: You can check the new growth_rates.csv file in your VS Code file pane to verify the agent’s work!