Build a Code‑Repository Q&A Agent Skill for OpenCode: From Installation to Custom Prompt Design
This guide walks you through creating an Agent Skill that turns OpenCode into a code‑repository expert, covering OpenCode installation, skill‑creator setup, DeepWiki integration, SKILL.md design, disambiguation, hallucination safeguards, and practical examples for querying Ascend inference ecosystem repositories.
Overview
OpenCode is an open‑source AI coding assistant. By installing OpenCode, the DeepWiki MCP and the meta‑skill skill‑creator, you can build a custom Agent Skill that enables the model to answer technical questions about a set of open‑source repositories (vLLM, vLLM‑Ascend, MindIE‑LLM, MindIE‑SD, MindIE‑Motor, MindIE‑Turbo, msModelSlim).
Installation
Install OpenCode: curl -fsSL https://opencode.ai/install | bash Then add ~/.opencode/bin to PATH.
Install the meta‑skill skill‑creator (automatically via OpenCode or manually):
mkdir -p ~/.config/opencode/skills/skill-creator
cp -r /path/to/skill-creator/* ~/.config/opencode/skills/skill-creator/Install DeepWiki MCP: opencode mcp add Verify with /mcps.
Creating the code-repos-expert Skill
In OpenCode’s Plan mode run:
/skill-creator 创建一个新的代码仓库智能问答 Skill —— code-repos-expert,并支持中文(Chinese)和英语(English)回答。Skill 内容得是英文。Provide the following specification (English only):
1 - Ascend inference ecosystem code‑repository Q&A expert: answer usage, deployment, supported models, features, architecture, configuration, debugging, testing, performance optimization, custom development, source‑code analysis, etc. Support bilingual replies.
2 - For each repository mentioned, use DeepWiki to query owner/repo + intent‑derived query.
3 - If the repository cannot be determined, ask the user for clarification and never guess. Mark uncertain information with a disclaimer.Target repositories:
https://github.com/vllm-project/vllm
https://github.com/vllm-project/vllm-ascend
https://gitcode.com/Ascend/MindIE-LLM
https://gitcode.com/Ascend/MindIE-SD
https://gitcode.com/Ascend/MindIE-Motor
https://gitcode.com/Ascend/MindIE-Turbo
https://gitcode.com/Ascend/msmodelslim
After the plan phase, switch to Build mode and confirm: 继续创建此 Skill The generated folder ~/.config/opencode/skills/code-repos-expert can be activated by copying it into the OpenCode skills directory.
Skill Design
1. Intent‑Mapping Table
Natural‑language expressions are mapped to technical intents (e.g., “太慢了” → Performance optimization, “报错了” → Troubleshooting). The table is stored in SKILL.md and drives intent identification.
2. Repository Routing Table
Keywords are mapped to the corresponding GitHub repository. Example: the keyword vllm‑ascend triggers a dual query – first the upstream vllm-project/vllm, then the plugin vllm-project/vllm-ascend. The full routing table is included in the skill.
3. Disambiguation Protocol
If the user mentions an ambiguous term (e.g., “MindIE” or “vllm” without “ascend”), the agent asks a clarifying question instead of guessing.
4. Hallucination Guard
When DeepWiki returns no result, the skill explicitly states that the information is unavailable and adds a disclaimer such as “(This information may be uncertain – please verify with official documentation).”
Typical Usage Examples
Example 1 – Deep Technical Query
/code-repos-expert vllm-ascend 具体是怎么结合 vllm 来适配 Qwen3-Next 的?必须深入分析关键的模型 patch 和算子适配 patch,并重点关注 patch_triton 中的具体内容The agent first queries vllm-project/vllm for architecture details, then vllm-project/vllm-ascend for Ascend‑specific patches, and clearly marks the source of each answer.
Example 2 – Cross‑Repository Relationship
/code-repos-expert MindIE-LLM、MindIE-SD、MindIE-Motor、MindIE-Turbo 这四者之间的关系?The skill aggregates information from all four repositories and returns a concise overview of their architectural connections.
Key Implementation Details
SKILL.md structure : YAML‑style metadata (name, description) followed by a Markdown body that contains the workflow, intent table, routing table, and response formatting rules.
DeepWiki commands used in the skill:
mcp__deepwiki__ask_question(repoName="owner/repo", question="...")and optional structure queries mcp__deepwiki__read_wiki_structure or mcp__deepwiki__read_wiki_contents.
Response format : conclusion first, then detailed steps; all code snippets, file paths, and configuration names are presented verbatim; source attribution is included for each piece of information.
Limitations
The skill only covers the seven repositories listed above. Queries outside this scope are rejected with a clear statement that the skill does not support them.
Reference
Full source code and SKILL.md are available at https://github.com/Agent-Skill-007/learn-agent-skills.
Sohu Tech Products
A knowledge-sharing platform for Sohu's technology products. As a leading Chinese internet brand with media, video, search, and gaming services and over 700 million users, Sohu continuously drives tech innovation and practice. We’ll share practical insights and tech news here.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
