Skip to content
Skills Library
Programming · Building & coding

add-language-hook

/add-language-hook

Add chunker hook splitting a language's source files into searchable chunks (classes, functions, comments) in ingest pipeline. Triggers on "add Kotlin support", "improve TypeScript class chunking", "fix Ruby comment extraction", "add language X". NOT for tweaking generic chunker behavior — edit chunker base directly for language-agnostic changes.

Repository
tearags-mcp ↗
Licence
MIT
Last repository change
18.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 18.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Add chunker hook splitting a language's source files into searchable chunks (classes, functions, comments) in ingest pipeline. Triggers on "add Kotlin support", "improve TypeScript class chunking", "fix Ruby comment extraction", "add language X". NOT for tweaking generic chunker behavior — edit chunker base directly for language-agnostic changes.

Triggers from the description

add Kotlin supportimprove TypeScript class chunkingfix Ruby comment extractionadd language X
Original author description

Add chunker hook splitting a language's source files into searchable chunks (classes, functions, comments) in ingest pipeline. Triggers on "add Kotlin support", "improve TypeScript class chunking", "fix Ruby comment extraction", "add language X". NOT for tweaking generic chunker behavior — edit chunker base directly for language-agnostic changes.

How it works

  1. Step 1: Check if the language directory exists
  2. Step 2: Understand the hook interface
  3. Step 3: Create the hook file
  4. Step 4: Create or update the barrel
  5. Step 5: Register in language config
  6. Step 6: Write tests
  7. Step 7: Verify
Original SKILL.md headings · 94 lines, 307 words
SKILL.md preview
---
name: add-language-hook
description:
  Add chunker hook splitting a language's source files into searchable chunks
  (classes, functions, comments) in ingest pipeline. Triggers on "add Kotlin
  support", "improve TypeScript class chunking", "fix Ruby comment extraction",
  "add language X". NOT for tweaking generic chunker behavior — edit chunker
  base directly for language-agnostic changes.
---

# 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:

```typescript
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:

```typescript
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/language-config/config.ts`. Find language entry in
`LANGUAGE_DEFINITIONS`, add `hooks` property:

```typescript
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

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

Versions

The database has no other skills named add-language-hook.

Database snapshot: 13.11.2026 · package version c7aef2086648 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100generate-emitter
    Scaffold a new language emitter for oagen, implementing the Emitter interface with idiomatic target-language code generation. Use this skill whenever the user wants to add a new target language, generate SDKs for a new language, add Go/Python/Kotlin/Java/etc. support, create an…
  • 100kotlin
    Kotlin language fundamentals. Covers null safety, coroutines, flow, sealed classes, data classes, scope functions, and Kotlin 2.x features (K2 compiler, context parameters). Use for Kotlin/JVM, Kotlin/Native, Kotlin/JS work. USE WHEN: user mentions "Kotlin", "coroutines",…
  • 100kotlin-language
    Write idiomatic Kotlin 1.9+ with null safety, sealed classes, data classes, extension functions, delegates, collections, inline/reified generics, and expression syntax. Use for Kotlin language constructs, Java-to-Kotlin migration, lazy delegates, data classes, backing…
  • 100lang-ruby
    Use when writing, reviewing, testing or setting up Ruby backend code in a loops run (the ruby language pack) - toolchain, layout, race policy, coverage, idioms and footguns.
  • 96add-language
    Add a new source-language plugin to the Acai tool (new Tree-sitter dependency, plugin target + test target, a SourceLanguage constant, a CodeParser with its LanguageConfiguration and build-system detector, and registration in the AcaiLibrary composition root). Use when the user…
  • 90ruby
    This skill should be used when conducting spec interviews or implementing specs for Ruby projects, or when the spec mentions "Ruby", "RSpec", "service objects", "Struct", or Ruby class/module patterns. Provides Ruby-specific interview and implementation checklist items.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.