Стиль коду UFO-Tech

Необов'язковий стиль коду команди UFO-Tech для PHP — типізація, DTO, тонкі контролери, сервіси, ранні повернення. Для проєктів, що його приймають.

Встановити через агента — скажіть йому:

Прочитай https://ufo-tech.space/ai/install.md і встанови правило ufo-code-style з каталогу UFO Tech у цей проєкт.

Встановлення

Claude Code

У проєкт — docs/ai/ufo-code-style.md

macOS, Linux, WSL, Git Bash

mkdir -p "docs/ai"
curl -fsSL https://ufo-tech.space/ai/files/rule/ufo-code-style/universal/ufo-code-style.md -o "docs/ai/ufo-code-style.md"

Windows PowerShell

New-Item -ItemType Directory -Force "docs\ai" | Out-Null
Invoke-WebRequest https://ufo-tech.space/ai/files/rule/ufo-code-style/universal/ufo-code-style.md -OutFile "docs\ai\ufo-code-style.md"

Додайте в CLAUDE.md у корені проєкту рядок:

@docs/ai/ufo-code-style.md

Codex

У проєкт — docs/ai/ufo-code-style.md

macOS, Linux, WSL, Git Bash

mkdir -p "docs/ai"
curl -fsSL https://ufo-tech.space/ai/files/rule/ufo-code-style/universal/ufo-code-style.md -o "docs/ai/ufo-code-style.md"

Windows PowerShell

New-Item -ItemType Directory -Force "docs\ai" | Out-Null
Invoke-WebRequest https://ufo-tech.space/ai/files/rule/ufo-code-style/universal/ufo-code-style.md -OutFile "docs\ai\ufo-code-style.md"

Додайте в AGENTS.md у корені проєкту рядок:

Follow docs/ai/ufo-code-style.md.

Cursor

У проєкт — .cursor/rules/ufo-code-style.mdc

macOS, Linux, WSL, Git Bash

mkdir -p ".cursor/rules"
curl -fsSL https://ufo-tech.space/ai/files/rule/ufo-code-style/universal/ufo-code-style.md -o ".cursor/rules/ufo-code-style.mdc"

Windows PowerShell

New-Item -ItemType Directory -Force ".cursor\rules" | Out-Null
Invoke-WebRequest https://ufo-tech.space/ai/files/rule/ufo-code-style/universal/ufo-code-style.md -OutFile ".cursor\rules\ufo-code-style.mdc"

Prepend Cursor frontmatter: description (one line), globs (if the rule targets specific paths), alwaysApply: false.

GitHub Copilot

У проєкт — .github/instructions/ufo-code-style.instructions.md

macOS, Linux, WSL, Git Bash

mkdir -p ".github/instructions"
curl -fsSL https://ufo-tech.space/ai/files/rule/ufo-code-style/universal/ufo-code-style.md -o ".github/instructions/ufo-code-style.instructions.md"

Windows PowerShell

New-Item -ItemType Directory -Force ".github\instructions" | Out-Null
Invoke-WebRequest https://ufo-tech.space/ai/files/rule/ufo-code-style/universal/ufo-code-style.md -OutFile ".github\instructions\ufo-code-style.instructions.md"

Prepend frontmatter with applyTo, e.g. applyTo: "src/**".

AGENTS.md

У проєкт — docs/ai/ufo-code-style.md

macOS, Linux, WSL, Git Bash

mkdir -p "docs/ai"
curl -fsSL https://ufo-tech.space/ai/files/rule/ufo-code-style/universal/ufo-code-style.md -o "docs/ai/ufo-code-style.md"

Windows PowerShell

New-Item -ItemType Directory -Force "docs\ai" | Out-Null
Invoke-WebRequest https://ufo-tech.space/ai/files/rule/ufo-code-style/universal/ufo-code-style.md -OutFile "docs\ai\ufo-code-style.md"

Додайте в AGENTS.md у корені проєкту рядок:

Follow docs/ai/ufo-code-style.md.

Опис

Необов'язковий стиль коду команди UFO-Tech для PHP-проєктів. Підключайте його лише в проєктах, що приймають цей стиль; якщо у проєкті вже є власні домовленості, агент має дотримуватися їх.

Що всередині

  • declare(strict_types=1);, повна типізація аргументів, результатів і властивостей;
  • DTO й value objects замість асоціативних масивів, незмінність за замовчуванням;
  • тонкі контролери, бізнес-логіка в сервісах, репозиторії лише для доступу до даних;
  • ранні повернення, невелика вкладеність і короткі методи.

Файл англійською.

<div class="docs-page-votes" data-page-votes hidden data-endpoint="/votes" role="group" aria-label="Оцінка сторінки"> <button class="docs-page-votes__button" type="button" data-vote="1" aria-pressed="false" title="Корисно"> <span aria-hidden="true">👍</span> <span class="visually-hidden">Корисно</span> <span data-vote-count>0</span> </button> <button class="docs-page-votes__button" type="button" data-vote="-1" aria-pressed="false" title="Не корисно"> <span aria-hidden="true">👎</span> <span class="visually-hidden">Не корисно</span> <span data-vote-count>0</span> </button> </div> <p class="docs-page-counters" data-page-counters hidden data-endpoint="/_e/page" data-label-total="Переглянуто: {count} {times}" data-label-now="Зараз переглядають: {count}" data-times="{&quot;one&quot;:&quot;\u0440\u0430\u0437&quot;,&quot;few&quot;:&quot;\u0440\u0430\u0437\u0438&quot;,&quot;many&quot;:&quot;\u0440\u0430\u0437\u0456\u0432&quot;,&quot;other&quot;:&quot;\u0440\u0430\u0437\u0443&quot;}"> <span data-page-counters-total></span> <span aria-hidden="true">·</span> <span data-page-counters-now></span> </p>