domain-modeling
Write a glossary, record ADRs, and clarify vague terms.
MAmattpocock/skills336k4,217 new stars in the last 7 days
Prevent garbled text (乱码) when editing code and comments. Use this skill whenever reading, writing, or modifying files to ensure proper UTF-8 encoding handling. Activates on any file edit operation, especially when working with Chinese characters, emoji, or non-ASCII content.
Ensures all file operations use proper UTF-8 encoding to prevent garbled text (乱码).
# Always specify encoding when reading
cat -n file.tsx # Use Read tool which handles encoding
# If you suspect encoding issues, check with:
file -I file.tsx # Shows charset
hexdump -C file.tsx | head -5 # Inspect raw bytes
# Ensure locale supports UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# When using Edit tool, the content is already validated
# When using Write tool, ensure content is proper UTF-8
Watch for these signs of encoding problems:
é, è, ü (UTF-8 read as Latin-1)锟斤拷, 烫烫烫, 屯屯屯 (GBK/UTF-8 mismatch)� (U+FFFD) — missing or invalid bytes??? where Chinese should beIf a file shows garbled text:
# Check current encoding
file -I problematic.tsx
# If it's GBK, convert to UTF-8
iconv -f GBK -t UTF-8 problematic.tsx > fixed.tsx
mv fixed.tsx problematic.tsx
The Read tool automatically handles encoding. If you see garbled output:
After any Edit or Write operation:
# Quick validation
python3 -c "
with open('file.tsx', 'r', encoding='utf-8') as f:
content = f.read()
print(f'Valid UTF-8: {len(content)} chars')
"
// ✅ Correct: UTF-8 encoded comment
// 这是一个中文注释
// ❌ Wrong: Encoding mismatch causes garbled
// 杩欐槸涓€涓�腑鏂囨敞閲�
Action: Always use UTF-8 locale. Set in shell:
export LANG=en_US.UTF-8
If some files are GBK and others UTF-8:
# Find all non-UTF-8 files
find . -name "*.tsx" -exec file -I {} \; | grep -v utf-8
# Batch convert
for f in $(find . -name "*.tsx" -exec file -I {} \; | grep gb2312 | cut -d: -f1); do
iconv -f GBK -t UTF-8 "$f" > "$f.utf8"
mv "$f.utf8" "$f"
done
# Configure git to handle encoding
git config core.quotepath false # Show Chinese filenames correctly
git config i18n.commitencoding utf-8
git config i18n.logoutputencoding utf-8
Before any file operation:
echo $LANG should show *.UTF-8)file -I filename)Run this to check your environment:
echo "Locale: $LANG"
echo "LC_ALL: $LC_ALL"
python3 -c "import sys; print(f'Default encoding: {sys.getdefaultencoding()}')"
python3 -c "import locale; print(f'Preferred encoding: {locale.getpreferredencoding()}')"
Expected output:
Locale: en_US.UTF-8
LC_ALL: en_US.UTF-8
Default encoding: utf-8
Preferred encoding: UTF-8
LANG=en_US.UTF-8 commandiconv if needed: command | iconv -f GBK -t UTF-8Write a glossary, record ADRs, and clarify vague terms.
MAmattpocock/skills336k4,217 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days
MAmattpocock/skills336k4,217 new stars in the last 7 days
OBobra/superpowers331k5,030 new stars in the last 7 days