Skip to content

Commit e30a788

Browse files
docs: create Claude Code command for documenting buckets (#1137)
1 parent e0eee7b commit e30a788

1 file changed

Lines changed: 303 additions & 0 deletions

File tree

Lines changed: 303 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,303 @@
1+
---
2+
argument-hint: <analysis-output>
3+
description: Create documentation for a Lingo.dev bucket type using analysis output
4+
---
5+
6+
Using the bucket analysis output provided at the end of this prompt, create documentation for the specified bucket type in Lingo.dev CLI.
7+
8+
## Template Structure
9+
10+
````markdown
11+
---
12+
title: "[BUCKET_TYPE in title case]"
13+
subtitle: "Translate [BUCKET_TYPE] files with Lingo.dev CLI"
14+
---
15+
16+
## Introduction
17+
18+
[BUCKET_TYPE in title case] files are [BRIEF DESCRIPTION OF THE FILE FORMAT, ITS PURPOSE AND PRIMARY USE CASE]. [ONE SENTENCE ABOUT STRUCTURE OR KEY CHARACTERISTICS].
19+
20+
**Lingo.dev CLI** uses LLMs to translate your [BUCKET_TYPE] files across multiple locales. This guide shows you how to set up and run translations for [BUCKET_TYPE] files.
21+
22+
## Quickstart
23+
24+
### Step 1: Install Lingo.dev CLI
25+
26+
```bash
27+
# Install globally
28+
npm install -g lingo.dev@latest
29+
30+
# Or run directly with npx
31+
npx lingo.dev@latest --version
32+
```
33+
34+
### Step 2: Authenticate
35+
36+
Log in to your Lingo.dev account:
37+
38+
```bash
39+
npx lingo.dev@latest login
40+
```
41+
42+
This opens your browser for authentication. Your API key is stored locally for future use.
43+
44+
### Step 3: Initialize Project
45+
46+
Create your base configuration:
47+
48+
```bash
49+
npx lingo.dev@latest init
50+
```
51+
52+
This generates an `i18n.json` file with default settings.
53+
54+
### Step 4: Configure [BUCKET_TYPE] Bucket
55+
56+
Update your `i18n.json` to add [BUCKET_TYPE] support:
57+
58+
```json
59+
{
60+
"$schema": "https://lingo.dev/schema/i18n.json",
61+
"version": 1.8,
62+
"locale": {
63+
"source": "en",
64+
"targets": ["es"]
65+
},
66+
"buckets": {
67+
"[BUCKET_TYPE]": {
68+
"include": ["[PATH_PATTERN]"]
69+
}
70+
}
71+
}
72+
```
73+
74+
[IF separate-files: **Note**: Keep `[locale]` as-is in the config — it's replaced with actual locale codes at runtime.]
75+
[IF in-place: DO NOT include any note about [locale]]
76+
77+
### Step 5: Create File Structure
78+
79+
[FOR separate-files:]
80+
Organize your [BUCKET_TYPE] files by locale:
81+
82+
```
83+
[directory]/
84+
├── en/
85+
│ └── [filename] # Source file
86+
└── es/ # Target directory (empty initially)
87+
```
88+
89+
Place your source [BUCKET_TYPE] files in the `en/` directory. The `es/` directory can be empty — translated files will be created there automatically.
90+
91+
[FOR in-place:]
92+
Place your [BUCKET_TYPE] file in your project:
93+
94+
```
95+
[directory]/
96+
└── [filename] # Contains all locales
97+
```
98+
99+
This single file will contain translations for all configured locales.
100+
101+
### Step 6: Run Translation
102+
103+
Execute the translation command:
104+
105+
```bash
106+
npx lingo.dev@latest i18n
107+
```
108+
109+
The CLI will:
110+
111+
- Read [BUCKET_TYPE] files from your source locale
112+
- Translate content to target locales using LLMs
113+
- [FOR separate-files: Create new files in target directories (e.g., `es/[filename]`)]
114+
- [FOR in-place: Update the file with translations for all configured locales]
115+
116+
[FOR separate-files: **Note**: Unlike some bucket types that modify files in place, the [BUCKET_TYPE] bucket creates separate files for each locale. Your source files remain unchanged.]
117+
[FOR in-place: **Note**: The [BUCKET_TYPE] bucket modifies the source file directly, adding translations for all target locales to the same file.]
118+
119+
### Step 7: Verify Results
120+
121+
Check the translation status:
122+
123+
```bash
124+
npx lingo.dev@latest status
125+
```
126+
127+
[FOR separate-files: Review generated files in your target locale directory (`es/`).]
128+
[FOR in-place: Review the updated [filename] file which now contains all locales.]
129+
130+
## [Feature Sections - ONLY include supported features]
131+
132+
[IF Locked Keys = YES:]
133+
134+
## Locked Content
135+
136+
The [BUCKET_TYPE] bucket supports locking specific keys to prevent translation:
137+
138+
```json
139+
"[BUCKET_TYPE]": {
140+
"include": ["[PATH_PATTERN]"],
141+
"lockedKeys": ["key1", "key2", "nested/key3"]
142+
}
143+
```
144+
145+
This feature is available for [BUCKET_TYPE] and other structured format buckets where specific keys need to remain untranslated.
146+
147+
[IF Ignored Keys = YES:]
148+
149+
## Ignored Keys
150+
151+
The [BUCKET_TYPE] bucket supports ignoring keys entirely during processing:
152+
153+
```json
154+
"[BUCKET_TYPE]": {
155+
"include": ["[PATH_PATTERN]"],
156+
"ignoredKeys": ["debug", "internal/*"]
157+
}
158+
```
159+
160+
Unlike locked keys which preserve content, ignored keys are completely skipped during the translation process.
161+
162+
[IF Inject Locale = YES:]
163+
164+
## Inject Locale
165+
166+
The [BUCKET_TYPE] bucket supports automatically injecting locale codes into specific keys:
167+
168+
```json
169+
"[BUCKET_TYPE]": {
170+
"include": ["[PATH_PATTERN]"],
171+
"injectLocale": ["settings/language", "config/locale"]
172+
}
173+
```
174+
175+
These keys will automatically have their values replaced with the current locale code during translation.
176+
177+
[IF Translator Notes = YES:]
178+
179+
## Translator Notes
180+
181+
The [BUCKET_TYPE] bucket supports providing context hints to improve translation quality. [Describe how translator notes/hints work for this specific bucket type]
182+
183+
```[format]
184+
[Show example of how to add translator notes in this format]
185+
```
186+
187+
## Example
188+
189+
**Configuration** (`i18n.json`):
190+
191+
```json
192+
{
193+
"$schema": "https://lingo.dev/schema/i18n.json",
194+
"version": 1.8,
195+
"locale": {
196+
"source": "en",
197+
"targets": ["es"]
198+
},
199+
"buckets": {
200+
"[BUCKET_TYPE]": {
201+
"include": ["[REALISTIC_PATH]"]
202+
}
203+
}
204+
}
205+
```
206+
207+
[FOR separate-files:]
208+
**Input** (`[path]/en/[filename]`):
209+
210+
```[format]
211+
[Source content in appropriate format]
212+
```
213+
214+
**Output** (`[path]/es/[filename]`):
215+
216+
```[format]
217+
[Translated content in appropriate format]
218+
```
219+
220+
[FOR in-place:]
221+
**Before translation** (`[path]/[filename]`):
222+
223+
```[format]
224+
[Source content showing only English]
225+
```
226+
227+
**After translation** (`[path]/[filename]`):
228+
229+
```[format]
230+
[Same file now containing both English and Spanish]
231+
```
232+
````
233+
234+
## Critical Adaptation Rules
235+
236+
### For Separate-Files Buckets
237+
238+
1. **Always use `[locale]` placeholder** in paths
239+
2. Step 5: Show source (`en/`) and target (`es/`) directories
240+
3. Step 6: Explain "creates new files"
241+
4. Include the [locale] note in Step 4
242+
5. Example: Show input as `path/en/file.ext` and output as `path/es/file.ext`
243+
244+
### For In-Place Buckets
245+
246+
1. **Never use `[locale]` placeholder** anywhere in the document
247+
2. **Never include the [locale] note** in Step 4
248+
3. Step 5: Show single file path
249+
4. Step 6: Explain "modifies the file directly"
250+
5. Example: Use "Before translation" and "After translation" labels
251+
6. Example: Show the same file path for both states
252+
253+
### Feature Sections
254+
255+
- Only include sections for features marked YES
256+
- Locked Keys: Content is preserved unchanged
257+
- Ignored Keys: Keys are skipped entirely during processing
258+
- Inject Locale: Keys automatically get the locale code as their value
259+
- Translator Notes: Format varies significantly by bucket type
260+
261+
### Path Conventions
262+
263+
Choose realistic paths for the bucket type:
264+
265+
- iOS: `ios/Resources/`, `[AppName]/`
266+
- Android: `app/src/main/res/values-[locale]/`
267+
- Web: `locales/`, `i18n/`, `translations/`
268+
- Flutter: `lib/l10n/`
269+
- Java: `src/main/resources/`
270+
271+
### Writing Rules
272+
273+
- Match the concise, direct tone of the template
274+
- No marketing language or unnecessary adjectives
275+
- Don't document what specifically gets translated
276+
- Don't include generic features (exclude patterns, multiple directories)
277+
- Focus only on bucket-specific behavior
278+
- Use only `en``es` in all examples
279+
- Keep examples minimal but representative
280+
281+
## Instructions
282+
283+
1. Parse the bucket analysis output provided in the arguments to determine:
284+
285+
- Bucket type name
286+
- File organization (separate-files if uses [locale] placeholder, in-place if not)
287+
- Supported features (lockedKeys, ignoredKeys, injectLocale, hints/notes)
288+
- Typical file extension and paths
289+
290+
2. Based on the analysis, fill in the template with appropriate:
291+
292+
- Description of the file format
293+
- Realistic path patterns
294+
- Only the features that are actually supported
295+
- Appropriate examples for the format
296+
297+
3. Generate the complete Markdown documentation following the specifications exactly.
298+
299+
---
300+
301+
## Bucket Analysis Output
302+
303+
$ARGUMENTS

0 commit comments

Comments
 (0)