context-discovery

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Context Discovery

Context Discovery

Overview

概述

Discover project standards and patterns before implementing features. Context-scout resolves the context root using the OAC Context Discovery Protocol, then finds and ranks relevant files based on your request.
Announce at start: "I'm using the context-discovery skill to find relevant standards for [feature/task]."
在实现功能前先了解项目标准和模式。context-scout会通过OAC Context Discovery Protocol解析上下文根目录,然后根据你的请求查找并排序相关文件。
开始时需告知:“我正在使用context-discovery技能来查找[功能/任务]的相关标准。”

The Process

流程

Step 1: Invoke Context-Scout

步骤1:调用Context-Scout

Run the skill with your implementation topic:
bash
/context-discovery [what you're implementing]
Examples:
  • /context-discovery JWT authentication
  • /context-discovery React form validation
  • /context-discovery database migration workflow
针对你的实现主题运行该技能:
bash
/context-discovery [你要实现的内容]
示例:
  • /context-discovery JWT authentication
  • /context-discovery React form validation
  • /context-discovery database migration workflow

Step 2: Load Critical Priority Files

步骤2:加载最高优先级文件

Read EVERY file marked Critical Priority (paths returned by context-scout, relative to the resolved context root):
bash
Read: {context_root}/core/standards/code-quality.md
Read: {context_root}/core/standards/security-patterns.md
These are mandatory—proceed only after loading.
读取所有标记为Critical Priority(由context-scout返回的路径,相对于解析后的上下文根目录)的文件:
bash
Read: {context_root}/core/standards/code-quality.md
Read: {context_root}/core/standards/security-patterns.md
这些文件是强制性的——必须加载完成后才能继续。

Step 3: Load High Priority Files

步骤3:加载高优先级文件

Read files marked High Priority:
bash
Read: {context_root}/core/workflows/approval-gates.md
These are strongly recommended for your implementation.
读取标记为High Priority的文件:
bash
Read: {context_root}/core/workflows/approval-gates.md
这些文件对于你的实现是强烈推荐的。

Step 4: Load Medium Priority (If Needed)

步骤4:加载中等优先级文件(如有需要)

Read Medium Priority files for additional context:
bash
Read: {context_root}/project-intelligence/architecture.md
These are optional but helpful.
读取Medium Priority文件以获取额外上下文:
bash
Read: {context_root}/project-intelligence/architecture.md
这些文件可选但有帮助

Step 5: Apply to Implementation

步骤5:应用到实现中

  • Follow standards from loaded files
  • Apply patterns to your code
  • Use naming conventions discovered
  • Check workflows before executing
  • 遵循已加载文件中的标准
  • 将模式应用到你的代码中
  • 使用发现的命名约定
  • 执行前检查工作流程

Delegation Pattern

委托模式

When invoking subagents, pass discovered context files:
markdown
Invoke coder-agent:

Task: Implement JWT service

Context to load:
- .opencode/context/core/standards/code-quality.md
- .opencode/context/core/standards/security-patterns.md

Instructions: Follow functional patterns and security best practices.
调用子Agent时,传递已发现的上下文文件:
markdown
Invoke coder-agent:

Task: Implement JWT service

Context to load:
- .opencode/context/core/standards/code-quality.md
- .opencode/context/core/standards/security-patterns.md

Instructions: Follow functional patterns and security best practices.

Error Handling

错误处理

"No context files found"
  • Run
    /install-context
    to download context first
"Too many files returned"
  • Be more specific (e.g., "TypeScript coding standards" not "coding")
"Which files do I load?"
  • Always: Critical → High → Medium (if needed)
“未找到上下文文件”
  • 先运行
    /install-context
    下载上下文
“返回的文件过多”
  • 请更具体(例如,使用“TypeScript coding standards”而非“coding”)
“我应该加载哪些文件?”
  • 始终按照:最高优先级 → 高优先级 → 中等优先级(如有需要)的顺序

Remember

注意事项

  • Context FIRST, code SECOND—never skip discovery
  • Critical priority files are MANDATORY, not optional
  • Training data is outdated—context is current
  • Pass context forward when delegating to subagents
  • Only use file paths returned by context-scout
  • 先上下文,后代码——绝不要跳过发现步骤
  • 最高优先级文件是强制性的,而非可选
  • 训练数据已过时——上下文是最新的
  • 委托给子Agent时传递上下文
  • 仅使用context-scout返回的文件路径

Related

相关内容

  • task-breakdown
  • code-execution
  • external-research

Task: Discover context files for $ARGUMENTS
Follow navigation-driven discovery and return ranked recommendations.
  • task-breakdown
  • code-execution
  • external-research

任务:为**$ARGUMENTS**发现上下文文件
遵循导航式发现并返回排序后的推荐结果。