Agent skill

Psr Coding Style Knowledge

by dykyi-roman in dykyi-roman/awesome-claude-code

PSR-1 and PSR-12 coding standards knowledge base for PHP 8.4 projects.

MITAuto-check passedDevelopment

Install Psr Coding Style Knowledge

skills CLI
$ npx skills add dykyi-roman/awesome-claude-code --skill psr-coding-style-knowledge -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install dykyi-roman/awesome-claude-code psr-coding-style-knowledge --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/dykyi-roman/awesome-claude-code.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/psr-coding-style-knowledge .claude/skills/psr-coding-style-knowledge && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
psr-coding-style-knowledge
GitHub stars
103
Token cost
~2.3k tokens
SKILL.md length
288 words
Files
6 (incl. references, assets)
Skills in repo
11
Repo updated
First seen
Licence
MIT

At a glance

PSR-1 and PSR-12 coding standards knowledge base for PHP 8.4 projects.

  • Works in 11 steps: Files → Namespaces and Classes → Side Effects Detection → …
  • Code style audits and compliance reviews
  • SKILL.md covers Quick Reference, PSR-1: Basic Coding Standard, PSR-12: Extended Coding Style and Detection Patterns, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Psr Coding Style Knowledge is an agent skill from dykyi-roman/awesome-claude-code. PSR-1 and PSR-12 coding standards knowledge base for PHP 8.4 projects. Provides quick reference for basic coding standard and extended coding style with detection patterns, examples, and antipattern identification. Use for code style audits and compliance reviews.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files and assets (for example `assets/report-template.md`, `references/antipatterns.md` and `references/detection-patterns.md`).

It sits in Development, covering Code quality, Regulatory compliance and Knowledge bases. It works with PHP. The repository describes itself as: PHP Architecture Toolkit for Claude Code (DDD, CQRS, Event Sourcing, Hexagonal, Clean Architecture, SOLID, GRASP, PSR, Design Patterns, Testing, Documentation, Code Review). The licence is MIT.

When your agent uses it

  • Code style audits and compliance reviews
  • Tasks that involve Code quality
  • Tasks that involve Regulatory compliance

Example prompts

  • “/psr-coding-style-knowledge”

Workflow steps

11 steps, taken from the step headings in SKILL.md.

  1. Files
  2. Namespaces and Classes
  3. Side Effects Detection
  4. General
  5. Files
  6. Keywords and Types
  7. Classes, Properties, Methods
  8. Control Structures
  9. Operators
  10. Closures and Arrow Functions
  11. Anonymous Classes

What it can do on your machine

Read from SKILL.md and the folder at commit 7e1fea8. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are php, bash and xml).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Psr Coding Style Knowledge loads about 2.3k tokens when it runs, and up to ~10k if it reads all its reference files. Until then it costs about 73 tokens; SKILL.md has 288 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~73
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~10k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from dykyi-roman/awesome-claude-code at commit 7e1fea8, republished under its MIT licence (© dykyi-roman). 288 words, ~2,342 tokens.

Download SKILL.mdSave it as .claude/skills/psr-coding-style-knowledge/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
psr-coding-style-knowledge
description
PSR-1 and PSR-12 coding standards knowledge base for PHP 8.4 projects. Provides quick reference for basic coding standard and extended coding style with detection patterns, examples, and antipattern identification. Use for code style audits and compliance reviews.

PSR Coding Style Knowledge (PSR-1, PSR-12)

Quick Reference

StandardFocusKey Rules
PSR-1Basic StandardFiles, namespaces, class names
PSR-12Extended StyleFormatting, keywords, visibility

PSR-1: Basic Coding Standard

1. Files
RuleRequirement
TagsMUST use <?php or <?= only
EncodingMUST be UTF-8 without BOM
Side EffectsFiles SHOULD declare symbols OR execute logic, not both
2. Namespaces and Classes
RuleRequirement
NamespacesMUST follow PSR-4 autoloading
Class NamesMUST be StudlyCaps (PascalCase)
ConstantsMUST be UPPER_CASE_WITH_UNDERSCORES
MethodsMUST be camelCase
3. Side Effects Detection
php
// BAD: Mixing declarations and side effects
<?php
namespace App;

ini_set('display_errors', '1');  // Side effect!

class Logger { }

// GOOD: Separate files
// bootstrap.php
<?php
ini_set('display_errors', '1');
require 'vendor/autoload.php';

// Logger.php
<?php
declare(strict_types=1);

namespace App;

final readonly class Logger { }

PSR-12: Extended Coding Style

1. General
RuleRequirement
PSR-1MUST follow PSR-1
IndentationMUST use 4 spaces (no tabs)
Line LengthSHOULD be ≤120 chars, MUST NOT hard wrap
Line EndingMUST be Unix LF (\n)
Blank LineMUST have one at end of file
Trailing SpaceMUST NOT have trailing whitespace
2. Files
php
<?php

