From acc
Generates PSR-compliant PHP components like loggers (PSR-3), caches (PSR-6/16), HTTP messages/factories/clients (PSR-7/17/18), containers (PSR-11), events (PSR-14), middleware (PSR-15), links (PSR-13), clocks (PSR-20), with unit tests.
How this command is triggered — by the user, by Claude, or both
Slash command
/acc:generate-psr <psr-number> <ComponentName> [-- additional instructions]sonnetThis command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# Generate PSR Component Generate PHP-FIG compliant PSR implementations with tests. ## Input Parsing Parse `$ARGUMENTS` to extract PSR number, component name, and optional meta-instructions: **Parsing rules:** 1. First part = **PSR number** (required: psr-3, psr-6, psr-7, etc.) 2. Second part = **Component name** (optional for some PSRs) 3. After ` -- ` = **meta-instructions** (optional customizations) ## Supported PSRs | PSR | Name | Components Generated | |-----|------|---------------------| | **psr-3** | Logger Interface | LoggerInterface, AbstractLogger, LogLevel | | **psr-6** |...
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
npx claudepluginhub dykyi-roman/awesome-claude-code --plugin acc/express-api-scaffoldGenerates production-ready Express.js REST API boilerplate with TypeScript, JWT auth, Prisma/TypeORM database, Zod validation, Jest tests, and Docker. Accepts project name and --database, --auth flags.
/f5-backendGenerates backend code like modules, services, controllers, entities, models for auto-detected stack (NestJS default; also FastAPI, Spring Boot, Go Gin, Django, Laravel, Rails, .NET Core, Rust Actix).
/generate-grpc-serviceGenerates production-ready gRPC services with Protocol Buffers, including proto definitions, server/client implementations, interceptors, TLS config, and API docs for multiple languages.
/do-patternsRuns interactive wizard to select Cloudflare Durable Objects pattern matching use case, scale, persistence, and queries; generates code and deployment guidance.
/generateGenerates API clients from OpenAPI specs, data models from JSON schemas, test suites from code, and database migrations from models. Supports TypeScript, Python, Go, Java, C#.
/fire-scaffoldGuided multi-step wizard that scaffolds features and components — React components, API endpoints, database models, pages, hooks, services, and tests — with consistent structure and conventions within an active phase.