agentsclimarketplace

Gitnexus codebase intelligence

Skill mahmoud20138/Tradecraft/plugins/tradecraft/skills/gitnexus-codebase-intelligence

GitNexus — codebase intelligence platform that transforms repos into knowledge graphs for AI agents. 7 MCP tools: symbol discovery (BM25+semantic), impact radius analysis, 360° symbol context, git-diff impact mapping, multi-file coordinated renaming,From its SKILL.md

Install
npx -y skills add mahmoud20138/Tradecraft --skill gitnexus-codebase-intelligence

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 10 stars10 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

28.9 KB, ~8.7k tokens by cl100k_base, as published. Nobody here has run it

gitnexus-codebase-intelligence

USE FOR:

  • "understand codebase impact before editing"
  • "find all callers / dependents of a symbol"
  • "safe multi-file renaming"
  • "git diff impact analysis"
  • "MCP tool for codebase architecture understanding"
  • "knowledge graph of code structure"
  • "AI agent codebase context" tags: [MCP, codebase, knowledge-graph, Tree-sitter, symbol-search, impact-analysis, Claude-Code, Cursor, Cypher] kind: tool category: pro-code-architecture

What Is GitNexus?

Codebase intelligence platform — transforms repos into knowledge graphs for AI agents.

  • Repo: https://github.com/abhigyanpatwari/GitNexus
  • Web: gitnexus.vercel.app (no install)
  • Integrations: Claude Code, Cursor, Windsurf, any MCP-compatible editor
  • Privacy: 100% local — code never leaves your machine

"Building a nervous system for agent context"


Core Problem Solved

Traditional AI assistants don't know when edits break downstream dependencies. GitNexus precomputes architectural intelligence at index time → fast, accurate impact analysis at query time.


7 MCP Tools

ToolWhat It Does
symbol_searchBM25 + semantic hybrid search across codebase
symbol_context360° view: incoming + outgoing relationships for any symbol
impact_radiusAll code that depends on a given symbol
git_diff_impactMap git diff → which symbols are affected + their dependents
multi_file_renameCoordinated safe rename across all references
graph_queryRaw Cypher queries on the knowledge graph
discover_symbolsList all symbols by type (functions, classes, methods)

Indexing Pipeline (6 Phases)

1. Structural mapping   → directory tree, file relationships
2. AST parsing          → Tree-sitter extracts symbols per language
3. Import/call resolve  → link usages to definitions
4. Community cluster    → group related modules
5. Execution flow trace → call chains, data flow paths
6. Hybrid search index  → BM25 + vector embeddings

Installation & Setup

# Index a repository
npx gitnexus analyze

# Configure MCP for your editor (one-time, multi-project)
npx gitnexus setup
# → adds GitNexus MCP server to Claude Code / Cursor / Windsurf config

Web UI (no install):

https://gitnexus.vercel.app
# Upload or link repo → explore in browser

Claude Code Integration

After npx gitnexus setup, Claude Code gets access to all 7 MCP tools:

# In Claude Code session:
> "What calls the processOrder function?"
→ Claude uses symbol_context MCP tool → instant impact map

> "I'm about to rename UserService — what breaks?"
→ Claude uses impact_radius → lists all 47 dependent symbols

> "Show me what this git diff affects"
→ Claude uses git_diff_impact → maps changed lines to affected call chains

Supported Languages

LanguageImportsTypesFrameworks
TypeScript / JSReact, Next.js
PythonDjango, FastAPI
JavaSpring
Go
Rust
C#.NET
PHPLaravel
+ 6 morevariesvaries

Example: Impact Radius Query

-- Raw Cypher query via graph_query tool
MATCH (s:Symbol {name: "UserService"})<-[:CALLS|IMPORTS*1..3]-(dep:Symbol)
RETURN dep.name, dep.file, dep.line
ORDER BY dep.file

Returns every symbol within 3 hops that depends on UserService.


