Skip to content

docs: document factory pattern for model reuse (#650)#652

Merged
stack72 merged 1 commit intomainfrom
docs/factory-pattern-650
Mar 8, 2026
Merged

docs: document factory pattern for model reuse (#650)#652
stack72 merged 1 commit intomainfrom
docs/factory-pattern-650

Conversation

@stack72
Copy link
Contributor

@stack72 stack72 commented Mar 8, 2026

Summary

  • Add Scenario 5: Factory Pattern for Model Reuse to swamp-model/references/scenarios.md — covers when to use factory vs separate models, model definition with inputs schema, the name ↔ data name connection, create/delete workflow snippets, and input requirements for delete
  • Add Factory Model Patterns section to swamp-workflow/references/data-chaining.md — covers calling one model multiple times, referencing factory instance data downstream, and delete step requirements with before/after examples
  • Add brief pointer in swamp-model/SKILL.md after the Model Inputs Schema section

Key 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

  • Documentation-only change, no code modified
  • Verified all anchor links resolve within the files
  • Verified line counts stay reasonable (SKILL.md: 550 lines)

🤖 Generated with Claude Code

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>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 any types 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 instanceNamename globalArgument → 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-175 correctly references references/scenarios.md#scenario-5-factory-pattern-for-model-reuse
  • data-chaining.md correctly 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 instanceName as the identity key, properly explained
  • Lifecycle documentation (create/delete) is consistent and thorough

Suggestions (Non-blocking)

  1. 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!

@stack72 stack72 merged commit 09e423d into main Mar 8, 2026
6 checks passed
@stack72 stack72 deleted the docs/factory-pattern-650 branch March 8, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document factory pattern for model reuse in skills

1 participant