modules/home/programs/cli-agents/shared/skills/coding/github-code-search/SKILL.md
Search GitHub code using gh code-search command. Use when looking for reference implementations, code examples, or specific patterns across GitHub repositories. Particularly useful for Nix configurations, language-specific patterns, or learning how others solved similar problems.
npx skillsauth add not-matthias/dotfiles-nix github-code-searchInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Search across GitHub's entire codebase using the gh code-search command. This is faster than browsing and helps you find real-world examples of how to structure code, configure tools, or solve problems.
gh CLI installed and authenticated (gh auth login)Use operators and filters to narrow results:
Basic syntax:
gh code-search [query] [flags]
Common operators:
language:nix - Search only in Nix fileslanguage:python - Search in Python filesrepo:owner/repo - Limit to specific repositoryfilename:flake.nix - Search only in files named flake.nixorg:nixos - Search within an organizationstars:>100 - Limit to popular repos (helps avoid noise)Combining operators:
gh code-search 'stdenv.mkDerivation' language:nix repo:nixos/nixpkgs stars:>50
Run the search and review results:
gh code-search 'search query' language:nix --limit 10
Flags:
--limit N - Show first N results (default 30, max 100)--json - Output as JSON for processing--match <field> - Match against: path, symbol, or content (default: content)Each result shows:
Click or copy the URL to examine the full context in your browser.
Search for how others define packages:
# Look for fetchFromGitHub usage
gh code-search 'fetchFromGitHub' language:nix stars:>50 --limit 10
# Find similar packages (e.g., Rust tools)
gh code-search 'rustPlatform.buildRustPackage' language:nix --limit 20
# Find AppImage packaging examples
gh code-search 'appimageTools' language:nix --limit 5
# Systemd service examples
gh code-search 'systemd.services' language:nix org:nixos --limit 10
# Home Manager module examples
gh code-search 'home.packages' language:nix stars:>100 --limit 15
# Browse flakes with specific input patterns
gh code-search 'inputs.nixpkgs' filename:flake.nix stars:>50 --limit 20
# Find flake outputs patterns
gh code-search 'outputs = {' filename:flake.nix --limit 10
# Python package examples
gh code-search 'def setup(' language:python filename:setup.py stars:>100
# Rust build patterns
gh code-search 'cargo.toml' language:toml stars:>50
# Shell script patterns
gh code-search '#!/bin/bash' language:shell --limit 10
Add negative filters to exclude test files or templates:
gh code-search 'pattern' language:nix -filename:test.nix
Find patterns within the NixOS organization (most authoritative):
gh code-search 'stdenv.mkDerivation' language:nix org:nixos --limit 50
Export to JSON and process locally:
gh code-search 'query' language:nix --json | jq '.[] | .url' > results.txt
Issue: Too many irrelevant results
stars:>100 to focus on popular, well-maintained repos. Add org:nixos for authoritative NixOS examples.Issue: Results seem outdated
Issue: Can't find specific syntax
stdenv.mkDerivation vs mkDerivation). Search for similar projects that use the same tool/library.stars:>50 helps surface well-maintained examplesfilename:flake.nix is faster than searching content for specific file typesgh code-search --help - Full command referencedocumentation
Save notes, journal entries, and research to the personal-notes Obsidian vault (personal-vault-v2). Use when the user asks to 'save note', 'save to notes', 'write to personal notes', 'save to daily notes', 'note this down', or wants to persist findings/analysis to their personal vault.
documentation
Use whenever the user asks to address, fix, resolve, review, or respond to pull-request comments or review feedback.
development
Apply Not Matthias's Rust-first personal coding style. Use whenever the user explicitly asks to apply or review their code style, make Rust match their preferences, perform a style pass, or simplify/refactor according to their conventions. Inspect only task-touched code, honor local project conventions first, and make only safe opt-out style edits.
development
Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for code patterns, find specific language constructs, or locate code with particular structural characteristics.