KNOWLEDGE INJECTION: OpenCV

Source: https://github.com/opencv/opencv

Routed to: development.md

Date: 2026-03-18

SKILL: opencv

name: opencv description: > OpenCV - Open Source Computer Vision Library. 86k stars, 14 modules. imgproc (filtering/contours/warp), dnn (YOLO/ONNX inference), features2d (SIFT/ORB/AKAZE matching), objdetect (Haar/HOG/QR), calib3d, tracking (KCF/CSRT). pip install opencv-contrib-python. C++ and Python. USE FOR:

  • image processing pipeline
  • contour detection and perspective warp
  • YOLO object detection with OpenCV dnn
  • feature matching SIFT ORB AKAZE
  • face detection Haar cascade
  • camera calibration undistort
  • object tracking KCF CSRT
  • chess board detection
  • color segmentation HSV mask
  • background subtraction optical flow tags: [OpenCV, computer-vision, image-processing, DNN, YOLO, SIFT, ORB, contours, tracking, Python, C++] kind: library category: programmatic-drawing

What Is OpenCV?

Open Source Computer Vision Library.


Installation

pip install opencv-contrib-python        # recommended (includes SIFT, tracking)
pip install opencv-contrib-python-headless  # no GUI (servers)
import cv2
print(cv2.__version__)   # e.g. 4.9.0

Module Map

ModuleKey Functions
coreMat, imread, imwrite, cvtColor
imgprocGaussianBlur, Canny, threshold, findContours, warpPerspective
features2dSIFT, ORB, AKAZE, BFMatcher, FLANN
objdetectCascadeClassifier, QRCodeDetector
dnnreadNetFromONNX, blobFromImage, forward
videoBackgroundSubtractor, calcOpticalFlow
calib3dcalibrateCamera, undistort, findHomography
trackingTrackerKCF, TrackerCSRT, TrackerMOSSE
mlSVM, KMeans
photoinpaint, fastNlMeansDenoising

Core: Load, Convert, Save

import cv2, numpy as np

img  = cv2.imread("image.jpg")               # BGR uint8
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
hsv  = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
rgb  = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)  # for matplotlib
h, w, c = img.shape
roi  = img[y1:y2, x1:x2]                     # crop
cv2.imwrite("out.jpg", img)
cv2.imshow("win", img); cv2.waitKey(0)

imgproc: Filters & Edges

blur   = cv2.GaussianBlur(gray, (5,5), 0)
median = cv2.medianBlur(gray, 5)               # salt-and-pepper
bilat  = cv2.bilateralFilter(img, 9, 75, 75)   # edge-preserving

edges  = cv2.Canny(blur, 50, 150)

kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5,5))
opened = cv2.morphologyEx(binary, cv2.MORPH_OPEN,  kernel)  # remove noise
closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel)  # fill holes

imgproc: Thresholding

_, binary  = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY)
_, otsu    = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
adaptive   = cv2.adaptiveThreshold(gray, 255,
               cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 2)

# Color range mask
lower = np.array([100, 50, 50])
upper = np.array([130, 255, 255])
mask  = cv2.inRange(hsv, lower, upper)

imgproc: Contours

