AgentSkillsCN

localize-rules

根据项目需求优化规则,秉持“入乡随俗”的原则。当用户提到本地化规则、将规则适配至项目,或对模板进行自定义时使用。切勿用于:应用国际化/本地化功能的实现,或业务规则的落地实施。

SKILL.md
--- frontmatter
name: localize-rules
description: "ルールをプロジェクトに最適化。郷に入っては郷に従え精神。Use when user mentions localizing rules, adapting rules to project, or customizing templates. Do NOT load for: app i18n/localization features, business rule implementation."
allowed-tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep"]
disable-model-invocation: true
argument-hint: "[template-name]"

Localize Rules Skill

Analyzes project structure and optimizes .claude/rules/ rule files for the project.

Quick Reference

  • "Adapt rules to this project" → this skill
  • "Match rules to repo structure" → auto-detects directories/language/test config
  • "I don't know what to decide" → "detect→propose" first, confirm only needed items

Deliverables

  • Updates .claude/rules/ to match actual project structure
  • Prevents drift in "allowed locations/tests/conventions" for future work

Purpose

Customize generic rule templates to match actual project structure:

  • paths: adapted to actual source directories (src/, app/, lib/, etc.)
  • Add language-specific rules (TypeScript, Python, React, etc.)
  • Auto-detect test directories

Execution

Run the localization script:

bash
bash "${CLAUDE_PLUGIN_ROOT}/scripts/localize-rules.sh"

Or dry-run to preview:

bash
bash "${CLAUDE_PLUGIN_ROOT}/scripts/localize-rules.sh" --dry-run

Note: If CLAUDE_PLUGIN_ROOT is unavailable, run from plugin repo root: bash ./scripts/localize-rules.sh


Detection Targets

ItemDetection MethodExample
Source directoriessrc/, app/, lib/ existencepaths: ["src/**/*"]
Languagepackage.json, requirements.txt, Cargo.tomlTypeScript, Python, Rust
Test frameworkjest.config, vitest.config, pytest.iniJest, Vitest, pytest
Component librarypackage.json dependenciesReact, Vue, Svelte

Updated Rules

Rule FileUpdates
workflow.mdSource paths, test commands
testing.mdTest framework config
code-style.mdLanguage conventions

Related Skills

  • setup - Initial project setup
  • harness-init - Harness initialization