/acc:create-template-methodfrom acc
Generates Template Method pattern for PHP 8.4 with abstract algorithm skeleton, customizable steps, and unit tests. Useful for creating reusable algorithm structures with controlled extension points.
Ships in acc. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Creates Template Method pattern infrastructure for algorithm skeletons with customizable steps.
| Scenario | Example |
|---|---|
| Common algorithm structure | Data import/export with format variations |
| Controlled extension points | Report generation with customizable sections |
| Code reuse across variants | Order processing with type-specific steps |
| Invariant parts protection | Template rendering with hooks |
Path: src/Domain/{BoundedContext}/Template/
Abstract{Name}Template.php — Algorithm skeleton with template methodPath: src/Domain/{BoundedContext}/Template/ or src/Application/{BoundedContext}/
{Variant1}{Name}Template.php — First variant implementation{Variant2}{Name}Template.php — Second variant implementation{Variant3}{Name}Template.php — Third variant implementationPath: src/Domain/{BoundedContext}/ValueObject/
{Name}Result.php — Result value object{Name}Config.php — Configuration value object{Variant}{Name}TemplateTest.php — Individual template testsAbstract{Name}TemplateTest.php — Template skeleton tests| Component | Path |
|---|---|
| Abstract Template | src/Domain/{BoundedContext}/Template/ |
| Concrete Templates (Domain logic) | src/Domain/{BoundedContext}/Template/ |
| Concrete Templates (App logic) | src/Application/{BoundedContext}/ |
| Unit Tests | tests/Unit/Domain/{BoundedContext}/Template/ |
| Component | Pattern | Example |
|---|---|---|
| Abstract | Abstract{Name}Template | AbstractDataImporterTemplate |
| Concrete | {Variant}{Name}Template | CsvDataImporterTemplate |
| Template Method | execute() or process() | execute() |
| Hook Method | before{Step}(), after{Step}() | beforeValidation() |
| Test | {ClassName}Test | CsvDataImporterTemplateTest |
abstract readonly class Abstract{Name}Template
{
public function execute({InputType} $input): {OutputType}
{
$this->validate($input);
$data = $this->extract($input);
$transformed = $this->transform($data);
$result = $this->load($transformed);
$this->afterLoad($result);
return $result;
}
abstract protected function extract({InputType} $input): array;
abstract protected function transform(array $data): array;
protected function validate({InputType} $input): void
{
// Default validation
}
protected function afterLoad({OutputType} $result): void
{
// Hook method - optional override
}
}
final readonly class {Variant}{Name}Template extends Abstract{Name}Template
{
protected function extract({InputType} $input): array
{
// Variant-specific extraction
}
protected function transform(array $data): array
{
// Variant-specific transformation
}
}
// Create templates for different formats
$csvImporter = new CsvDataImporterTemplate();
$jsonImporter = new JsonDataImporterTemplate();
$xmlImporter = new XmlDataImporterTemplate();
// Use same interface
$result = $csvImporter->execute($fileContent);
| Domain | Variants |
|---|---|
| Data Import | CSV, JSON, XML, Excel |
| Report Generation | PDF, Excel, HTML, Email |
| Order Processing | Standard, Express, International |
| Document Rendering | Markdown, LaTeX, HTML |
| Payment Flow | Card, Bank Transfer, Digital Wallet |
| Anti-pattern | Problem | Solution |
|---|---|---|
| Too many abstract methods | Hard to implement | Use hook methods with defaults |
| Public template steps | Breaks encapsulation | Make steps protected/private |
| Mutable state | Side effects | Use readonly classes, pass data |
| Deep inheritance | Complexity | Limit to 2-3 levels max |
| Breaking LSP | Inconsistent behavior | Maintain contract in overrides |
For complete PHP templates and examples, see:
references/templates.md — Abstract Template, Concrete Template, Hook Methods templatesreferences/examples.md — DataImporter, ReportGenerator, OrderProcessor with testsWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub dykyi-roman/awesome-claude-code --plugin acc283 skills in this plugin
/access-control-knowledgeAccess Control knowledge base. Provides ACL, RBAC, ABAC, ReBAC models, multi-tenancy patterns, and PHP implementations (Symfony Voters, Laravel Gates) for security audits and generation./adr-knowledgeAction-Domain-Responder pattern knowledge base. Provides patterns, antipatterns, and PHP-specific guidelines for ADR (web-specific MVC alternative) audits./adr-templateGenerates Architecture Decision Records (ADR) for PHP projects. Creates structured decision documentation with context, decision, and consequences.Other plugins' skills for the same job