Agent skill

Psr Autoloading Knowledge

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

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

MITAuto-check passedKnowledge Management

Install Psr Autoloading Knowledge

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

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

GitHub CLI
$ gh skill install dykyi-roman/awesome-claude-code psr-autoloading-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-autoloading-knowledge .claude/skills/psr-autoloading-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-autoloading-knowledge
GitHub stars
104
Token cost
~2.1k tokens
SKILL.md length
209 words
Files
6 (incl. references, assets)
Skills in repo
11
Repo updated
First seen
Licence
MIT

At a glance

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

  • Works in 5 steps: Namespace vs Path Mismatch → Class Name vs Filename Mismatch → Case Sensitivity Issues → …
  • Autoloading audits and project structure reviews
  • SKILL.md covers Quick Reference, Core Concept, Namespace to Path Mapping and Composer Configuration, plus 6 more sections
  • Calls composer and php

What it does

Psr Autoloading Knowledge is an agent skill from dykyi-roman/awesome-claude-code. PSR-4 autoloading standard knowledge base for PHP 8.4 projects. Provides quick reference for namespace-to-path mapping, composer.json configuration, directory structure, and common mistakes. Use for autoloading audits and project structure reviews.

Its SKILL.md is about 2.1k 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/composer-integration.md`).

It sits in Knowledge Management, covering 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

  • Autoloading audits and project structure reviews
  • Tasks that involve Knowledge bases

Example prompts

  • “/psr-autoloading-knowledge”

Workflow steps

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

  1. Namespace vs Path Mismatch
  2. Class Name vs Filename Mismatch
  3. Case Sensitivity Issues
  4. Missing Trailing Backslash
  5. Incorrect Directory Separator

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

    Shell commands in SKILL.md call:

    • composer
    • php

    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 Autoloading Knowledge loads about 2.1k tokens when it runs, and up to ~9.8k if it reads all its reference files. Until then it costs about 69 tokens; SKILL.md has 209 words of instructions outside code blocks.

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

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). 209 words, ~2,144 tokens.

Download SKILL.mdSave it as .claude/skills/psr-autoloading-knowledge/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
psr-autoloading-knowledge
description
PSR-4 autoloading standard knowledge base for PHP 8.4 projects. Provides quick reference for namespace-to-path mapping, composer.json configuration, directory structure, and common mistakes. Use for autoloading audits and project structure reviews.

PSR-4 Autoloading Knowledge

Quick Reference

ConceptDescription
Namespace PrefixMaps to a base directory
FQCNFully Qualified Class Name
Path MappingNamespace → Directory → File

Core Concept

PSR-4 defines how to autoload classes from file paths based on their fully qualified class name.

Namespace Prefix    → Base Directory
Acme\Log\           → ./src/

FQCN                → File Path
Acme\Log\Writer\FileWriter → ./src/Writer/FileWriter.php

Namespace to Path Mapping

The Formula
File Path = Base Directory + (FQCN - Namespace Prefix) + .php

Where:
- Namespace separators (\) → Directory separators (/)
- Class name → File name with .php extension
Examples
FQCNNamespace PrefixBase DirectoryFile Path
App\Entity\UserApp\src/src/Entity/User.php
App\Domain\User\Entity\UserApp\src/src/Domain/User/Entity/User.php
Vendor\Package\SubNs\ClassNameVendor\Package\lib/lib/SubNs/ClassName.php

Composer Configuration

Basic Setup
json
{
    "autoload": {
        "psr-4": {
            "App\\": "src/",
            "App\\Tests\\": "tests/"
        }
    }
}
Multiple Directories
json
{
    "autoload": {
        "psr-4": {
            "App\\": ["src/", "lib/"]
        }
    }
}
DDD Project Structure
json
{
    "autoload": {
        "psr-4": {
            "App\\": "src/",
            "App\\Domain\\": "src/Domain/",
            "App\\Application\\": "src/Application/",
            "App\\Infrastructure\\": "src/Infrastructure/",
            "App\\Presentation\\": "src/Presentation/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    }
}
Symfony Bundle Structure
json
{
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    }
}
Laravel Package Structure
json
{
    "autoload": {
        "psr-4": {
            "Vendor\\Package\\": "src/"
        }
    }
}

Directory Structure Examples

Standard DDD Layout
project/
├── composer.json
├── src/
│   ├── Domain/
│   │   └── User/
│   │       ├── Entity/
│   │       │   └── User.php           # App\Domain\User\Entity\User
│   │       ├── ValueObject/
│   │       │   └── Email.php          # App\Domain\User\ValueObject\Email
│   │       ├── Repository/
│   │       │   └── UserRepositoryInterface.php
│   │       └── Event/
│   │           └── UserCreated.php
│   ├── Application/
│   │   └── User/
│   │       ├── Command/
│   │       │   └── CreateUserCommand.php
│   │       └── Handler/
│   │           └── CreateUserHandler.php
│   ├── Infrastructure/
│   │   └── Persistence/
│   │       └── Doctrine/
│   │           └── UserRepository.php
│   └── Presentation/
│       └── Api/
│           └── Controller/
│               └── UserController.php
└── tests/
    └── Unit/
        └── Domain/
            └── User/
                └── Entity/
                    └── UserTest.php   # App\Tests\Unit\Domain\User\Entity\UserTest
Class Examples
php
// src/Domain/User/Entity/User.php
<?php

declare(strict_types=1);

namespace App\Domain\User\Entity;

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

final class User
{
    // ...
}
php
// src/Domain/User/ValueObject/Email.php
<?php

declare(strict_types=1);

namespace App\Domain\User\ValueObject;

final readonly class Email
{
    // ...
}

Detection Patterns

Find Mismatched Namespaces
bash
# Extract namespace from files and compare with path
for file in $(find src -name "*.php"); do
    namespace=$(grep -m1 "^namespace" "$file" | sed 's/namespace //;s/;//')
    expected_ns="App\\$(dirname ${file#src/} | tr '/' '\\')"
    if [ "$namespace" != "$expected_ns" ]; then
        echo "Mismatch: $file"
        echo "  Found:    $namespace"
        echo "  Expected: $expected_ns"
    fi
done
Find Classes Without Namespace
bash
# Files with class but no namespace
grep -rL "^namespace" --include="*.php" src/ | \
    xargs grep -l "^class\|^interface\|^trait\|^enum"
Find Incorrect Class Names
bash
# Class name doesn't match filename
for file in $(find src -name "*.php"); do
    filename=$(basename "$file" .php)
    if ! grep -q "^\(class\|interface\|trait\|enum\) $filename" "$file"; then
        echo "Mismatch: $file (expected class/interface/trait/enum $filename)"
    fi
done
Validate Composer Autoload
bash
# Dump autoload and check for errors
composer dump-autoload --strict 2>&1 | grep -i "warning\|error"

# Validate composer.json
composer validate --strict

Common Mistakes

1. Namespace vs Path Mismatch
php
// File: src/Domain/User/Entity/User.php
// BAD: Namespace doesn't match path
namespace App\User\Entity;  // Missing "Domain"

// GOOD: Namespace matches path
namespace App\Domain\User\Entity;
2. Class Name vs Filename Mismatch
php
// File: src/Domain/UserEntity.php
// BAD: Class name doesn't match filename
class User { }

// GOOD: Class name matches filename
class UserEntity { }
3. Case Sensitivity Issues
php
// File: src/Domain/User/Entity/user.php (lowercase)
// BAD: Will fail on case-sensitive filesystems (Linux)
namespace App\Domain\User\Entity;
class User { }

// GOOD: Filename should be User.php (PascalCase)
4. Missing Trailing Backslash
json
// BAD: Missing trailing backslash
{
    "autoload": {
        "psr-4": {
            "App": "src/"
        }
    }
}

// GOOD: Include trailing backslash
{
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    }
}
5. Incorrect Directory Separator
json
// BAD: Using backslash in path (Windows-only)
{
    "autoload": {
        "psr-4": {
            "App\\": "src\\"
        }
    }
}

// GOOD: Use forward slash (cross-platform)
{
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    }
}

Verification Commands

bash
# Regenerate autoload files
composer dump-autoload

# Optimize autoload (production)
composer dump-autoload --optimize

# Validate and show issues
composer dump-autoload --strict

# Test class loading
php -r "require 'vendor/autoload.php'; new App\Domain\User\Entity\User();"

PHP-CS-Fixer Rules

php
<?php

return (new PhpCsFixer\Config())
    ->setRules([
        // PSR-4 related rules
        'single_class_element_per_statement' => true,
        'single_import_per_statement' => true,
        'ordered_imports' => [
            'sort_algorithm' => 'alpha',
        ],
        'no_unused_imports' => true,
        'fully_qualified_strict_types' => true,
    ]);

Integration with DDD Layers

Layer Mapping
LayerNamespaceDirectory
DomainApp\Domain\{Context}\src/Domain/{Context}/
ApplicationApp\Application\{Context}\src/Application/{Context}/
InfrastructureApp\Infrastructure\src/Infrastructure/
PresentationApp\Presentation\src/Presentation/
Component Mapping
ComponentNamespace PatternDirectory Pattern
EntityApp\Domain\{Context}\Entity\src/Domain/{Context}/Entity/
Value ObjectApp\Domain\{Context}\ValueObject\src/Domain/{Context}/ValueObject/
RepositoryApp\Domain\{Context}\Repository\src/Domain/{Context}/Repository/
ServiceApp\Domain\{Context}\Service\src/Domain/{Context}/Service/
CommandApp\Application\{Context}\Command\src/Application/{Context}/Command/
QueryApp\Application\{Context}\Query\src/Application/{Context}/Query/
HandlerApp\Application\{Context}\Handler\src/Application/{Context}/Handler/

See Also

  • references/psr-4-standard.md - Full PSR-4 specification
  • references/composer-integration.md - Composer autoload configuration
  • references/directory-structure.md - Project structure examples
  • references/antipatterns.md - Common mistakes and fixes
  • assets/report-template.md - Audit 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-autoloading-knowledge of dykyi-roman/awesome-claude-code.

  • SKILL.md
  • assets/report-template.md
  • references/antipatterns.md
  • references/composer-integration.md
  • references/directory-structure.md
  • references/psr-4-standard.md

Open the folder on GitHubat commit 7e1fea8

Compare with similar skills

Psr Autoloading 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 Autoloading Knowledge compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Psr Autoloading Knowledge this skilldykyi-roman/awesome-claude-code104—~2.1kAutomated safety check: PassMIT
Ima Knowledge Basecountbot-ai/CountBot784—~506Automated safety check: PassMIT
HypatiaMarchLiu/hypatia239—~7.9kAutomated safety check: NotesMIT
Migrateguhcostan/claude-mega-brain126—~975Automated safety check: PassMIT
SiyuanTommy-yw/RunbookHermes5463 repos~2.3kAutomated safety check: NotesMIT
New LoopAI-Builder-Club/skills1.3k—~1.2kAutomated safety check: NotesNone

Similar skills

  • Ima Knowledge Base

    countbot-ai/CountBot

    通过 IMA OpenAPI 处理知识库任务。支持知识库内容搜索、命中详情查看、条目浏览、列出知识库、上传文件、导入网页。用户提到知识库、资料库、上传到知识库、导入网页、搜知识库时使用。

    784 GitHub stars~506 tokensUpdated today
    Knowledge ManagementAuto-check passed
  • Hypatia

    MarchLiu/hypatia

    Interact with the Hypatia AI memory system using natural language.

    239 GitHub stars~7.9k tokensUpdated 12 days ago
    Knowledge ManagementAuto-check: notes
  • Migrate

    guhcostan/claude-mega-brain

    Scan the project and migrate existing documentation into OKF format.

    126 GitHub stars~975 tokensUpdated 2 mo ago
    Knowledge ManagementAuto-check passed
  • Siyuan

    Tommy-yw/RunbookHermes

    SiYuan Note API for searching, reading, creating, and managing blocks and documents in a self-hosted knowledge base via curl.

    546 GitHub starsUsed in 3 repos~2.3k tokens
    Knowledge ManagementAuto-check: notes
  • New Loop

    AI-Builder-Club/skills

    Spin up a new loop (domain) in a file-based knowledge base — bootstrap the substrate if it's missing, gather the loop's charter, scaffold domains/<loop/README.md, then do ONE real test run and…

    1.3k GitHub stars~1.2k tokensUpdated 25 days ago
    Knowledge ManagementAuto-check: notes
  • Wiki Viewer

    rohitg00/pro-workflow

    Render a self-contained HTML viewer for a pro-workflow wiki.

    2.9k GitHub stars~1.1k tokensUpdated 12 days ago
    Knowledge ManagementAuto-check passed

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.

    104 GitHub stars~1.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Psr Coding Style Knowledge

    dykyi-roman/awesome-claude-code

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

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

    dykyi-roman/awesome-claude-code

    PHP Standards Recommendations (PSR) overview knowledge base.

    104 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.

    104 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.

    104 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.

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

Works with

Questions about Psr Autoloading Knowledge

What does Psr Autoloading Knowledge do?

PSR-4 autoloading standard knowledge base for PHP 8.4 projects. Psr Autoloading Knowledge is an agent skill from dykyi-roman/awesome-claude-code.4 projects.

When should I use Psr Autoloading Knowledge?

Psr Autoloading Knowledge fits situations like: autoloading audits and project structure reviews; tasks that involve Knowledge bases.

How do I install Psr Autoloading Knowledge in Claude Code?

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

How do I install Psr Autoloading Knowledge in Codex?

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

Can I use Psr Autoloading 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-autoloading-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-autoloading-knowledge, .gemini/skills/psr-autoloading-knowledge, .github/skills/psr-autoloading-knowledge and .opencode/skills/psr-autoloading-knowledge in your project.

What does Psr Autoloading Knowledge need to run?

Going by SKILL.md and its folder, Psr Autoloading Knowledge needs the command-line tools its instructions call (composer and php).

Does Psr Autoloading 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 Autoloading 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 Autoloading Knowledge use?

Psr Autoloading 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 Autoloading Knowledge use?

About 2.1k tokens (SKILL.md is roughly 8.6k 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.7k tokens, read only when the agent opens those files.

What are the alternatives to Psr Autoloading Knowledge?

Skills that share tags, products or a category with Psr Autoloading Knowledge: Ima Knowledge Base (countbot-ai/CountBot, 784 stars), Hypatia (MarchLiu/hypatia, 239 stars), Migrate (guhcostan/claude-mega-brain, 126 stars) and Siyuan (Tommy-yw/RunbookHermes, 546 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Psr Autoloading Knowledge?

dykyi-roman (a GitHub user) maintains it in dykyi-roman/awesome-claude-code, which has 104 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.