Skip to content

Commit 83ba52c

Browse files
committed
Added claude github wiki example docs
1 parent 3b6d03e commit 83ba52c

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: "Claude GitHub wiki"
3+
sidebarTitle: "Claude GitHub wiki"
4+
description: "Ask questions about any public GitHub repository and get AI-powered analysis using the Claude Agent SDK and Trigger.dev."
5+
---
6+
7+
## Overview
8+
9+
This demo shows how to build an AI agent using the Claude Agent SDK that clones any public GitHub repo and uses Claude to answer questions about it's codebase. The agent explores the code using `Grep` and `Read` tools to provide detailed, accurate answers.
10+
11+
## Tech stack
12+
13+
- **[Next.js](https://nextjs.org/)** – React framework with App Router for the frontend
14+
- **[Claude Agent SDK](https://docs.anthropic.com/en/docs/agents-and-tools/claude-agent-sdk)** – Anthropic's SDK for building AI agents with file system and search tools
15+
- **[Trigger.dev](https://trigger.dev/)** – workflow orchestration with real-time streaming, observability, and deployment
16+
17+
## Demo video
18+
19+
<video
20+
controls
21+
className="w-full aspect-video"
22+
src="https://github.com/user-attachments/assets/ff89ae41-0488-4d1c-aa7d-4dad15cefc12"
23+
></video>
24+
25+
## GitHub repo
26+
27+
<Card
28+
title="View the Claude GitHub wiki agent repo"
29+
icon="GitHub"
30+
href="https://github.com/triggerdotdev/examples/tree/main/claude-agent-github-wiki"
31+
>
32+
Click here to view the full code for this project in our examples repository on GitHub. You can
33+
fork it and use it as a starting point for your own project.
34+
</Card>
35+
36+
## How it works
37+
38+
The agent workflow:
39+
40+
1. **Receive question** – User provides a GitHub URL and question about the repo
41+
2. **Clone repository** – Shallow clone to a temp directory (depth=1 for speed)
42+
3. **Analyze with Claude** – Agent explores the codebase using allowed tools:
43+
- `Grep` – Search for patterns across files
44+
- `Read` – Read file contents
45+
4. **Stream response** – Analysis streams to the frontend in real-time
46+
5. **Cleanup** – Temp directory is always deleted, even on failure
47+
48+
## Features
49+
50+
- **Ask anything about any public repo** – Architecture, security vulnerabilities, API endpoints, testing strategies, etc.
51+
- **Claude Agent SDK exploration** – Claude explores the codebase using `Grep` and `Read` tools
52+
- **Cancel anytime** – Abort long-running tasks with proper cleanup
53+
- **Trigger.dev [Realtime](/realtime/overview) streaming** – Watch Claude's analysis stream in as it's generated
54+
- **Progress tracking** – See clone status, analysis progress, and repo size via Trigger.dev metadata
55+
56+
## Relevant code
57+
58+
| File | Description |
59+
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
60+
| [`trigger/analyze-repo.ts`](https://github.com/triggerdotdev/examples/blob/main/claude-agent-github-wiki/trigger/analyze-repo.ts) | Main task that clones repo, runs Claude agent, and streams response |
61+
| [`trigger/agent-stream.ts`](https://github.com/triggerdotdev/examples/blob/main/claude-agent-github-wiki/trigger/agent-stream.ts) | Typed stream definition for real-time text responses |
62+
| [`app/api/analyze-repo/route.ts`](https://github.com/triggerdotdev/examples/blob/main/claude-agent-github-wiki/app/api/analyze-repo/route.ts) | API endpoint that triggers the task |
63+
| [`app/response/[runId]/page.tsx`](https://github.com/triggerdotdev/examples/blob/main/claude-agent-github-wiki/app/response/%5BrunId%5D/page.tsx) | Real-time streaming display with progress |
64+
65+
## trigger.config.ts
66+
67+
You need to mark the Claude Agent SDK as external in your trigger.config.ts file.
68+
69+
```ts trigger.config.ts
70+
import { defineConfig } from "@trigger.dev/sdk";
71+
72+
export default defineConfig({
73+
project: process.env.TRIGGER_PROJECT_REF!,
74+
runtime: "node",
75+
logLevel: "log",
76+
maxDuration: 3600, // 60 minutes for large repos
77+
build: {
78+
external: ["@anthropic-ai/claude-agent-sdk"],
79+
},
80+
machine: "medium-2x",
81+
});
82+
```
83+
84+
<Note>
85+
Adding packages to `external` prevents them from being bundled, which is necessary for the Claude
86+
Agent SDK. See the [build configuration docs](/config/config-file#external) for more details.
87+
</Note>
88+
89+
## Learn more
90+
91+
- [**Building agents with Claude Agent SDK**](/guides/ai-agents/claude-code-trigger) – Comprehensive guide for using Claude Agent SDK with Trigger.dev
92+
- [**Trigger.dev Realtime**](/realtime/overview) – Stream task progress to your frontend
93+
- [**Errors and retrying**](/errors-retrying) – Handle failures gracefully

0 commit comments

Comments
 (0)