{"id":36632035,"url":"https://github.com/tcampbell01/ai-code-explainer","last_synced_at":"2026-01-15T03:16:34.214Z","repository":{"id":332055325,"uuid":"1130728111","full_name":"tcampbell01/ai-code-explainer","owner":"tcampbell01","description":"AI-powered code explainer with interactive chat. Provides beginner/intermediate/expert level explanations using Claude Haiku. Features curated learning resources and follow-up Q\u0026A.","archived":false,"fork":false,"pushed_at":"2026-01-09T11:27:20.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-12T17:13:18.710Z","etag":null,"topics":["ai","anthropic","beginner-friendly","chatbot","claude","code-explanation","documentation","education","fastapi","javascript","programming","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tcampbell01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-08T23:28:35.000Z","updated_at":"2026-01-09T00:47:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tcampbell01/ai-code-explainer","commit_stats":null,"previous_names":["tcampbell01/ai-code-explainer"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tcampbell01/ai-code-explainer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcampbell01%2Fai-code-explainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcampbell01%2Fai-code-explainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcampbell01%2Fai-code-explainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcampbell01%2Fai-code-explainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tcampbell01","download_url":"https://codeload.github.com/tcampbell01/ai-code-explainer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcampbell01%2Fai-code-explainer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28442256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"online","status_checked_at":"2026-01-15T02:00:08.019Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","anthropic","beginner-friendly","chatbot","claude","code-explanation","documentation","education","fastapi","javascript","programming","python"],"created_at":"2026-01-12T09:39:13.528Z","updated_at":"2026-01-15T03:16:34.208Z","avatar_url":"https://github.com/tcampbell01.png","language":"Python","readme":"# AI Code Explainer\n\nAn intelligent code explanation tool that uses Claude Haiku to provide detailed, level-appropriate explanations of code snippets. Features include interactive chat, curated learning resources, and explanations tailored to beginner, intermediate, or expert levels.\n\n## Features\n\n- **Multi-Level Explanations**: Tailored explanations for beginner, intermediate, and expert developers\n- **Interactive Chat**: Ask follow-up questions about explained code\n- **Curated Learning Resources**: Verified documentation links for key programming concepts\n- **Multiple Languages**: Support for Python, JavaScript, Java, C++, and more\n- **Structured Output**: Organized explanations with summaries, walkthroughs, gotchas, and improvements\n- **Cost-Effective**: Uses Claude Haiku (~$2/month for moderate usage)\n\n## Architecture\n\n- **Backend**: FastAPI with Claude Haiku integration\n- **Frontend**: Simple HTML/JavaScript interface\n- **AI Model**: Anthropic Claude Haiku (cheap, fast, reliable)\n- **Documentation**: Curated database of verified learning resources\n\n## Quick Start\n\n### Prerequisites\n\n- Python 3.9+\n- Anthropic API key ([Get one here](https://console.anthropic.com/))\n\n### 1. Backend Setup\n\n```bash\n# Clone and navigate to backend\ncd backend\n\n# Install dependencies\npip install -r requirements.txt\n\n# Configure environment\ncp .env.example .env\n# Edit .env and add your Anthropic API key:\n# ANTHROPIC_API_KEY=your_actual_key_here\n\n# Start the backend server\nuvicorn app.main:app --reload --port 8000\n```\n\n### 2. Frontend Setup\n\n```bash\n# In a new terminal, navigate to frontend\ncd frontend\n\n# Start simple HTTP server\npython3 -m http.server 3000\n```\n\n### 3. Access the Application\n\nOpen your browser and go to: `http://localhost:3000/simple.html`\n\n## Usage\n\n1. **Paste your code** into the text area\n2. **Select programming language** (Python, JavaScript, Java, C++)\n3. **Choose skill level** (Beginner, Intermediate, Expert)\n4. **Click \"Explain Code\"** to get detailed explanation\n5. **Use the chat** to ask follow-up questions about the code\n\n### Example\n\n```python\ndef factorial(n):\n    if n \u003c= 1:\n        return 1\n    return n * factorial(n-1)\n```\n\n**Beginner explanation** will cover what recursion is and how it works.\n**Expert explanation** will discuss time complexity, stack overflow risks, and optimization strategies.\n\n## API Endpoints\n\n### `POST /explain`\nExplains code with structured output.\n\n**Request:**\n```json\n{\n  \"code\": \"def hello(): print('world')\",\n  \"language\": \"python\",\n  \"level\": \"beginner\"\n}\n```\n\n**Response:**\n```json\n{\n  \"summary\": \"Brief explanation\",\n  \"walkthrough\": [\"Step 1\", \"Step 2\"],\n  \"concepts\": [{\"concept\": \"Function\", \"learn_more_url\": \"https://docs.python.org/3/\"}],\n  \"gotchas\": [\"Potential issues\"],\n  \"improvements\": [\"How to enhance\"],\n  \"questions_to_ask\": [\"Deeper questions\"],\n  \"risks\": [{\"line\": 1, \"reason\": \"Security issue\"}]\n}\n```\n\n### `POST /chat`\nInteractive chat about explained code.\n\n**Request:**\n```json\n{\n  \"question\": \"What happens with negative numbers?\",\n  \"code\": \"def factorial(n): ...\",\n  \"language\": \"python\", \n  \"level\": \"beginner\"\n}\n```\n\n## Configuration\n\n### Environment Variables\n\n```env\n# Required\nANTHROPIC_API_KEY=your_anthropic_key_here\n\n# Optional\nMODEL_NAME=claude-3-haiku-20240307\n```\n\n### Supported Languages\n\n- Python\n- JavaScript\n- Java\n- C++\n- And more (the AI adapts to most programming languages)\n\n### Skill Levels\n\n- **Beginner**: Basic concepts, simple explanations\n- **Intermediate**: More technical details, best practices\n- **Expert**: Advanced concepts, performance considerations, security implications\n\n## Cost Estimation\n\nUsing Claude Haiku:\n- **Per explanation**: ~$0.0008-0.002\n- **Monthly cost**: Under $2 for 1000 explanations\n- **Free tier**: None (pay per use)\n\nMuch cheaper than GPT-4 while maintaining good quality for code explanation tasks.\n\n## Project Structure\n\n```\nai-code-explainer/\n├── backend/\n│   ├── app/\n│   │   ├── main.py          # FastAPI application\n│   │   ├── llm.py           # Claude integration\n│   │   ├── prompts.py       # AI prompts\n│   │   ├── schemas.py       # Pydantic models\n│   │   └── url_database.py  # Curated learning resources\n│   ├── requirements.txt\n│   └── .env.example\n├── frontend/\n│   ├── simple.html          # Main interface\n│   └── package.json\n├── README.md\n└── GOOGLE_SEARCH_ENHANCEMENT.md\n```\n\n## Future Enhancements\n\n### Planned Features\n\n1. **Google Custom Search API Integration**\n   - Dynamic discovery of current documentation links\n   - Automatic URL verification\n   - Broader coverage of programming concepts\n   - See `GOOGLE_SEARCH_ENHANCEMENT.md` for implementation details\n\n2. **Enhanced UI/UX**\n   - Syntax highlighting for code input\n   - Dark/light theme toggle\n   - Export explanations to PDF/Markdown\n   - Code snippet sharing via URLs\n\n3. **Advanced Features**\n   - File upload for larger code files\n   - Multi-file project analysis\n   - Code diff explanations\n   - Integration with popular IDEs (VS Code extension)\n\n4. **User Management**\n   - User accounts and saved explanations\n   - Explanation history\n   - Favorite concepts and bookmarks\n   - Usage analytics and insights\n\n5. **AI Improvements**\n   - Support for newer Claude models\n   - Custom prompts for specific use cases\n   - Multi-language explanations (Spanish, French, etc.)\n   - Code generation suggestions\n\n6. **Performance \u0026 Scaling**\n   - Response caching for common code patterns\n   - Rate limiting and usage quotas\n   - Database integration for persistence\n   - Docker containerization\n\n7. **Educational Features**\n   - Interactive coding exercises\n   - Progressive difficulty levels\n   - Code quality scoring\n   - Learning path recommendations\n\n### Technical Debt \u0026 Improvements\n\n- Add comprehensive error handling\n- Implement proper logging\n- Add unit and integration tests\n- Set up CI/CD pipeline\n- Add API documentation (OpenAPI/Swagger)\n- Implement request validation and sanitization\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n## License\n\nMIT License - see LICENSE file for details\n\n## Support\n\nFor issues and questions:\n1. Check existing GitHub issues\n2. Create a new issue with detailed description\n3. Include code samples and error messages\n\n## Acknowledgments\n\n- [Anthropic](https://www.anthropic.com/) for Claude Haiku API\n- [FastAPI](https://fastapi.tiangolo.com/) for the backend framework\n- [Pydantic](https://docs.pydantic.dev/) for data validation","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcampbell01%2Fai-code-explainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftcampbell01%2Fai-code-explainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcampbell01%2Fai-code-explainer/lists"}