gkg
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 this skill directory. Use --raw with JSON for parameters:
bun ./scripts/gkg.ts <command> --raw '<json>'
Core Commands
list-projects
List all indexed projects in the knowledge graph.
bun ./scripts/gkg.ts list-projects
index-project
Rebuild the knowledge graph index for a project.
bun ./scripts/gkg.ts index-project \
--raw '{"project_absolute_path":"/path/to/project"}'
search-codebase-definitions
Find functions, classes, methods, constants across the codebase.
bun ./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.
bun ./scripts/gkg.ts get-references \
--raw '{"absolute_file_path":"/path/to/file.ts","definition_name":"myFunction"}'
read-definitions
Read complete implementation of definitions.
bun ./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.
bun ./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.
bun ./scripts/gkg.ts repo-map \
--raw '{"project_absolute_path":"/path/to/project","relative_paths":["src","lib"]}'
import-usage
Analyze import usages across the project.
bun ./scripts/gkg.ts import-usage \
--raw '{"project_absolute_path":"/path/to/project","packages":[{"import_path":"react"}]}'
Common Workflows
Refactoring Impact Analysis
- Use
search-codebase-definitionsto find the symbol - Use
get-referencesto find all usages - Review each usage location before making changes
Understanding Unfamiliar Code
- Use
repo-mapto get project structure overview - Use
search-codebase-definitionsto find relevant functions - Use
read-definitionsto read implementations
Tracing Dependencies
- Use
import-usageto find where packages are imported - Use
get-referencesto 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
More from l-yifan/skills
scientific-figure-pro
Generate publication-ready scientific figures in Python/matplotlib with a consistent figures4papers house style. Use when creating or refining academic bar/trend/heatmap/scatter/multi-panel figures, enforcing visual consistency, or exporting paper-ready PNG/PDF/SVG outputs.
31figures4papers-playbook
Locate and adapt real plotting examples from the figures4papers repository. Use when users ask for a figure in the style of specific papers/projects, want the closest existing script template, or need fast script selection by chart type/domain before customization.
30deep-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.
25gh-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.
18github
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.
16context7
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.
13