mirror of
https://github.com/zhangyanxs/repo2skill.git
synced 2026-11-18 18:03:50 +00:00
Add comprehensive skill to convert GitHub/GitLab/Gitee repos into OpenCode Skills using AI analysis, mirror rotation, and zero external dependencies. ## Features ✅ Multi-platform support (GitHub/GitLab/Gitee) ✅ Zero dependencies - uses configured LLM ✅ Mirror rotation (8+ GitHub mirrors with auto-failover) ✅ Rate limit handling with exponential backoff ✅ Complete documentation generation ✅ Batch conversion support ## Structure - SKILL.md: Main skill definition (350+ lines) - references/: API documentation for all 3 platforms - scripts/: Utility functions (bash helpers) - docs/: Installation, quickstart, examples ## Key Files - .opencode/skills/repo2skill/SKILL.md - .opencode/skills/repo2skill/references/github-api.md - .opencode/skills/repo2skill/references/gitlab-api.md - .opencode/skills/repo2skill/references/gitee-api.md - README.md, INSTALL.md, QUICKSTART.md, EXAMPLES.md ## Usage Users can simply say: "帮我把这个仓库转成技能:https://github.com/user/repo" The skill will: 1. Parse repository URL 2. Fetch data from multiple mirrors 3. Use configured LLM to analyze 4. Generate complete SKILL.md 5. Save to chosen location ## Implementation Pure OpenCode/Claude Code skill using: - Built-in tools (webfetch, bash, read, write) - User's configured LLM (Claude/GPT/Ollama) - No external packages or API keys needed Closes #1
5.9 KiB
5.9 KiB
Usage Examples
This document shows real-world examples of using repo2skill.
Example 1: Convert a Popular Framework
Input
帮我把这个仓库转成技能:https://github.com/vercel/next.js
Expected Behavior
-
Parsing
- Detects: GitHub, owner=vercel, repo=next.js
- URL validated
-
Data Collection
- Fetches repo metadata (stars: ~125k, language: TypeScript)
- Gets README.md (~8KB)
- Retrieves file tree (main branch)
- Extracts key docs (docs/, CONTRIBUTING.md, etc.)
-
AI Analysis
- Analyzes: React framework for SSR web apps
- Features: File routing, API routes, Image optimization
- Extracts: Installation commands, usage examples
-
Generated Skill
- Name:
nextjs-skill - Sections: Overview, Installation, Usage, API, Testing, FAQ
- Size: ~400-600 lines
- Name:
-
Installation
- User chooses:
~/.config/opencode/skills/nextjs-skill/SKILL.md - File written successfully
- User chooses:
Output
A comprehensive Next.js documentation skill ready to use!
Example 2: Convert a Small Utility Library
Input
帮我把这个库转成技能:https://github.com/user/my-utils
Expected Behavior
-
Lightweight Generation
- Focused on usage examples
- API reference for main functions
- Quick start guide
- ~200-300 lines
-
Special Considerations
- May skip complex sections if not applicable
- Focus on practical usage
- Include all public APIs
Example 3: Batch Conversion
Input
帮我转换这几个仓库:
- https://github.com/anthropics/anthropic-sdk-typescript
- https://gitlab.com/gitlab-org/gitlab
- https://gitee.com/mindspore/docs
Expected Behavior
-
Parallel Processing
- Processes all 3 repos concurrently
- Uses different mirrors for each
- Overall time: ~2-4 minutes
-
Individual Skills
anthropic-sdk-skillgitlab-skillmindspore-docs-skill
-
Installation
- User chooses location for each
- Or all installed to same directory
Example 4: Gitee Repository
Input
帮我把 Gitee 的这个项目转成技能:
https://gitee.com/mindspore/docs
Expected Behavior
-
Platform Detection
- Detects: Gitee
- Uses Gitee API v5
- Native Chinese support
-
Chinese Content
- Preserves Chinese documentation
- May generate bilingual skill
- Handles character encoding properly
-
Performance
- Faster access in China
- No mirror rotation needed
Example 5: Repository with No README
Input
帮我把这个项目转成技能:https://github.com/user/code-only-repo
Expected Behavior
-
Fallback Strategy
- No README detected
- Analyzes file structure instead
- Looks docs/ directory
- Checks for package.json, README.txt, etc.
-
Limited but Complete
- Generates skill based on code analysis
- Focuses on file structure and exports
- May show warnings: "No README found"
Example 6: Large Repository
Input
帮我把这个大项目转成技能:https://github.com/facebook/react
Expected Behavior
-
Extended Processing
- Takes longer (~3-5 minutes)
- Processes larger file tree (10k+ files)
- Might analyze only key directories
-
Optimized Output
- Focuses on main features
- May skip less important files
- Generates comprehensive but focused skill
Example 7: Invalid URL
Input
帮我把这个转成技能:https://not-a-real-site.com/user/repo
Expected Behavior
-
URL Validation
- Fails parsing: "not a recognized platform"
- Asks user to verify URL
-
Supported Formats
- ✅ https://github.com/user/repo
- ✅ github.com/user/repo
- ✅ https://gitlab.com/user/repo
- ✅ https://gitee.com/user/repo
- ❌ https://not-real.com/user/repo
Example 8: Private Repository (with token)
Setup
export GITHUB_TOKENS="ghp_xxx,ghp_yyy"
Input
帮我把这个私有仓库转成技能:https://github.com/user/private-repo
Expected Behavior
-
Authentication
- Uses GITHUB_TOKENS from environment
- Tries rotation through multiple tokens
- Accesses private repository successfully
-
Process
- Same as public repository
- Private content preserved
- Skill marked as private in metadata
Example 9: All Mirrors Failed
Input
帮我把这个仓库转成技能:https://github.com/user/repo
Error Scenario
-
Mirror Exhaustion
- All 8 GitHub mirrors fail
- Network issues or blocks
-
User Guidance
- Error: "All mirrors failed"
- Suggestions:
- Check internet connection
- Try using VPN
- Wait and retry
- Verify repository URL
Example 10: Installation Paths
After Generation
The skill asks: "Where should I save the generated skill?"
Option 1: Project Local
Path: ./.opencode/skills/nextjs-skill/SKILL.md
Use case: This project only
Option 2: Global User
Path: ~/.config/opencode/skills/nextjs-skill/SKILL.md
Use case: All projects (OpenCode)
Option 3: Claude Compatible
Path: ~/.claude/skills/nextjs-skill/SKILL.md
Use case: Works in both OpenCode and Claude Code
Tips From Examples
For Best Results
- Start Small - Try simple repos first
- Public Repos - Don't need tokens
- Well-Documented - Better input = better output
- Check URL - Ensure correct platform
- Internet - Stable connection needed
Common Failures
- Typo in URL - Double-check spelling
- Private without token - Need GITHUB_TOKENS
- All mirrors down - Network or VPN issues
- Very large repo - Takes longer, might timeout
Performance Reference
| Repo Size | Files | Expected Time |
|---|---|---|
| Small | < 500 | 30-60s |
| Medium | 500-2k | 1-2min |
| Large | 2k-10k | 2-5min |
| Huge | 10k+ | 5-10min |
Try it yourself and convert any repository into a skill! 🚀