The UFO-Tech team's optional PHP code style — strict typing, DTOs, thin controllers, services, early returns. For projects that adopt it.
Install through your agent — tell it:
Read https://ufo-tech.space/ai/install.md and install the ufo-code-style rule from the UFO Tech catalog into this project.
Installation
Claude Code
Into the project — 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"
Add this line to CLAUDE.md in the project root:
@docs/ai/ufo-code-style.md
Codex
Into the project — 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"
Add this line to AGENTS.md in the project root:
Follow docs/ai/ufo-code-style.md.
Cursor
Into the project — .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
Into the project — .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
Into the project — 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"
Add this line to AGENTS.md in the project root:
Follow docs/ai/ufo-code-style.md.
About
The UFO-Tech team's optional code style for PHP projects. Add it only to projects that adopt this style; if a project already has its own conventions, the agent must follow those.
What's inside
declare(strict_types=1);, full typing of arguments, return values and properties;- DTOs and value objects instead of associative arrays, immutable by default;
- thin controllers, business logic in services, repositories only for data access;
- early returns, shallow nesting and short methods.
The file is in English.