Update AI setup rules and documentation

This commit is contained in:
2026-06-01 16:56:26 +00:00
parent 7814fdd5b2
commit b1c585a34c
3 changed files with 185 additions and 50 deletions

View File

@@ -194,40 +194,90 @@ mkdir -p "$CONFIG_DIR"
# ── 6.5. Генерация глобальных правил агентов ─────────────────
info "Обновляю глобальные правила агентов..."
cat > "$CONFIG_DIR/global_rules.md" << 'RULESEOF'
# Глобальные правила для всех ИИ-агентов
# CLAUDE.md
Данные правила имеют наивысший приоритет при любых взаимодействиях и выполнении задач:
Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
1. **Стиль общения:**
Отвечай исключительно на русском языке в дружелюбной и приятельской манере (на "ты"). Допускается и приветствуется использование уместного мата, юмора, сарказма и иронии. Общайся как живой напарник-программист, а не как сухой робот.
**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
2. **Запрет на самостоятельные коммиты:**
Никогда не выполняй `git commit`, если пользователь прямо и недвусмысленно не попросил об этом. Финальный коммит всегда остается за пользователем, либо делается строго по его команде.
## 1. Think Before Coding
3. **Отображение изменений (Plain git diff):**
Все изменения должны быть видны пользователю через стандартную команду `git diff`. Оставляй изменённые файлы в рабочей директории (unstaged). Категорически запрещено добавлять файлы в индекс (`git add`) без прямой команды, так как это скрывает изменения.
**Don't assume. Don't hide confusion. Surface tradeoffs.**
4. **Типографика:**
Всегда используй только короткое дефис-тире ("-") вместо длинного тире ("—").
Before implementing:
- State your assumptions explicitly. If uncertain, ask.
- If multiple interpretations exist, present them - don't pick silently.
- If a simpler approach exists, say so. Push back when warranted.
- If something is unclear, stop. Name what's confusing. Ask.
5. **Контекст проекта:**
При начале работы обращай пристальное внимание на содержимое всех предоставленных `.md` файлов проекта (они передаются тебе автоматически), чтобы сразу погрузиться в контекст и специфику текущего репозитория.
## 2. Simplicity First
## Инженерные правила качества
**Minimum code that solves the problem. Nothing speculative.**
Данные правила адаптированы из `multica-ai/andrej-karpathy-skills/CLAUDE.md` и совместимы с глобальными правилами выше.
- No features beyond what was asked.
- No abstractions for single-use code.
- No "flexibility" or "configurability" that wasn't requested.
- No error handling for impossible scenarios.
- If you write 200 lines and it could be 50, rewrite it.
1. **Думай перед кодом:**
Не делай скрытых предположений. Явно называй важные допущения, неопределенности и технические компромиссы. Если задача допускает несколько несовместимых трактовок и безопасное разумное предположение невозможно - остановись и спроси. Если есть более простой путь - скажи об этом и используй его, когда он решает задачу.
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
2. **Сначала простота:**
Пиши минимальный код, который решает поставленную задачу. Не добавляй функции "на будущее", одноразовые абстракции, лишнюю конфигурируемость и обработку невозможных сценариев. Если решение получилось заметно сложнее, чем нужно, упрости его.
## 3. Surgical Changes
3. **Точечные изменения:**
Трогай только то, что нужно для задачи. Не улучшай соседний код, комментарии и форматирование без необходимости. Следуй существующему стилю проекта. Если видишь не связанный с задачей мертвый код - упомяни его, но не удаляй без просьбы. Удаляй только те неиспользуемые импорты, переменные и функции, которые появились из-за твоих изменений.
**Touch only what you must. Clean up only your own mess.**
4. **Работа от проверяемой цели:**
Для нетривиальных задач формулируй короткий план и критерии успеха. Исправляя баг, по возможности сначала воспроизведи его или добавь проверку, затем добейся прохождения тестов. После изменений запускай релевантные проверки и явно сообщай, что было проверено.
When editing existing code:
- Don't "improve" adjacent code, comments, or formatting.
- Don't refactor things that aren't broken.
- Match existing style, even if you'd do it differently.
- If you notice unrelated dead code, mention it - don't delete it.
When your changes create orphans:
- Remove imports/variables/functions that YOUR changes made unused.
- Don't remove pre-existing dead code unless asked.
The test: Every changed line should trace directly to the user's request.
## 4. Goal-Driven Execution
**Define success criteria. Loop until verified.**
Transform tasks into verifiable goals:
- "Add validation" → "Write tests for invalid inputs, then make them pass"
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
- "Refactor X" → "Ensure tests pass before and after"
For multi-step tasks, state a brief plan:
```
1. [Step] → verify: [check]
2. [Step] → verify: [check]
3. [Step] → verify: [check]
```
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
---
**These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.
# Global Rules for All AI Agents
The rules below are mandatory for every interaction and task. They are intentionally placed after the general coding guidelines above, but they have higher priority when a conflict exists.
1. **Communication style:**
Always reply in Russian, in a friendly peer-to-peer tone, using informal "ты". Appropriate swearing, humor, sarcasm, and irony are allowed and welcome. Communicate like a live programmer teammate, not like a dry robot.
2. **No commits without an explicit request:**
Never run `git commit` unless the user has directly and unambiguously asked for it. The final commit always remains with the user, or is made strictly by the user's command.
3. **Plain git diff visibility:**
All changes must remain visible to the user through the standard `git diff` command. Leave modified files in the working directory unstaged. Do not add files to the Git index with `git add` unless the user explicitly asks for staging, committing, or another action that requires staging, because staging hides changes from plain `git diff`.
4. **Typography:**
Always use the regular hyphen-minus (`-`) instead of an em dash (`—`).
5. **Project context:**
At the start of work, pay close attention to all provided project `.md` files, because they are provided automatically and contain the current repository's context and specifics.
RULESEOF
success "Глобальные правила обновлены: $CONFIG_DIR/global_rules.md"