declare(strict_types=1);

namespace Vendor\Package;

use Vendor\Package\{ClassA as A, ClassB, ClassC as C};
use Vendor\Package\SomeNamespace\ClassD as D;

use function Vendor\Package\{functionA, functionB, functionC};
use const Vendor\Package\{ConstantA, ConstantB, ConstantC};

final readonly class ClassName extends ParentClass implements
    InterfaceA,
    InterfaceB,
    InterfaceC
{
    // class body
}
3. Keywords and Types
RuleRequirement
KeywordsMUST be lowercase (true, false, null)
Type DeclarationsMUST be lowercase (int, string, bool)
Short FormsMUST use bool, int (not boolean, integer)
4. Classes, Properties, Methods
php
<?php

declare(strict_types=1);

namespace App\Domain\Entity;

use App\Domain\ValueObject\Email;
use App\Domain\ValueObject\UserId;

final readonly class User
{
    public function __construct(
        private UserId $id,
        private Email $email,
        private string $name,
        private bool $isActive = true,
    ) {
    }

    public function getId(): UserId
    {
        return $this->id;
    }

    public function activate(): self
    {
        return new self(
            $this->id,
            $this->email,
            $this->name,
            true,
        );
    }
}
5. Control Structures
php
<?php

// if-elseif-else
if ($expr1) {
    // if body
} elseif ($expr2) {
    // elseif body
} else {
    // else body
}

// switch
switch ($expr) {
    case 0:
        echo 'First case';
        break;
    case 1:
        echo 'Second case';
        // no break - intentional fall-through
    default:
        echo 'Default case';
        break;
}

// match (PHP 8.0+)
$result = match ($expr) {
    0 => 'First',
    1, 2 => 'Second or third',
    default => 'Other',
};

// while
while ($expr) {
    // body
}

// for
for ($i = 0; $i < 10; $i++) {
    // body
}

// foreach
foreach ($iterable as $key => $value) {
    // body
}

// try-catch-finally
try {
    // try body
} catch (FirstThrowableType $e) {
    // catch body
} catch (OtherThrowableType | AnotherThrowableType $e) {
    // multi-catch body
} finally {
    // finally body
}
6. Operators
php
<?php

// Binary operators: space before and after
$sum = $a + $b;
$concat = $string1 . $string2;
$result = $condition ? $valueIfTrue : $valueIfFalse;

// Unary operators: no space
$i++;
--$j;
$negated = !$bool;

// Type casting: no space after cast
$intValue = (int) $floatValue;
$stringValue = (string) $intValue;
7. Closures and Arrow Functions
php
<?php

// Closure
$closure = function (int $arg1, int $arg2) use ($var1, $var2): int {
    return $arg1 + $arg2 + $var1 + $var2;
};

// Long argument list
$longClosure = function (
    int $argument1,
    string $argument2,
    bool $argument3,
) use (
    $staticVar1,
    $staticVar2,
): bool {
    // body
};

// Arrow function (PHP 7.4+)
$multiply = fn(int $a, int $b): int => $a * $b;
8. Anonymous Classes
php
<?php

$instance = new class extends ParentClass implements SomeInterface {
    use SomeTrait;

    public function __construct(
        private readonly int $value,
    ) {
    }
};

Detection Patterns

PSR-1 Violations
bash
# Side effects in class files (functions like echo, print, header, etc.)
grep -rn "^[[:space:]]*\(echo\|print\|header\|session_start\|ini_set\)" --include="*.php" src/

# Non-StudlyCaps class names
grep -rn "^class [a-z]" --include="*.php" src/
grep -rn "^class [A-Z][a-z]*_" --include="*.php" src/

# Non-camelCase method names
grep -rn "function [A-Z]" --include="*.php" src/
grep -rn "function [a-z]*_[a-z]" --include="*.php" src/
PSR-12 Violations
bash
# Tab characters instead of spaces
grep -rn $'\t' --include="*.php" src/

# Trailing whitespace
grep -rn "[[:space:]]$" --include="*.php" src/

# Long keywords (boolean instead of bool)
grep -rn "boolean\|integer" --include="*.php" src/

# Missing space after keywords
grep -rn "\(if\|for\|foreach\|while\|switch\|catch\)(" --include="*.php" src/

# Opening brace on wrong line for classes
grep -rn "^class.*{$" --include="*.php" src/

PHP_CodeSniffer Configuration

