| name | study-from-github |
|---|---|
| description | Learn undocumented or poorly-documented SDKs/APIs by studying real-world code on GitHub. Use when asked to "learn from GitHub", "study source code", "find examples", "understand unknown API", "check how others use X", "look for patterns". |
Learn how to use unknown or poorly-documented APIs by searching, cloning, and studying real-world code on GitHub.
- Apple's/Xcode/framework API lacks documentation or examples
- Need working code patterns for an SDK
- "How do I use X?" when search engines don't give clear answers
- Learning a new library by example
Use gh search code to find repositories using the API:
gh search code "<API-NAME>" --language swift --limit 10Pro tip: Combine API name with related terms to narrow results:
gh search code "RecognizeDocumentsRequest table" --language swift --limit 10
gh search code "VNRecognizeTextRequest boundingBox" --language swift --limit 10
gh search code "PDFPage thumbnail OCR" --language swift --limit 10Examples:
RecognizeDocumentsRequestVNRecognizeTextRequestPDFPage.thumbnail
Tips:
- Sort by repos with most stars (likely well-maintained)
- Filter by language matching your project (swift, python, etc.)
- Add
--limit 20if results are sparse
For each promising result, check:
- Repository purpose — Is it related to your use case?
- Star count — Higher stars = more likely battle-tested code
- File path — Usually
Sources/,Lib/, or root level
Prioritize repos that:
- Are apps/projects (not forks or archived)
- Have recent commits
- Match your domain (e.g., document scanning → receipt/OCR apps)
git clone https://github.com/<owner>/<repo>.gitThen find the relevant file:
grep -n "API-NAME" <repo>/**/*.swiftWhen studying the code, focus on:
- How is it initialized? (construction patterns)
- What configuration options exist? (properties, enums)
- How is it used in a complete flow? (from input to output)
- Error handling (what can go wrong?)
- Platform/version requirements (macOS 12+, iOS 16+, etc.)
- Copy the relevant code pattern
- Adapt to your project structure
- Test with your own data/files
- Iterate based on results
Goal: Learn how to extract tables from images using Apple's Vision framework.
Step 1: Search
gh search code "RecognizeDocumentsRequest" --language swift --limit 10Step 2: Find promising results
cameronrye/clarissa— Document OCR serviceLuegM/ReceiptBro— Receipt processing with table detection
Step 3: Clone the best match
git clone https://github.com/LuegM/ReceiptBro.gitStep 4: Study the relevant code
cat ReceiptBro/ReceiptBro/Services/OCRService.swiftStep 5: Extract the pattern
let request = RecognizeDocumentsRequest()
let observations = try await request.perform(on: imageData)
if let document = observations.first?.document {
let tables = document.tables
// ... process tables
}- No exa/web search for code — Use
gh search codeonly - Clone with git, not gh —
gh repo clonemay fail due to SSH keys - Focus on patterns, not theory — Find working code, not documentation
- Validate before sharing — Test the pattern before recommending it
- Note version requirements — Many Vision APIs require macOS 26+
Always check platform requirements:
RecognizeDocumentsRequest→ macOS 26+, iOS 26+VNRecognizeTextRequest→ macOS 10.15+, iOS 13+VNDetectDocumentSegmentationRequest→ macOS 13+, iOS 16+
If API requires newer OS than target, suggest fallback or alternative approach.