From harness-claude
Implements Template Method pattern in JavaScript: define algorithm skeleton in base class, let subclasses override specific steps. Use for shared structures with varying steps.
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeThis skill uses the workspace's default tool permissions.
> Define the skeleton of an algorithm in a base class and let subclasses override specific steps
Implements Template Method pattern: define algorithm skeleton in base class with abstract steps overridden by subclasses. Use for data importers, parsers, report generators to avoid duplication.
Generates Template Method pattern for PHP 8.4: abstract algorithm skeleton with customizable steps, concrete implementations, hooks, optional value objects, and unit tests. For reusable algorithms with variants like data processing.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
Define the skeleton of an algorithm in a base class and let subclasses override specific steps
class DataProcessor {
process(data) {
const validated = this.validate(data);
const transformed = this.transform(validated);
return this.format(transformed);
}
validate(data) {
return data;
} // default: no-op
transform(data) {
throw new Error('Subclass must implement transform()');
}
format(data) {
return JSON.stringify(data);
} // default: JSON
}
class CSVProcessor extends DataProcessor {
transform(data) {
return data.map((row) => row.join(','));
}
format(data) {
return data.join('\n');
}
}
The Template Method pattern uses inheritance to vary parts of an algorithm. The base class defines the algorithm's skeleton, and subclasses fill in the blanks. This is the inverse of the Strategy pattern — Template Method uses inheritance, Strategy uses composition.
Trade-offs:
When NOT to use:
https://patterns.dev/javascript/template-method-pattern