cnts, hier = cv2.findContours(binary, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

for cnt in cnts:
    area = cv2.contourArea(cnt)
    if area < 500: continue

    peri   = cv2.arcLength(cnt, True)
    approx = cv2.approxPolyDP(cnt, 0.02*peri, True)
    x,y,w,h = cv2.boundingRect(cnt)

    M  = cv2.moments(cnt)
    cx = int(M["m10"] / M["m00"])   # centroid
    cy = int(M["m01"] / M["m00"])

    cv2.drawContours(img, [cnt], 0, (0,255,0), 2)

# Shape by vertex count
n = len(approx)
if   n == 3: shape = "triangle"
elif n == 4: shape = "quad/rect"
elif n == 5: shape = "pentagon"
else:        shape = "circle"

imgproc: Perspective Warp

src = np.float32([[tl_x,tl_y],[tr_x,tr_y],[bl_x,bl_y],[br_x,br_y]])
dst = np.float32([[0,0],[W,0],[0,H],[W,H]])
M      = cv2.getPerspectiveTransform(src, dst)
warped = cv2.warpPerspective(img, M, (W, H))

features2d: SIFT / ORB Matching

sift  = cv2.SIFT_create()
orb   = cv2.ORB_create(nfeatures=1500)

kp1, des1 = sift.detectAndCompute(img1, None)
kp2, des2 = sift.detectAndCompute(img2, None)

bf      = cv2.BFMatcher(cv2.NORM_L2)           # L2 for SIFT
# bf   = cv2.BFMatcher(cv2.NORM_HAMMING)        # Hamming for ORB/AKAZE
matches = bf.knnMatch(des1, des2, k=2)
good    = [m for m,n in matches if m.distance < 0.75*n.distance]

if len(good) > 10:
    src_pts = np.float32([kp1[m.queryIdx].pt for m in good]).reshape(-1,1,2)
    dst_pts = np.float32([kp2[m.trainIdx].pt for m in good]).reshape(-1,1,2)
    H, mask = cv2.findHomography(src_pts, dst_pts, cv2.RANSAC, 5.0)
DetectorSpeedScale invNotes
SIFTSlowYesMost accurate
ORBFastNoFree, real-time
AKAZEMediumYesBalanced
FASTVery fastNoCorners only

objdetect: Face & QR

face_cascade = cv2.CascadeClassifier(
    cv2.data.haarcascades + "haarcascade_frontalface_alt.xml")

faces = face_cascade.detectMultiScale(gray, 1.1, 5, minSize=(30,30))
for (x,y,w,h) in faces:
    cv2.rectangle(img, (x,y), (x+w,y+h), (255,0,0), 2)

qr = cv2.QRCodeDetector()
data, pts, _ = qr.detectAndDecode(img)

dnn: YOLO / ONNX Inference

net = cv2.dnn.readNetFromONNX("yolov8n.onnx")
# Optional GPU: net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)

blob = cv2.dnn.blobFromImage(img, 1/255, (640,640), swapRB=True)
net.setInput(blob)
outputs = net.forward(net.getUnconnectedOutLayersNames())

for det in outputs[0]:
    scores     = det[5:]
    class_id   = np.argmax(scores)
    confidence = scores[class_id]
    if confidence > 0.5:
        cx,cy,bw,bh = (det[:4] * np.array([W,H,W,H])).astype(int)
        cv2.rectangle(img, (cx-bw//2, cy-bh//2), (cx+bw//2, cy+bh//2), (0,255,0), 2)

Supported: ONNX | TensorFlow .pb | Caffe | Darknet YOLO | OpenVINO IR


tracking: Object Trackers

tracker = cv2.TrackerCSRT_create()    # best accuracy
# tracker = cv2.TrackerKCF_create()   # balanced
# tracker = cv2.TrackerMOSSE_create() # fastest

ok = tracker.init(frame, (x, y, w, h))
while cap.isOpened():
    ok, frame = cap.read()
    ok, bbox  = tracker.update(frame)
    if ok:
        x,y,w,h = [int(v) for v in bbox]
        cv2.rectangle(frame, (x,y), (x+w,y+h), (0,255,0), 2)

calib3d: Camera Calibration

objp = np.zeros((6*9,3), np.float32)
objp[:,:2] = np.mgrid[0:9,0:6].T.reshape(-1,2)

objpts, imgpts = [], []
for img in calib_images:
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    ret, corners = cv2.findChessboardCorners(gray, (9,6))
    if ret:
        objpts.append(objp)
        imgpts.append(cv2.cornerSubPix(gray, corners, (11,11), (-1,-1),
            (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)))

ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpts, imgpts, gray.shape[::-1], None, None)
undist = cv2.undistort(frame, mtx, dist)

video: Background Subtraction & Optical Flow

# Background subtraction
fgbg  = cv2.createBackgroundSubtractorMOG2(history=500, detectShadows=True)
fgmask = fgbg.apply(frame)

# Sparse optical flow (Lucas-Kanade)
p0     = cv2.goodFeaturesToTrack(prev_gray, 100, 0.3, 7)
p1, st, _ = cv2.calcOpticalFlowPyrLK(prev_gray, gray, p0, None)
good_new = p1[st==1]

# Dense optical flow
flow   = cv2.calcOpticalFlowFarneback(prev_gray, gray, None, 0.5, 3, 15, 3, 5, 1.2, 0)
mag, ang = cv2.cartToPolar(flow[...,0], flow[...,1])

Drawing Functions

cv2.line(img, (x1,y1), (x2,y2), (B,G,R), thickness)
cv2.rectangle(img, (x1,y1), (x2,y2), color, thickness)   # -1 = filled
cv2.circle(img, (cx,cy), radius, color, thickness)
cv2.putText(img, "text", (x,y), cv2.FONT_HERSHEY_SIMPLEX, scale, color, thickness)
cv2.polylines(img, [pts], isClosed=True, color, thickness)
cv2.arrowedLine(img, pt1, pt2, color, thickness)

Chess Board Pipeline (project context)

# Used in chess/ desktop app (board_detector.py)
gray    = cv2.cvtColor(screen, cv2.COLOR_BGR2GRAY)
blur    = cv2.GaussianBlur(gray, (5,5), 0)
edges   = cv2.Canny(blur, 50, 150)
cnts, _ = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
board   = max(cnts, key=cv2.contourArea)   # largest contour = board
approx  = cv2.approxPolyDP(board, 0.02*cv2.arcLength(board,True), True)
# approx should have 4 points for the board corners
warped  = cv2.warpPerspective(screen, M, (512, 512))
# Then split warped into 8x8 grid -> classify each square

KNOWLEDGE INJECTION: Orange3

Source: https://github.com/biolab/orange3

Routed to: development.md

Date: 2026-03-18

SKILL: orange3-data-mining

name: orange3-data-mining description: > Orange3 - open-source visual data mining and ML platform by Univ. of Ljubljana. No-code canvas-based workflow: connect widgets for data loading, preprocessing, visualization, classification, clustering, regression. Add-ons: text, time series, bioinformatics, image analytics, geo. pip/conda/winget install. USE FOR:

  • visual ML workflow no-code
  • data mining and visualization
  • interactive scatter plot histogram heatmap
  • decision tree random forest clustering
  • exploratory data analysis tags: [Orange3, visual-ML, data-mining, no-code, clustering, classification, regression] kind: tool category: pro-code-architecture

What Is Orange3?

Visual data mining and ML toolbox — no programming required.

Installation

winget install --id UniversityofLjubljana.Orange
conda install orange3
pip install orange3   # requires PyQt6 first

Widget Categories

  • Data: File, SQL, URL, Data Table, Select Rows, Feature Constructor
  • Visualize: Scatter Plot, Box Plot, Distributions, Heatmap, Mosaic
  • Model: Decision Tree, Random Forest, SVM, Naive Bayes, Neural Network, Logistic Regression
  • Evaluate: Test & Score, Confusion Matrix, ROC, Calibration Plot
  • Unsupervised: K-Means, Hierarchical Clustering, PCA, t-SNE, DBSCAN
  • Text: Corpus, Preprocess Text, Bag of Words, Topic Modelling
  • Time Series: As Timeseries, Moving Transform, Seasonal Adjustment

Workflow Pattern

File → Preprocess → Select Features
                         → Train/Test Split → Random Forest → Evaluate
                         → PCA → Scatter Plot (colored by class)

KNOWLEDGE INJECTION: xonsh

Source: https://github.com/xonsh/xonsh

Routed to: development.md

Date: 2026-03-18

SKILL: xonsh-python-shell

name: xonsh-python-shell description: > xonsh - Python-powered cross-platform shell. Superset of Python 3: mix shell commands and Python code in the same session. Direct manipulation of command outputs as Python objects. Extension system (xontribs/plugins). AI-friendly. Used by conda, mamba, Snakemake, Jupyter. pip install xonsh. USE FOR:

  • Python + shell hybrid scripting
  • manipulate command output as Python objects
  • automate shell tasks with Python logic
  • cross-platform shell scripting
  • conda mamba workflow automation tags: [xonsh, Python-shell, hybrid, cross-platform, scripting, automation, xontribs] kind: tool category: pro-code-architecture

What Is xonsh?

Python-powered shell — superset of Python 3, cross-platform, AI-friendly.

Install

pip install xonsh
# or via conda:
conda install -c conda-forge xonsh

Syntax Examples

# Standard shell commands
cd $HOME
cat /etc/passwd | grep root

# Python variables in commands
name = "snail"
echo @(name) > /tmp/@(name)

# Python expressions
var = "hello".upper()
echo @(var)

# Command output as Python object
result = $(ls -la).split("\n")
print(len(result))

# Mixed pipeline
len($(curl -L https://xon.sh))

# Subprocess mode with Python control flow
for f in $(find . -name "*.py").split():
    print(f)

xontribs (Extensions)

xpip install xontrib-vox          # virtual environment manager
xpip install xontrib-prompt-ret   # return code in prompt
xpip install xontrib-autojump     # autojump integration

Use Cases

  • conda/mamba package management scripts
  • Snakemake bioinformatics workflows
  • Jupyter-based interactive computing
  • DevOps automation with Python logic
  • Data pipeline scripting

KNOWLEDGE INJECTION: Orange3

Source: https://github.com/biolab/orange3

Routed to: development.md

Date: 2026-03-18

SKILL: orange3-data-mining

name: orange3-data-mining description: > Orange3 - open-source visual data mining and ML platform by Univ. of Ljubljana. No-code canvas-based workflow: connect widgets for data loading, preprocessing, visualization, classification, clustering, regression. Add-ons: text, time series, bioinformatics, image analytics, geo. pip/conda/winget install. USE FOR:

  • visual ML workflow no-code
  • data mining and visualization
  • interactive scatter plot histogram heatmap
  • decision tree random forest clustering
  • exploratory data analysis tags: [Orange3, visual-ML, data-mining, no-code, clustering, classification, regression] kind: tool category: pro-code-architecture

What Is Orange3?

Visual data mining and ML toolbox — no programming required.

Installation

winget install --id UniversityofLjubljana.Orange
conda install orange3
pip install orange3   # requires PyQt6 first

Widget Categories

  • Data: File, SQL, URL, Data Table, Select Rows, Feature Constructor
  • Visualize: Scatter Plot, Box Plot, Distributions, Heatmap, Mosaic
  • Model: Decision Tree, Random Forest, SVM, Naive Bayes, Neural Network, Logistic Regression
  • Evaluate: Test & Score, Confusion Matrix, ROC, Calibration Plot
  • Unsupervised: K-Means, Hierarchical Clustering, PCA, t-SNE, DBSCAN
  • Text: Corpus, Preprocess Text, Bag of Words, Topic Modelling
  • Time Series: As Timeseries, Moving Transform, Seasonal Adjustment

Workflow Pattern

File → Preprocess → Select Features
                         → Train/Test Split → Random Forest → Evaluate
                         → PCA → Scatter Plot (colored by class)

KNOWLEDGE INJECTION: OpenCV

Source: https://github.com/opencv/opencv

Routed to: development.md

Date: 2026-03-18

SKILL: opencv

name: opencv description: > OpenCV - Open Source Computer Vision Library. 86k stars, 14 modules. imgproc (filtering/contours/warp), dnn (YOLO/ONNX inference), features2d (SIFT/ORB/AKAZE matching), objdetect (Haar/HOG/QR), calib3d, tracking (KCF/CSRT). pip install opencv-contrib-python. C++ and Python. USE FOR:

  • image processing pipeline
  • contour detection and perspective warp
  • YOLO object detection with OpenCV dnn
  • feature matching SIFT ORB AKAZE
  • face detection Haar cascade
  • camera calibration undistort
  • object tracking KCF CSRT
  • chess board detection
  • color segmentation HSV mask
  • background subtraction optical flow tags: [OpenCV, computer-vision, image-processing, DNN, YOLO, SIFT, ORB, contours, tracking, Python, C++] kind: library category: programmatic-drawing

What Is OpenCV?

Open Source Computer Vision Library.


Installation

pip install opencv-contrib-python        # recommended (includes SIFT, tracking)
pip install opencv-contrib-python-headless  # no GUI (servers)
import cv2
print(cv2.__version__)   # e.g. 4.9.0

Module Map

ModuleKey Functions
coreMat, imread, imwrite, cvtColor
imgprocGaussianBlur, Canny, threshold, findContours, warpPerspective
features2dSIFT, ORB, AKAZE, BFMatcher, FLANN
objdetectCascadeClassifier, QRCodeDetector
dnnreadNetFromONNX, blobFromImage, forward
videoBackgroundSubtractor, calcOpticalFlow
calib3dcalibrateCamera, undistort, findHomography
trackingTrackerKCF, TrackerCSRT, TrackerMOSSE
mlSVM, KMeans
photoinpaint, fastNlMeansDenoising

Core: Load, Convert, Save

import cv2, numpy as np

img  = cv2.imread("image.jpg")               # BGR uint8
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
hsv  = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
rgb  = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)  # for matplotlib
h, w, c = img.shape
roi  = img[y1:y2, x1:x2]                     # crop
cv2.imwrite("out.jpg", img)
cv2.imshow("win", img); cv2.waitKey(0)

imgproc: Filters & Edges

blur   = cv2.GaussianBlur(gray, (5,5), 0)
median = cv2.medianBlur(gray, 5)               # salt-and-pepper
bilat  = cv2.bilateralFilter(img, 9, 75, 75)   # edge-preserving

edges  = cv2.Canny(blur, 50, 150)

kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5,5))
opened = cv2.morphologyEx(binary, cv2.MORPH_OPEN,  kernel)  # remove noise
closed = cv2.morphologyEx(binary, cv2.MORPH_CLOSE, kernel)  # fill holes

imgproc: Thresholding

_, binary  = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY)
_, otsu    = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
adaptive   = cv2.adaptiveThreshold(gray, 255,
               cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 2)

