This skill provides guidance for building scalable and maintainable internationalization systems using Better i18n. It is useful for developers looking to manage localization workflows and translation keys effectively.
$ npx skills add https://github.com/better-i18n/skills --skill i18n-best-practicesThe i18n Best Practices skill equips AI agents like Claude, Cursor, and Windsurf with deep expertise in Better i18n's localization framework. It routes questions about Next.js App Router setup, React SDK integration, mobile (Expo/Swift/Flutter) deployment, CLI commands, MCP tools, GitHub sync pipelines, translation file formats, key naming conventions, and CDN caching to authoritative references. When you ask your AI assistant how to set up ISR revalidation in Next.js, check translation coverage in CI, diagnose GitHub sync failures, or debug empty translations in production, the skill provides exact implementation steps and troubleshooting guidance. This eliminates guesswork and reduces time spent copying documentation by giving AI agents structured, domain-specific knowledge.
Install via the command line with the given npx command.
Building internationalization features
Managing translation keys
Integrating AI translation
Setting up localization workflows
$ npx skills add https://github.com/better-i18n/skills --skill i18n-best-practicesgit clone https://github.com/better-i18n/skillsCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Act as an i18n expert using Better i18n. Review the [LANGUAGE], [TRANSLATION_KEYS], and [CONTEXT] for [COMPANY]'s [PRODUCT_OR_SERVICE] in the [INDUSTRY] sector. Suggest improvements for scalability, maintainability, and translation quality. Identify potential issues like hardcoded strings, missing context, or inconsistent key naming. Provide actionable recommendations for Better i18n integration.
# i18n Best Practices Review for GreenEarth
## Current State Analysis
**Language:** English (Primary), Spanish (Secondary)
**Translation Keys:** 120+ keys, mostly UI labels and static content
**Context Provided:** None for 40% of keys, minimal for others
## Key Issues Identified
- **Hardcoded Strings:** 15 instances found in JavaScript files (e.g., `"Save"` in 3 different files)
- **Inconsistent Key Naming:** Mixed snake_case (`user_profile_title`) and camelCase (`userProfileTitle`)
- **Missing Context:** 8 keys lack context, leading to ambiguous translations (e.g., `cancel_button` could mean "Cancel Order" or "Cancel Action")
- **Unused Keys:** 12 keys marked as `unused` in the system but still present in translation files
## Recommendations for Better i18n
### 1. Standardize Key Naming
Adopt a consistent `kebab-case` convention (e.g., `user-profile-title`) across all files. Use a script to automatically refactor existing keys:
```bash
grep -r "[A-Za-z0-9]" src/ | sed 's/kebab-case/camelCase/g'
```
### 2. Add Context for Ambiguous Keys
For `cancel_button`, add context like:
```json
{
"cancel_button": {
"context": "Order cancellation flow",
"default": "Cancel"
}
}
```
### 3. Remove Unused Keys
Run a cleanup script to identify and purge unused keys:
```bash
better-i18n clean --unused-keys --dry-run
```
### 4. Implement Dynamic Key Generation
Use Better i18n's `generate-keys` feature to auto-create keys for new strings:
```bash
generate-keys --source src/components --language en
```
### 5. Add Translation Memory
Enable Better i18n's translation memory to reuse existing translations and reduce costs:
```yaml
translation_memory:
enabled: true
threshold: 0.8
```
## Next Steps
1. **Refactor Naming:** Standardize all keys to `kebab-case` (2-hour task)
2. **Add Context:** Review ambiguous keys with the team (3-hour task)
3. **Clean Up:** Remove unused keys and update translation files (1-hour task)
4. **Automate:** Set up CI/CD pipeline to run `better-i18n lint` on every PR
Would you like me to provide a sample refactored translation file or a script to automate any of these steps?Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan