Skip to content

Refactor section examples from classes to factory functions#8

Merged
andreisavu merged 1 commit intomainfrom
claude/update-readme-home-sections-QJYLg
Jan 27, 2026
Merged

Refactor section examples from classes to factory functions#8
andreisavu merged 1 commit intomainfrom
claude/update-readme-home-sections-QJYLg

Conversation

@andreisavu
Copy link
Member

Summary

Updated README documentation examples to use factory functions instead of class-based approaches for creating MarkdownSection instances. This simplifies the API and makes the examples more concise and easier to understand.

Changes

  • GameRulesSection: Converted from a class inheriting MarkdownSection to a build_game_rules_section() factory function
  • HintsSection: Converted from a class inheriting MarkdownSection to a build_hints_section() factory function
  • LuckyDiceSection: Converted from a class inheriting MarkdownSection to a build_lucky_dice_section() factory function

Details

All three examples now demonstrate direct instantiation of MarkdownSection[EmptyParams] via factory functions rather than requiring users to create custom subclasses. This approach:

  • Reduces boilerplate code in documentation
  • Makes it clearer that sections can be created without inheritance
  • Maintains all functionality including tool attachment, policies, and visibility settings
  • Provides a more straightforward pattern for users to follow in their own code

https://claude.ai/code/session_01EFFbwQAFBquperwEXsAmHd

The code examples in sections 3, 4, and 4.1 showed sections as subclasses
(e.g., class GameRulesSection) but the actual implementation uses factory
functions (e.g., build_game_rules_section()). Updated the README to match
the current implementation pattern.

https://claude.ai/code/session_01EFFbwQAFBquperwEXsAmHd
@andreisavu andreisavu merged commit 717608a into main Jan 27, 2026
1 check passed
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.

2 participants