AgentSkillsCN

gather-context

在开始涉及 Jira 问题、功能、Bug 或代码评审的技能时,利用代码搜索、知识库以及已知问题,快速获取相关上下文。

SKILL.md
--- frontmatter
name: gather-context
description: Gather relevant context for a task using code search, knowledge base, and known issues. Use at the start of skills that need context about a Jira issue, feature, bug, or code review.

Gather Context

Consolidates: code_search, knowledge_query, and check_known_issues into structured context.

Inputs

InputTypeDefaultPurpose
querystringrequiredWhat to search (issue description, feature name, error message)
projectstring"automation-analytics-backend"Project for knowledge lookup
tool_namestring-Tool to check for known issues
code_limitint5Max code search results
include_architecturebooltrueInclude architecture overview
include_gotchasbooltrueInclude project gotchas
include_patternsbooltrueInclude coding patterns

Workflow

1. Code Search

  • code_search(query=query, project=project, limit=code_limit)
  • Parse into structured results (file paths, relevance)

2. Load Gotchas (if include_gotchas)

  • knowledge_query(project=project, section="gotchas")
  • Parse list items into actionable gotchas

3. Load Patterns (if include_patterns)

  • knowledge_query(project=project, section="patterns.coding")
  • Parse into coding patterns list

4. Load Architecture (if include_architecture)

  • knowledge_query(project=project, section="architecture.overview")

5. Check Known Issues

  • check_known_issues(tool_name=tool_name, error_text=query[:100])
  • Parse into known issues list

6. Build Combined Context

Output object with:

  • code: found, count, results
  • gotchas: found, count, items
  • patterns: found, count, items
  • architecture: found, overview
  • known_issues: found, count, items
  • summary: has_code, has_gotchas, has_patterns, total_items

7. Log

  • memory_session_log("Gathered context for: {query[:50]}", "Code: X, Gotchas: Y, Patterns: Z")

Key MCP Tools

  • code_search — semantic code search
  • knowledge_query — gotchas, patterns, architecture
  • check_known_issues — known fixes for tools/errors
  • memory_session_log — session logging