xml
<?xml version="1.0"?>
<ruleset name="PSR-12">
    <description>PSR-12 coding standard</description>
    <rule ref="PSR12"/>

    <file>src</file>
    <file>tests</file>

    <exclude-pattern>vendor/*</exclude-pattern>

    <arg name="colors"/>
    <arg value="sp"/>
</ruleset>

PHP-CS-Fixer Configuration

php
<?php

declare(strict_types=1);

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
    ->in([
        __DIR__ . '/src',
        __DIR__ . '/tests',
    ])
    ->name('*.php');

return (new Config())
    ->setRiskyAllowed(true)
    ->setRules([
        '@PSR12' => true,
        '@PHP84Migration' => true,
        'declare_strict_types' => true,
        'final_class' => true,
        'class_attributes_separation' => [
            'elements' => ['method' => 'one'],
        ],
        'ordered_imports' => [
            'sort_algorithm' => 'alpha',
            'imports_order' => ['class', 'function', 'const'],
        ],
        'no_unused_imports' => true,
        'trailing_comma_in_multiline' => [
            'elements' => ['arguments', 'arrays', 'parameters'],
        ],
    ])
    ->setFinder($finder);

Antipatterns

ViolationPSRSeverityFix
Mixed declarations and side effectsPSR-1CRITICALSeparate into bootstrap file
snake_case class namesPSR-1CRITICALRename to StudlyCaps
Tabs for indentationPSR-12WARNINGConvert to 4 spaces
Boolean/integer type hintsPSR-12WARNINGUse bool/int
Missing strict_types-WARNINGAdd declaration
Opening brace on same linePSR-12INFOMove to next line
Trailing whitespacePSR-12INFORemove whitespace

Integration with DDD

Domain Layer
php
<?php

declare(strict_types=1);

namespace App\Domain\User\ValueObject;

// PSR-12 compliant Value Object
final readonly class Email
{
    private function __construct(
        private string $value,
    ) {
    }

    public static function fromString(string $email): self
    {
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            throw new InvalidEmailException($email);
        }

        return new self($email);
    }

    public function toString(): string
    {
        return $this->value;
    }
}
Application Layer
php
<?php

declare(strict_types=1);

namespace App\Application\User\UseCase;

use App\Application\User\Command\CreateUserCommand;
use App\Domain\User\Entity\User;
use App\Domain\User\Repository\UserRepositoryInterface;

// PSR-12 compliant Use Case
final readonly class CreateUserHandler
{
    public function __construct(
        private UserRepositoryInterface $userRepository,
    ) {
    }

    public function __invoke(CreateUserCommand $command): void
    {
        $user = User::create(
            $command->email,
            $command->name,
        );

        $this->userRepository->save($user);
    }
}

See Also

  • references/psr-1-basic.md - Full PSR-1 specification
  • references/psr-12-extended.md - Full PSR-12 specification
  • references/detection-patterns.md - Comprehensive detection patterns
  • references/antipatterns.md - Common violations with fixes
  • assets/report-template.md - Compliance report template

© dykyi-roman, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references, assets) in skills/psr-coding-style-knowledge of dykyi-roman/awesome-claude-code.

  • SKILL.md
  • assets/report-template.md
  • references/antipatterns.md
  • references/detection-patterns.md
  • references/psr-1-basic.md
  • references/psr-12-extended.md

Open the folder on GitHubat commit 7e1fea8

Compare with similar skills

Psr Coding Style Knowledge next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Psr Coding Style Knowledge compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Psr Coding Style Knowledge this skilldykyi-roman/awesome-claude-code103—~2.3kAutomated safety check: PassMIT
WooCommerce Code Reviewwoocommerce/woocommerce11k3 repos~1.1kAutomated safety check: PassCustom licence
Skill Doli Code ReviewDolibarr/dolibarr7.7k1 repos~1.1kAutomated safety check: PassMIT
Code StyleAutomattic/wordpress-activitypub582—~2.2kAutomated safety check: PassMIT
DevAutomattic/wordpress-activitypub582—~1.1kAutomated safety check: PassMIT
WooCommerce Backend Conventionswoocommerce/woocommerce11k1 repos~614Automated safety check: PassCustom licence

Similar skills

  • WooCommerce Code Review

    woocommerce/woocommerce

    Reviews WooCommerce code changes against the project's standards, flagging backend PHP architecture, naming, documentation, data integrity and testing violations.

    11k GitHub starsUsed in 3 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Skill Doli Code Review

    Dolibarr/dolibarr

    Reviews Dolibarr PHP code for compliance with coding standards and security best practices, and fixes identified issues.

    7.7k GitHub starsUsed in 1 repo~1.1k tokens
    DevelopmentAuto-check passed
  • Code Style

    Automattic/wordpress-activitypub

    PHP coding standards and WordPress patterns for ActivityPub plugin.

    582 GitHub stars~2.2k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Dev

    Automattic/wordpress-activitypub

    Development workflows for WordPress ActivityPub plugin including wp-env setup, testing commands, linting, and build processes.

    582 GitHub stars~1.1k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • WooCommerce Backend Conventions

    woocommerce/woocommerce

    Guides agents writing or changing WooCommerce backend PHP so new classes, hooks and unit tests follow the project's conventions.

    11k GitHub starsUsed in 1 repo~614 tokens
    DevelopmentAuto-check passed
  • Code Quality

    bonny/WordPress-Simple-History

    Runs linting and static analysis on PHP/CSS/JS using phpcs, phpstan, and rector.

    317 GitHub stars~519 tokensUpdated yesterday
    DevelopmentAuto-check: notes

More from dykyi-roman/awesome-claude-code

All 11 skills in this repo
  • Grasp Knowledge

    dykyi-roman/awesome-claude-code

    GRASP principles knowledge base for PHP 8.4 projects. An agent skill from dykyi-roman/awesome-claude-code.

    103 GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Psr Autoloading Knowledge

    dykyi-roman/awesome-claude-code

    PSR-4 autoloading standard knowledge base for PHP 8.4 projects.

    103 GitHub stars~2.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Psr Overview Knowledge

    dykyi-roman/awesome-claude-code

    PHP Standards Recommendations (PSR) overview knowledge base.

    103 GitHub stars~2.7k tokensUpdated 1 mo ago
    Auto-check passed
  • Solid Knowledge

    dykyi-roman/awesome-claude-code

    SOLID principles knowledge base for PHP 8.4 projects. An agent skill from dykyi-roman/awesome-claude-code.

    103 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Claude Code Knowledge

    dykyi-roman/awesome-claude-code

    Comprehensive knowledge base for Claude Code formats, patterns, and configuration.

    103 GitHub stars~4k tokensUpdated 1 mo ago
    Auto-check passed
  • Adr Knowledge

    dykyi-roman/awesome-claude-code

    Action-Domain-Responder pattern knowledge base. An agent skill from dykyi-roman/awesome-claude-code.

    103 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Psr Coding Style Knowledge

What does Psr Coding Style Knowledge do?

PSR-1 and PSR-12 coding standards knowledge base for PHP 8.4 projects. Psr Coding Style Knowledge is an agent skill from dykyi-roman/awesome-claude-code.4 projects.

When should I use Psr Coding Style Knowledge?

Psr Coding Style Knowledge fits situations like: code style audits and compliance reviews; tasks that involve Code quality; tasks that involve Regulatory compliance.

How do I install Psr Coding Style Knowledge in Claude Code?

Run `npx skills add dykyi-roman/awesome-claude-code --skill psr-coding-style-knowledge -a claude-code`. Or copy the skill folder (skills/psr-coding-style-knowledge in dykyi-roman/awesome-claude-code) into .claude/skills/psr-coding-style-knowledge in your project. Claude Code loads it when a task matches its description.

How do I install Psr Coding Style Knowledge in Codex?

Run `npx skills add dykyi-roman/awesome-claude-code --skill psr-coding-style-knowledge -a codex`. Or copy the skill folder (skills/psr-coding-style-knowledge in dykyi-roman/awesome-claude-code) into .agents/skills/psr-coding-style-knowledge in your project. Codex loads it when a task matches its description.

Can I use Psr Coding Style Knowledge in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add dykyi-roman/awesome-claude-code --skill psr-coding-style-knowledge -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/psr-coding-style-knowledge, .gemini/skills/psr-coding-style-knowledge, .github/skills/psr-coding-style-knowledge and .opencode/skills/psr-coding-style-knowledge in your project.

What does Psr Coding Style Knowledge need to run?

SKILL.md names no scripts, command-line tools or credentials: Psr Coding Style Knowledge is instructions for the agent only.

Does Psr Coding Style Knowledge access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Psr Coding Style Knowledge safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Psr Coding Style Knowledge use?

Psr Coding Style Knowledge is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Psr Coding Style Knowledge use?

About 2.3k tokens (SKILL.md is roughly 9.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 7.9k tokens, read only when the agent opens those files.

What are the alternatives to Psr Coding Style Knowledge?

Skills that share tags, products or a category with Psr Coding Style Knowledge: WooCommerce Code Review (woocommerce/woocommerce, 11k stars), Skill Doli Code Review (Dolibarr/dolibarr, 7.7k stars), Code Style (Automattic/wordpress-activitypub, 582 stars) and Dev (Automattic/wordpress-activitypub, 582 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Psr Coding Style Knowledge?

dykyi-roman (a GitHub user) maintains it in dykyi-roman/awesome-claude-code, which has 103 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on August 16, 2026.

Source: dykyi-roman/awesome-claude-code on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.