Agent skill

gkg

Global Knowledge Graph for codebase analysis. This skill should be used when searching for code definitions (functions, classes, methods), finding references to symbols, understanding code structure, analyzing import usage, generating repository maps, or performing impact analysis before refactoring. Supports TypeScript, JavaScript, Python, Java, and more.

Stars 5
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/huynguyen03dev/opencode-setup/tree/main/skills/gkg

SKILL.md

Global Knowledge Graph (GKG)

Overview

GKG provides semantic code analysis tools for exploring and understanding codebases. It indexes projects to enable fast symbol lookup, reference finding, and structural analysis.

Quick Start

Run from the opencode config directory (required for dependencies). Use --raw with JSON for parameters:

bash
cd /home/hazeruno/.config/opencode && bun skills/gkg/scripts/gkg.ts <command> --raw '<json>'

Core Commands

list-projects

List all indexed projects in the knowledge graph.

bash
cd /home/hazeruno/.config/opencode && bun skills/gkg/scripts/gkg.ts list-projects

index-project

Rebuild the knowledge graph index for a project.

bash
cd /home/hazeruno/.config/opencode && bun skills/gkg/scripts/gkg.ts index-project \
  --raw '{"project_absolute_path":"/path/to/project"}'

search-codebase-definitions

Find functions, classes, methods, constants across the codebase.

bash
cd /home/hazeruno/.config/opencode && bun skills/gkg/scripts/gkg.ts search-codebase-definitions \
  --raw '{"search_terms":["functionName","ClassName"],"project_absolute_path":"/path/to/project"}'

get-references

Find all usages of a symbol across the codebase.

bash
cd /home/hazeruno/.config/opencode && bun skills/gkg/scripts/gkg.ts get-references \
  --raw '{"absolute_file_path":"/path/to/file.ts","definition_name":"myFunction"}'

read-definitions

Read complete implementation of definitions.

bash
cd /home/hazeruno/.config/opencode && bun skills/gkg/scripts/gkg.ts read-definitions \
  --raw '{"definitions":[{"names":["myFunc"],"file_path":"/path/to/file.ts"}]}'

get-definition

Go to definition for a symbol on a specific line.

bash
cd /home/hazeruno/.config/opencode && bun skills/gkg/scripts/gkg.ts get-definition \
  --raw '{"absolute_file_path":"/path/to/file.ts","line":"const result = myFunc()","symbol_name":"myFunc"}'

repo-map

Generate a compact API-style map of repository structure.

bash
cd /home/hazeruno/.config/opencode && bun skills/gkg/scripts/gkg.ts repo-map \
  --raw '{"project_absolute_path":"/path/to/project","relative_paths":["src","lib"]}'

import-usage

Analyze import usages across the project.

bash
cd /home/hazeruno/.config/opencode && bun skills/gkg/scripts/gkg.ts import-usage \
  --raw '{"project_absolute_path":"/path/to/project","packages":[{"import_path":"react"}]}'

Common Workflows

Refactoring Impact Analysis

  1. Use search-codebase-definitions to find the symbol
  2. Use get-references to find all usages
  3. Review each usage location before making changes

Understanding Unfamiliar Code

  1. Use repo-map to get project structure overview
  2. Use search-codebase-definitions to find relevant functions
  3. Use read-definitions to read implementations

Tracing Dependencies

  1. Use import-usage to find where packages are imported
  2. Use get-references to trace function call chains

Resources

scripts/

  • gkg.ts - CLI tool for all knowledge graph operations

references/

  • api_reference.md - Detailed parameter documentation for each command

Expand your agent's capabilities with these related and highly-rated skills.

huynguyen03dev/opencode-setup

context7

Fetch up-to-date documentation and code examples for any library or framework. Use when needing API references, code examples, library documentation, or framework guides. Supports React, Next.js, MongoDB, Supabase, and thousands of other libraries.

5 0
Explore
huynguyen03dev/opencode-setup

github

Interact with GitHub repositories, issues, pull requests, and code via the GitHub MCP server. This skill should be used when managing repositories, creating/updating files, working with issues and PRs, searching code/repos/users, creating branches, and performing code reviews. Supports all major GitHub API operations.

5 0
Explore
huynguyen03dev/opencode-setup

code-review

Use when receiving code review feedback (especially if unclear or technically questionable), when completing tasks or major features requiring review before proceeding, or before making any completion/success claims. Covers three practices - receiving feedback with technical rigor over performative agreement, requesting reviews via code-reviewer subagent, and verification gates requiring evidence before any status claims. Essential for subagent-driven development, pull requests, and preventing false completion claims.

5 0
Explore
huynguyen03dev/opencode-setup

gh-grep

Search real-world code examples across millions of GitHub repositories using grep.app. This skill should be used when looking for implementation patterns, API usage examples, library integration patterns, or production code references. Supports literal code search, regex patterns, and filtering by language/repo/path.

5 0
Explore
huynguyen03dev/opencode-setup

deep-wiki

Access AI-generated documentation and insights for GitHub repositories via DeepWiki. This skill should be used when exploring unfamiliar codebases, understanding repository architecture, finding implementation patterns, or asking questions about how a GitHub project works. Supports any public GitHub repository.

5 0
Explore
huynguyen03dev/opencode-setup

chrome-devtools

Browser automation, debugging, and performance analysis using Puppeteer CLI scripts. Use for automating browsers, taking screenshots, analyzing performance, monitoring network traffic, web scraping, form automation, and JavaScript debugging.

5 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results