Skip to content

Commit b9150f6

Browse files
dani-polaniclaude
andcommitted
refactor: move AI agent skill to proper word-aligner-skill/ package
Replaces the flat .agents/tools/word-aligner-api.md with a properly structured skill package following ChatGPT/Claude skill conventions: word-aligner-skill/ SKILL.md ← concise entrypoint with YAML frontmatter agents/openai.yaml ← ChatGPT UI metadata references/api.md ← full parameter tables loaded on demand SKILL.md has the triggering description and common patterns; detailed API reference stays in references/ to keep the main file compact. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c2b7648 commit b9150f6

5 files changed

Lines changed: 248 additions & 190 deletions

File tree

.agents/tools/word-aligner-api.md

Lines changed: 0 additions & 189 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ Supports per-line options (font, size, RTL), global visual settings (palette, li
7272

7373
### Using Word Aligner as an AI agent tool
7474

75-
The file [`.agents/tools/word-aligner-api.md`](.agents/tools/word-aligner-api.md) is a skill prompt that teaches AI assistants (Claude, ChatGPT, etc.) how to use the API. Add it as a custom instruction or system prompt to enable a flow like:
75+
The [`word-aligner-skill/`](word-aligner-skill/) directory is a ready-to-install skill that teaches AI assistants (Claude, ChatGPT, etc.) how to use the API. Once installed, it enables flows like:
7676

7777
> "Translate 'я хочу спать' into English and show me the word alignment."
7878
7979
The agent translates, calls the API, and returns a shareable link.
8080

81+
- **For Claude:** point your Claude project at this repository or add the contents of `word-aligner-skill/SKILL.md` as a custom instruction.
82+
- **For ChatGPT:** zip `word-aligner-skill/` and upload it as a custom Skill.
83+
8184
## Learn more
8285

8386
- **App:** [aligner.tinygods.dev](https://aligner.tinygods.dev)

word-aligner-skill/SKILL.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
name: word-aligner
3+
description: Use Word Aligner to create shareable visual diagrams showing word-by-word alignment between two or more texts. Invoke this skill when the user wants to translate a phrase and show which words correspond to which, align a translation with its source in any language (including RTL scripts like Hebrew or Arabic), create an interlinear gloss or morpheme breakdown, or generate a shareable alignment diagram. The skill calls POST https://aligner.tinygods.dev/api/align and returns a URL.
4+
---
5+
6+
# Word Aligner
7+
8+
Word Aligner generates shareable interactive diagrams showing which words in one text correspond to which words in another. Words are connected by colored arcs; tokens sharing a connection group (many-to-one or one-to-many) get the same color automatically.
9+
10+
**API endpoint:** `POST https://aligner.tinygods.dev/api/align`
11+
**Returns:** `{ "url": "https://aligner.tinygods.dev/?data=..." }` — give this URL to the user.
12+
13+
## Minimal request
14+
15+
```json
16+
{
17+
"lines": ["Hello world", "Bonjour le monde"],
18+
"alignments": [[0, 0, 1, 0], [0, 1, 1, 2]]
19+
}
20+
```
21+
22+
`alignments` entries are `[lineA, wordA, lineB, wordB]` — 0-based indices, lines must be adjacent.
23+
24+
## Workflow
25+
26+
1. Translate the phrase yourself (or use the user's existing translation).
27+
2. Identify which source words correspond to which target words.
28+
3. Call the API.
29+
4. Return the `url` to the user with a brief explanation.
30+
31+
## Word index counting
32+
33+
Count left to right from 0, splitting on whitespace. Characters `.` `-` `|` also split. For RTL lines, word 0 is the logically first word (rightmost on screen).
34+
35+
If uncertain about tokenization, call `GET https://aligner.tinygods.dev/api/align?lines=your+text` first and open the URL to count word boxes in the editor.
36+
37+
## Common patterns
38+
39+
**Many-to-one** (one source word → several target words): list all target words as separate alignment tuples. They share a color automatically.
40+
41+
```json
42+
{
43+
"lines": ["Я ходил", "I have been going"],
44+
"alignments": [[0,0,1,0], [0,1,1,1], [0,1,1,2], [0,1,1,3]]
45+
}
46+
```
47+
48+
**RTL language** (Hebrew, Arabic, etc.): use a `LineInput` object with `"rtl": true` and a matching font.
49+
50+
```json
51+
{
52+
"lines": [
53+
{"text": "שלום עולם", "rtl": true, "font": "Noto Sans Hebrew", "sizePx": 48},
54+
{"text": "Hello world", "sizePx": 40}
55+
],
56+
"alignments": [[0,0,1,0], [0,1,1,1]]
57+
}
58+
```
59+
60+
**3 lines with a gloss row**: add `pairs` to hide connectors on the gloss pair.
61+
62+
```json
63+
{
64+
"lines": ["Я ходил", "I have been going", "1SG.NOM PST.IPFV"],
65+
"alignments": [[0,0,1,0], [0,1,1,1], [0,1,1,2], [0,1,1,3]],
66+
"pairs": [{"upper": 1, "lower": 2, "gapPx": 60, "showConnectors": false}]
67+
}
68+
```
69+
70+
## Full parameter reference
71+
72+
See [references/api.md](references/api.md) for the complete parameter tables: `LineInput`, `SettingsInput` (palette, lineStyle, lineThickness, lineOpacity, background, theme, showNumbers, colorTokensByLink), and `PairInput` (gapPx, showConnectors).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "Word Aligner"
3+
short_description: "Visualize word-by-word alignment between texts in any language"
4+
icon_url: "https://aligner.tinygods.dev/favicon.png"

0 commit comments

Comments
 (0)