agentsclimarketplace

Add language hook

Skill artk0de/TeaRAGs-MCP/.claude/skills/add-language-hook

The code intelligence layer for AI coding agents. Semantic indexing, graph navigation, and repository intelligenceFrom the repository description

Install
npx -y skills add artk0de/TeaRAGs-MCP --skill add-language-hook

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

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

3.0 KB, as published. Nobody here has run it

Add Language Hook

Add chunking hook for new/existing language in ingest pipeline.

Hooks live in src/core/domains/ingest/pipeline/chunker/hooks/<language>/.

Step 1: Check if the language directory exists

Look in chunker/hooks/ for existing <language>/ directory.

  • Exists — adding new hook to existing language. Read <language>/index.ts for current hook chain.
  • Doesn't exist — adding hooks for new language. Create <language>/ directory.

Step 2: Understand the hook interface

Read chunker/hooks/types.ts. Every hook implements:

interface ChunkingHook {
  name: string;
  process: (ctx: HookContext) => void;
}

HookContext provides:

  • Read-only: containerNode, validChildren, code, codeLines, config
  • Mutable: excludedRows, methodPrefixes, methodStartLines, bodyChunks

Hooks mutate context in order. Earlier hooks populate state later hooks read (e.g. comment-capture populates excludedRows, body-chunker reads it).

Step 3: Create the hook file

Create hooks/<language>/<hook-name>.ts. Follow existing patterns:

  • comment-capture.ts — extracts doc comments, marks rows excluded
  • class-body-chunker.ts — splits large class bodies into method-level chunks

Name exported hook: <language><Purpose>Hook (e.g. rubyCommentCaptureHook, typescriptBodyChunkingHook).

Step 4: Create or update the barrel

hooks/<language>/index.ts exports ordered hook array:

import type { ChunkingHook } from "../types.js";
import { myCommentCaptureHook } from "./comment-capture.js";
import { myBodyChunkingHook } from "./class-body-chunker.js";

export const <language>Hooks: ChunkingHook[] = [
  myCommentCaptureHook,   // Order matters: comment-capture first
  myBodyChunkingHook,     // Body chunker reads excludedRows
];

Step 5: Register in language config

Edit chunker/config.ts. Find language entry in LANGUAGE_DEFINITIONS, add hooks property:

import { <language>Hooks } from "./hooks/<language>/index.js";

// In LANGUAGE_DEFINITIONS:
<language>: {
  // ... existing config ...
  hooks: <language>Hooks,
},

Language absent from LANGUAGE_DEFINITIONS → add full entry with loadModule, extractLanguage, chunkableTypes, hooks.

Step 6: Write tests

Tests go in tests/core/domains/ingest/pipeline/chunker/hooks/<language>/. Follow existing test patterns in typescript/ or ruby/ directories.

Each hook gets own test file testing process() with real HookContext (use createHookContext() from types.ts).

Step 7: Verify

npx tsc --noEmit
npx vitest run tests/core/domains/ingest/pipeline/chunker/hooks/<language>/

Keep looking

Skills are one crate of 613,872. 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.