/acc:generate-psr <psr-number> <ComponentName> [-- additional instructions]from acc
Generates PHP-FIG PSR-compliant implementations including loggers, caches, HTTP messages, containers, event dispatchers, middleware, links, and clocks, with tests and usage examples.
Ships in acc. Installing the plugin adds it to Claude Code.
Generate PHP-FIG compliant PSR implementations with tests.
Parse $ARGUMENTS to extract PSR number, component name, and optional meta-instructions:
Format: <psr-number> <ComponentName> [-- <meta-instructions>]
Examples:
- /acc:generate-psr psr-3 FileLogger
- /acc:generate-psr psr-15 AuthMiddleware
- /acc:generate-psr psr-6 RedisCache -- with TTL support
- /acc:generate-psr psr-7 -- generate full HTTP stack
Parsing rules:
-- = meta-instructions (optional customizations)| PSR | Name | Components Generated |
|---|---|---|
| psr-3 | Logger Interface | LoggerInterface, AbstractLogger, LogLevel |
| psr-6 | Caching Interface | CacheItemPoolInterface, CacheItemInterface |
| psr-7 | HTTP Message | Request, Response, Uri, Stream, ServerRequest |
| psr-11 | Container Interface | ContainerInterface, NotFoundExceptionInterface |
| psr-13 | Hypermedia Links | LinkInterface, EvolvableLinkInterface |
| psr-14 | Event Dispatcher | EventDispatcherInterface, StoppableEventInterface |
| psr-15 | HTTP Handlers | RequestHandlerInterface, MiddlewareInterface |
| psr-16 | Simple Cache | CacheInterface, InvalidArgumentException |
| psr-17 | HTTP Factories | RequestFactoryInterface, ResponseFactoryInterface |
| psr-18 | HTTP Client | ClientInterface, ClientExceptionInterface |
| psr-20 | Clock | ClockInterface |
Verify valid PSR number:
Check project structure:
composer.json for namespace configurationUse the acc:psr-generator agent to generate PSR-compliant components:
Task tool with subagent_type="acc:psr-generator"
prompt: "Generate [PSR] implementation for [COMPONENT_NAME]. [META-INSTRUCTIONS if provided]
Requirements:
1. PHP 8.4 with declare(strict_types=1)
2. PSR-12 coding style
3. Final readonly classes where appropriate
4. Constructor property promotion
5. Include unit tests
6. Include usage examples
Target structure:
src/Infrastructure/{Component}/
├── {Interface}Interface.php
├── {Implementation}.php
└── Exception/
└── {Component}Exception.php
tests/Unit/Infrastructure/{Component}/
└── {Implementation}Test.php"
/acc:generate-psr psr-3 FileLogger
/acc:generate-psr psr-3 JsonLogger -- with context processors
Generates:
LoggerInterface implementation/acc:generate-psr psr-6 RedisCache
/acc:generate-psr psr-6 ArrayCache -- for testing
Generates:
CacheItemPoolInterface implementationCacheItem class/acc:generate-psr psr-7
/acc:generate-psr psr-7 -- with uploaded files support
Generates:
/acc:generate-psr psr-11 SimpleContainer
/acc:generate-psr psr-11 -- with auto-wiring
Generates:
ContainerInterface implementation/acc:generate-psr psr-14 EventDispatcher
/acc:generate-psr psr-14 -- with prioritized listeners
Generates:
EventDispatcherInterface implementation/acc:generate-psr psr-15 AuthMiddleware
/acc:generate-psr psr-15 CorsMiddleware
/acc:generate-psr psr-15 RateLimitMiddleware
Generates:
MiddlewareInterface implementation/acc:generate-psr psr-16 MemoryCache
/acc:generate-psr psr-16 FileCache -- with serialization
Generates:
CacheInterface implementation/acc:generate-psr psr-17
/acc:generate-psr psr-17 -- with PSR-7 integration
Generates:
/acc:generate-psr psr-18 GuzzleAdapter
/acc:generate-psr psr-18 CurlClient
Generates:
ClientInterface implementation/acc:generate-psr psr-20 SystemClock
/acc:generate-psr psr-20 FrozenClock -- for testing
Generates:
ClockInterface implementationGenerated PSR-15 Middleware: AuthMiddleware
Files created:
├── src/Infrastructure/Http/Middleware/
│ ├── AuthMiddleware.php
│ └── Exception/
│ └── UnauthorizedException.php
└── tests/Unit/Infrastructure/Http/Middleware/
└── AuthMiddlewareTest.php
<?php
declare(strict_types=1);
namespace App\Infrastructure\Http\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
final readonly class AuthMiddleware implements MiddlewareInterface
{
public function __construct(
private TokenValidatorInterface $tokenValidator,
) {
}
public function process(
ServerRequestInterface $request,
RequestHandlerInterface $handler,
): ResponseInterface {
// Implementation...
}
}
// DI Container configuration
$container->set(MiddlewareInterface::class, AuthMiddleware::class);
// Usage in middleware pipeline
$pipeline->pipe(new AuthMiddleware($tokenValidator));
/acc:generate-psr psr-7 -- HTTP messages
/acc:generate-psr psr-17 -- factories
/acc:generate-psr psr-15 Pipeline -- middleware
/acc:generate-psr psr-18 HttpClient
/acc:generate-psr psr-6 RedisPool -- full cache with pools
# or
/acc:generate-psr psr-16 SimpleRedis -- simple get/set
/acc:generate-psr psr-3 AppLogger
/acc:generate-psr psr-11 Container
/acc:generate-psr psr-14 EventBus
/acc:generate-psr psr-20 Clock
/acc:generate-psr psr-3 FileLogger
/acc:generate-psr psr-15 AuthMiddleware
/acc:generate-psr psr-6 RedisCache -- with TTL and tags support
/acc:generate-psr psr-7 -- generate complete HTTP message stack
/acc:generate-psr psr-20 FrozenClock -- for unit testing time-dependent code
What the command file sets; muted values are Claude Code's defaults
sonnet7-day visitors to each command page
npx claudepluginhub dykyi-roman/awesome-claude-code --plugin acc26 commands in this plugin
/audit-architectureArchitecture Audit CommandComprehensive architecture audit with pattern recommendations. Detects DDD, CQRS, Clean/Hexagonal/Layered Architecture, Event Sourcing, EDA, Outbox, Saga, Stability, GoF Structural (Adapter, Facade, Proxy, Composite, Bridge, Flyweight), and Behavioral (Strategy, State, Chain, Decorator, Null Object, Template Method, Visitor, Iterator, Memento) patterns. Provides actionable recommendations with links to generation skills./audit-ciCI/CD AuditComprehensive CI/CD audit. Analyzes pipeline structure, security, performance, and best practices compliance./audit-Other plugins' commands for the same job