feat(skills): add /ask-codebase codebase intelligence skill

Adds a new Claude Code slash command that answers questions about the
LiteLLM codebase by chaining GitHub API calls, git history, and local
code searches:

  /ask-codebase Is issue #22500 fixed?
  /ask-codebase Did PR #22822 land in main?
  /ask-codebase Where does audit logging write to?

The skill classifies the question, gathers evidence from the appropriate
sources, and returns a structured response: Answer, Evidence (with
links/SHAs), Confidence level, and Caveats.

Also updates .gitignore to track .claude/commands/ so team members get
the shared slash commands when they clone or pull the repo.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Julio Quinteros 2026-03-05 07:22:54 -03:00
parent 9a13c76e2f
commit 60b440bcd4
4 changed files with 130 additions and 0 deletions

View file

@ -0,0 +1,111 @@
You are a codebase intelligence agent for the BerriAI/litellm repository.
The user's question is:
$ARGUMENTS
---
## Your job
Answer the question by gathering evidence from GitHub and the local codebase. Follow the steps below, skipping any that are not relevant to the question.
---
## Step 1 — Classify the question
Determine what kind of question this is. Multiple types can apply.
- **Issue status**: mentions "issue #N" or asks if a bug/request has been fixed or addressed
- **PR status**: mentions "PR #N" or asks if a change has landed / been merged
- **PR coverage**: asks whether a PR covers a specific scenario, edge case, or related bug
- **Code location**: asks where something lives in the codebase, how it is implemented, or what file handles X
- **General**: any other question about the codebase, architecture, or behaviour
---
## Step 2 — Gather evidence
Run only the lookups that are relevant to the question type.
### For issue status questions
```
gh issue view <N> --repo BerriAI/litellm --json number,title,state,body,closedAt,stateReason,comments,timelineItems
```
Then check for a closing PR:
- Look in `timelineItems` for `CrossReferencedEvent` or `ClosedEvent` entries that reference a PR
- Also run: `gh pr list --repo BerriAI/litellm --search "closes #<N> OR fixes #<N> OR fix #<N>" --state all --json number,title,state,mergedAt,mergeCommit`
- If a linked PR is found, retrieve it: `gh pr view <PR_N> --repo BerriAI/litellm --json number,title,state,mergedAt,mergeCommit,baseRefName,files`
Determine fixedness using this priority:
1. Issue closed + linked PR merged into main → **Fixed** (high confidence)
2. Issue closed + no linked PR → **Possibly fixed or stale-closed** (medium confidence)
3. Issue open + linked merged PR → **Likely fixed, issue not closed yet** (medium confidence)
4. Issue open + no merged PR → **Not fixed** (high confidence)
### For PR status questions
```
gh pr view <N> --repo BerriAI/litellm --json number,title,state,mergedAt,mergeCommit,baseRefName,headRefName,files,additions,deletions
```
Check whether it landed in main:
- `state: "MERGED"` and `baseRefName: "main"` → merged to main
- `state: "MERGED"` and `baseRefName != "main"` → merged to a feature/staging branch
- `state: "OPEN"` → still in review
- `state: "CLOSED"` (not merged) → abandoned
Also run:
```
git log --oneline --all | grep -i "<PR title keywords>"
git log --oneline main | head -30
```
### For PR coverage questions
Fetch the PR diff to understand what was actually changed:
```
gh pr view <N> --repo BerriAI/litellm --json files,body,comments
gh pr diff <N> --repo BerriAI/litellm 2>/dev/null | head -200
```
Then search the codebase for the scenario the user is asking about:
- Use Grep to find relevant code paths, error messages, or identifiers the question mentions
- Determine whether the diff touches those paths
### For code location / general questions
Extract the key concept, feature name, class name, or error string from the question, then:
1. Grep for the most specific identifier first (function name, error text, class name)
2. Broaden to module-level search if needed (Glob for file patterns)
3. Read the 2040 lines around the most relevant match
4. If the question is about behaviour or architecture, also search for tests:
`grep -r "<keyword>" tests/ --include="*.py" -l`
---
## Step 3 — Synthesize the answer
Write a concise, direct answer. Structure it as follows:
**Answer**: one sentence stating the conclusion clearly.
**Evidence**:
- bullet list of the key facts gathered (PR number + merge date, commit SHA, file + line, etc.)
- include links where applicable
**Confidence**: High / Medium / Low — and briefly why if not High.
**Caveats** (only if relevant): e.g., "the fix landed in main but may not be in the latest PyPI release", or "the PR closed the reported case but the related edge case in file X is not covered".
---
## Formatting rules
- Be concise. Lead with the answer, not the reasoning.
- If you could not find enough evidence to answer confidently, say so explicitly rather than guessing.
- Do not list every file you searched — only include sources that directly support the answer.
- If the question contains a typo or ambiguity (e.g., wrong issue number, vague feature name), state the assumption you made and proceed.

View file

@ -0,0 +1,11 @@
This is a table of PRs
$ARGUMENT[0]
from the above table,
for each row,
retrieve the PR number and PR age (in days)
checkout to the PR
analyze the PR and check if still is valid, specially considering its age: this is the verdict for knowing whether to close the PR, or seeing how to reactivate it (if it is worth it)
Output in TSV format, containing PR number, link, author, PR age, verdict, and REASONING for your verdict

View file

@ -0,0 +1,7 @@
Let the value for PR Number equals to $ARGUMENTS[0]
Is this related to my PR [PR_NUMBER]? if yes, fix it; else, create a new PR fixing the issue. Is very IMPORTANT that the PR be as scoped as possible, just touching relevant files that fix the issue, and if required create the fix from the main branch, not just from the PR branch contents: this will guarantee consistency and fixing the error in general.
The error found is:
$ARGUMENTS[1]

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
.venv_policy_test
.env
.claude
!.claude/commands
.newenv
newenv/*
litellm/proxy/myenv/*