Skip to content

Instantly share code, notes, and snippets.

@segeljakt
Created June 27, 2025 19:38
Show Gist options
  • Select an option

  • Save segeljakt/406fd7d195e92c9944498705bf400c35 to your computer and use it in GitHub Desktop.

Select an option

Save segeljakt/406fd7d195e92c9944498705bf400c35 to your computer and use it in GitHub Desktop.
  1. Get an API key from https://aistudio.google.com/apikey
  2. Place ask-gemini.sh at .claude/ask-gemini.sh
  3. Place ask-gemini.md at .claude/commands/ask-gemini.sh
  4. In claude, type something like /ask-gemini Are there any bugs in this code base?

In the root of the repo, run the command .claude/ask-gemini.sh $ARGUMENTS and handle the output.

#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 <text>"
exit 1
fi
gather_files() {
local base=$(basename $(pwd))
fd --type file --exclude vendor --exclude '*test*' \
--glob '{*.go,*.py,*.rs,*.env,*.toml,*.md,*.mod,*.yaml,*.sh,Makefile}' | \
while read -r file; do
echo "// $base/$file"
cat "$file"
echo
done
}
send_to_gemini() {
local prompt="$1"
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=$GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d "$(jq -n --arg text "$prompt" '{contents: [{parts: [{text: $text}]}]}')" \
| jq -r '.candidates[0].content.parts[0].text'
}
file_contents=$(gather_files)
full_prompt="$file_contents"$'\n'"$*"
send_to_gemini "$full_prompt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment