OpenSPDD uses a GenerationStrategy interface to handle different ways AI tools consume generated content. Instead of a single hardcoded dispatch logic, the system uses a registry of strategies keyed by AIToolType.
When you run generation commands, the system selects a strategy based on the detected tool. This allows different tools to have different 'archetypes' (file structures and formats):
- FlatMarkdownStrategy: Used for tools that expect standard markdown files.
- CopilotInstructionFileStrategy: Used for GitHub Copilot, which requires specific instruction file structures.
- CodexSkillStrategy: Used for OpenAI Codex, which generates project-scoped skill bundles in
<repo>/.agents/skills/<id>/SKILL.md and may also emit an agents/openai.yaml file.
Every strategy must implement the GenerationStrategy interface, which provides two primary methods: GenerateAll (for bulk generation) and GenerateOne (for single template generation).
type GenerationStrategy interface {
GenerateAll(workingDir string, force bool) []GenerateResult
GenerateOne(workingDir string, tmpl TemplateMeta, force bool) []GenerateResult
}