# Color range mask
lower = np.array([100, 50, 50])
upper = np.array([130, 255, 255])
mask  = cv2.inRange(hsv, lower, upper)

imgproc: Contours

cnts, hier = cv2.findContours(binary, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

for cnt in cnts:
    area = cv2.contourArea(cnt)
    if area < 500: continue

    peri   = cv2.arcLength(cnt, True)
    approx = cv2.approxPolyDP(cnt, 0.02*peri, True)
    x,y,w,h = cv2.boundingRect(cnt)

    M  = cv2.moments(cnt)
    cx = int(M["m10"] / M["m00"])   # centroid
    cy = int(M["m01"] / M["m00"])

    cv2.drawContours(img, [cnt], 0, (0,255,0), 2)

# Shape by vertex count
n = len(approx)
if   n == 3: shape = "triangle"
elif n == 4: shape = "quad/rect"
elif n == 5: shape = "pentagon"
else:        shape = "circle"

imgproc: Perspective Warp

src = np.float32([[tl_x,tl_y],[tr_x,tr_y],[bl_x,bl_y],[br_x,br_y]])
dst = np.float32([[0,0],[W,0],[0,H],[W,H]])
M      = cv2.getPerspectiveTransform(src, dst)
warped = cv2.warpPerspective(img, M, (W, H))

features2d: SIFT / ORB Matching

sift  = cv2.SIFT_create()
orb   = cv2.ORB_create(nfeatures=1500)

kp1, des1 = sift.detectAndCompute(img1, None)
kp2, des2 = sift.detectAndCompute(img2, None)

bf      = cv2.BFMatcher(cv2.NORM_L2)           # L2 for SIFT
# bf   = cv2.BFMatcher(cv2.NORM_HAMMING)        # Hamming for ORB/AKAZE
matches = bf.knnMatch(des1, des2, k=2)
good    = [m for m,n in matches if m.distance < 0.75*n.distance]

if len(good) > 10:
    src_pts = np.float32([kp1[m.queryIdx].pt for m in good]).reshape(-1,1,2)
    dst_pts = np.float32([kp2[m.trainIdx].pt for m in good]).reshape(-1,1,2)
    H, mask = cv2.findHomography(src_pts, dst_pts, cv2.RANSAC, 5.0)
DetectorSpeedScale invNotes
SIFTSlowYesMost accurate
ORBFastNoFree, real-time
AKAZEMediumYesBalanced
FASTVery fastNoCorners only

objdetect: Face & QR

face_cascade = cv2.CascadeClassifier(
    cv2.data.haarcascades + "haarcascade_frontalface_alt.xml")

faces = face_cascade.detectMultiScale(gray, 1.1, 5, minSize=(30,30))
for (x,y,w,h) in faces:
    cv2.rectangle(img, (x,y), (x+w,y+h), (255,0,0), 2)

qr = cv2.QRCodeDetector()
data, pts, _ = qr.detectAndDecode(img)

dnn: YOLO / ONNX Inference

net = cv2.dnn.readNetFromONNX("yolov8n.onnx")
# Optional GPU: net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)

blob = cv2.dnn.blobFromImage(img, 1/255, (640,640), swapRB=True)
net.setInput(blob)
outputs = net.forward(net.getUnconnectedOutLayersNames())

for det in outputs[0]:
    scores     = det[5:]
    class_id   = np.argmax(scores)
    confidence = scores[class_id]
    if confidence > 0.5:
        cx,cy,bw,bh = (det[:4] * np.array([W,H,W,H])).astype(int)
        cv2.rectangle(img, (cx-bw//2, cy-bh//2), (cx+bw//2, cy+bh//2), (0,255,0), 2)

Supported: ONNX | TensorFlow .pb | Caffe | Darknet YOLO | OpenVINO IR


tracking: Object Trackers

tracker = cv2.TrackerCSRT_create()    # best accuracy
# tracker = cv2.TrackerKCF_create()   # balanced
# tracker = cv2.TrackerMOSSE_create() # fastest

ok = tracker.init(frame, (x, y, w, h))
while cap.isOpened():
    ok, frame = cap.read()
    ok, bbox  = tracker.update(frame)
    if ok:
        x,y,w,h = [int(v) for v in bbox]
        cv2.rectangle(frame, (x,y), (x+w,y+h), (0,255,0), 2)

calib3d: Camera Calibration

objp = np.zeros((6*9,3), np.float32)
objp[:,:2] = np.mgrid[0:9,0:6].T.reshape(-1,2)

objpts, imgpts = [], []
for img in calib_images:
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    ret, corners = cv2.findChessboardCorners(gray, (9,6))
    if ret:
        objpts.append(objp)
        imgpts.append(cv2.cornerSubPix(gray, corners, (11,11), (-1,-1),
            (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)))

ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpts, imgpts, gray.shape[::-1], None, None)
undist = cv2.undistort(frame, mtx, dist)

video: Background Subtraction & Optical Flow

# Background subtraction
fgbg  = cv2.createBackgroundSubtractorMOG2(history=500, detectShadows=True)
fgmask = fgbg.apply(frame)

# Sparse optical flow (Lucas-Kanade)
p0     = cv2.goodFeaturesToTrack(prev_gray, 100, 0.3, 7)
p1, st, _ = cv2.calcOpticalFlowPyrLK(prev_gray, gray, p0, None)
good_new = p1[st==1]

# Dense optical flow
flow   = cv2.calcOpticalFlowFarneback(prev_gray, gray, None, 0.5, 3, 15, 3, 5, 1.2, 0)
mag, ang = cv2.cartToPolar(flow[...,0], flow[...,1])

Drawing Functions

cv2.line(img, (x1,y1), (x2,y2), (B,G,R), thickness)
cv2.rectangle(img, (x1,y1), (x2,y2), color, thickness)   # -1 = filled
cv2.circle(img, (cx,cy), radius, color, thickness)
cv2.putText(img, "text", (x,y), cv2.FONT_HERSHEY_SIMPLEX, scale, color, thickness)
cv2.polylines(img, [pts], isClosed=True, color, thickness)
cv2.arrowedLine(img, pt1, pt2, color, thickness)

Chess Board Pipeline (project context)

# Used in chess/ desktop app (board_detector.py)
gray    = cv2.cvtColor(screen, cv2.COLOR_BGR2GRAY)
blur    = cv2.GaussianBlur(gray, (5,5), 0)
edges   = cv2.Canny(blur, 50, 150)
cnts, _ = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
board   = max(cnts, key=cv2.contourArea)   # largest contour = board
approx  = cv2.approxPolyDP(board, 0.02*cv2.arcLength(board,True), True)
# approx should have 4 points for the board corners
warped  = cv2.warpPerspective(screen, M, (512, 512))
# Then split warped into 8x8 grid -> classify each square

KNOWLEDGE INJECTION: xonsh

Source: https://github.com/xonsh/xonsh

Routed to: development.md

Date: 2026-03-18

SKILL: xonsh-python-shell

name: xonsh-python-shell description: > xonsh - Python-powered cross-platform shell. Superset of Python 3: mix shell commands and Python code in the same session. Direct manipulation of command outputs as Python objects. Extension system (xontribs/plugins). AI-friendly. Used by conda, mamba, Snakemake, Jupyter. pip install xonsh. USE FOR:

  • Python + shell hybrid scripting
  • manipulate command output as Python objects
  • automate shell tasks with Python logic
  • cross-platform shell scripting
  • conda mamba workflow automation tags: [xonsh, Python-shell, hybrid, cross-platform, scripting, automation, xontribs] kind: tool category: pro-code-architecture

What Is xonsh?

Python-powered shell — superset of Python 3, cross-platform, AI-friendly.

Install

pip install xonsh
# or via conda:
conda install -c conda-forge xonsh

Syntax Examples

# Standard shell commands
cd $HOME
cat /etc/passwd | grep root

# Python variables in commands
name = "snail"
echo @(name) > /tmp/@(name)

# Python expressions
var = "hello".upper()
echo @(var)

# Command output as Python object
result = $(ls -la).split("\n")
print(len(result))

# Mixed pipeline
len($(curl -L https://xon.sh))

# Subprocess mode with Python control flow
for f in $(find . -name "*.py").split():
    print(f)

xontribs (Extensions)

xpip install xontrib-vox          # virtual environment manager
xpip install xontrib-prompt-ret   # return code in prompt
xpip install xontrib-autojump     # autojump integration

Use Cases

  • conda/mamba package management scripts
  • Snakemake bioinformatics workflows
  • Jupyter-based interactive computing
  • DevOps automation with Python logic
  • Data pipeline scripting

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,851. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.