php-agent-skills (guikingone/agent-skills) is a PHP library implementing the Agent Skills specification. It provides a framework-agnostic core for parsing, loading, validating, and evaluating SKILL.md-based agent skills, with an optional Symfony AI bridge.
Framework-agnostic. Defines interfaces and implementations for:
- Skill parsing:
SkillParserInterface/SkillParser— YAML frontmatter + Markdown body from SKILL.md files - Skill loading:
SkillLoaderInterfacewith three implementations:FilesystemSkillLoader— local directories via Symfony FinderGithubSkillLoader— GitHub Contents API (public/private repos, branches, tokens)ChainSkillLoader— composes multiple loaders, first-match-wins for individual skills
- Validation:
SkillValidatorInterface/SkillValidator— checks spec compliance (kebab-case name, required fields) - Evaluation (
src/Evaluation/):AgentExecutorInterface,LlmClientInterface,EvalRunner,LlmGrader,BenchmarkAggregator,WorkspaceManager
Optional integration with symfony/ai-agent. Provides:
SkillTool— exposes skills as Symfony AI tools via#[AsTool]attributesSkillInputProcessor— implementsInputProcessorInterface, injects skills into system promptSymfonyAgentExecutor— adaptsAgentInterfacetoAgentExecutorInterfaceSymfonyLlmClient— adaptsPlatformInterfacetoLlmClientInterfaceAgentSkillBundleExtension/AgentSkillsBundleConfiguration— Symfony DI bundle configuration- Console commands:
ai:agent:validate-skills,ai:agent:eval-skill
- Core must never import from
Symfony\AI\*— those live exclusively insrc/Bridge/Symfony/AI/ - Skills use closure-based resource loading for source-agnostic parsing (filesystem or GitHub content)
- Two discovery levels: Level 1 = metadata only (
discoverMetadata()), Level 2 = full content (loadSkill()) - When an
agentidentifier is set in bundle configuration, skills are auto-registered as tools — no separatetools.enabledflag
declare(strict_types=1);at the top of every file- PSR-4 autoloading:
AgentSkills\→src/,AgentSkills\Tests\→tests/ - Yoda-style comparisons:
null !== $value,[] === $array,'string' === $var - Static lambdas:
static fn () => ...(no$thisbinding) - Trailing commas in multiline arrays, arguments, and parameters
- Import all symbols at file level: classes, functions (
use function sprintf;), constants (use const PHP_BINARY;) - No FQCN in code: use
sprintf()not\sprintf(), useRuntimeExceptionnot\RuntimeException concat_space:'a' . 'b'(with spaces around.)
@Symfony+@Symfony:risky+@PHP82Migrationrulesetsphpdoc_align: left-alignednative_function_invocation: internal functions are imported and called without backslashstrict_comparison+strict_param: no loose comparisons orin_arraywithout strictno_superfluous_phpdoc_tags: remove unnecessary@param/@returnwhen type-hinted
- Tests mirror the
src/structure undertests/ - Bridge tests:
tests/Bridge/Symfony/AI/ - Test class suffix:
Test(e.g.,SkillParserTest) - Use PHPUnit 11.x with
TestCase
# Run tests
php vendor/bin/phpunit
# Fix code style
php vendor/bin/php-cs-fixer fix
# Check code style (dry-run)
php vendor/bin/php-cs-fixer fix --dry-run --diff
# Static analysis
php vendor/bin/phpstan analyze
# Regenerate autoloader (required after adding/moving files due to classmap-authoritative)
composer dump-autoloadcomposer.json has classmap-authoritative: true. After creating, moving, or deleting PHP files, always run symfony composer dump-autoload before running tests — otherwise new classes won't be found.
Three GitHub Actions workflows on main branch (push, PR, daily cron):
- PHPUnit: PHP 8.2–8.5, highest/lowest dependencies (PHP 8.2 uses
--ignore-platform-reqs) - PHP-CS-Fixer: same matrix,
--dry-runmode - PHPStan: same matrix, level 6, per-PHP-version config file (
phpstan.neon.{version}.dist)
- PHP >= 8.2
symfony/clock,symfony/filesystem,symfony/finder,symfony/http-client,symfony/string(^7.3|^8.0)
symfony/ai-agent^0.6.0 — needed only for Bridge compilation and testssymfony/config,symfony/console,symfony/dependency-injection— Symfony bundle testingphpunit/phpunit^11.5,phpstan/phpstan^2.1,php-cs-fixer^3.94,rector/rector^2.3
doc/usage.md— complete user guide (loaders, validation, evaluation, GitHub integration)doc/bundle.md— Symfony bundle configuration referencedoc/commands.md— console commands reference (ai:agent:eval-skill,ai:agent:validate-skills)examples/— runnable examples with sample skills inexamples/.skills/