docs: document factory pattern for model reuse (#650)#652
Conversation
Add documentation for the input-driven factory pattern where one model definition creates multiple named instances via workflow steps. Covers model definition with inputs schema, the name-to-data-name connection, create/delete workflow snippets, and how globalArgument expressions are selectively evaluated (not all inputs required for every method). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Adversarial Review
Critical / High
None.
Medium
None.
Low
None.
Verdict
PASS — This PR contains only documentation changes (Markdown skill reference files). No executable code is modified. The internal cross-references between the skill files are correctly formed. The YAML examples in the documentation are illustrative and consistent with the documented patterns elsewhere in the skill files.
No security, logic, error handling, concurrency, or resource management issues can exist in documentation-only changes.
There was a problem hiding this comment.
Review Summary
This is a well-structured documentation-only PR that adds the Factory Pattern for Model Reuse scenario to the swamp-model and swamp-workflow skills. The content closes #650.
Blocking Issues
None - This PR is ready to merge.
Analysis
Code Style (N/A - Documentation Only)
- No TypeScript code changes, so no strict mode or type violations
- No
anytypes introduced - No unit tests required for documentation
Content Quality
- Clear decision tree for when to use factory vs separate models
- Comprehensive YAML examples for create and delete workflows
- Well-documented explanation of the
instanceName→nameglobalArgument → data instance keying relationship - Helpful tables summarizing input requirements and CEL paths
- Key insight about selective evaluation of globalArguments is clearly explained
Cross-References
SKILL.md:173-175correctly referencesreferences/scenarios.md#scenario-5-factory-pattern-for-model-reusedata-chaining.mdcorrectly references../../swamp-model/references/scenarios.md#scenario-5-factory-pattern-for-model-reuse- Both relative paths resolve correctly given the skill directory structure
Domain-Driven Design
Documentation aligns with DDD principles:
- Clear separation between model definition (template) and data instances (identities)
- The factory pattern uses
instanceNameas the identity key, properly explained - Lifecycle documentation (create/delete) is consistent and thorough
Suggestions (Non-blocking)
- Minor: The delete workflow example includes all inputs (
cidrBlock,availabilityZone) even though the text explains they may be optional. This is actually good for completeness, and the table below clearly explains what's required vs optional.
LGTM - well-documented pattern that will help users understand model reuse!
Summary
swamp-model/references/scenarios.md— covers when to use factory vs separate models, model definition with inputs schema, thename↔ data name connection, create/delete workflow snippets, and input requirements for deleteswamp-workflow/references/data-chaining.md— covers calling one model multiple times, referencing factory instance data downstream, and delete step requirements with before/after examplesswamp-model/SKILL.mdafter the Model Inputs Schema sectionKey insight documented: globalArgument expressions are selectively evaluated — inputs not provided are skipped, and a runtime error only occurs if the method code actually tries to access an unresolved globalArgument. Delete steps always need
instanceName(to key the data instance) but other create-time inputs are only required if the delete method implementation accesses them.Closes #650
Test plan
🤖 Generated with Claude Code