dykyi-roman/awesome-claude-code/create-flyweight
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Generates Flyweight pattern for PHP 8.4. Optimizes memory via shared intrinsic state. Includes unit tests.
Install
npx vskill@latest install dykyi-roman/awesome-claude-code/create-flyweightSKILL.md
Flyweight Pattern Generator
Creates Flyweight pattern infrastructure for memory optimization through object sharing.
When to Use
| Scenario | Example | |
|---|---|---|
| Large number of similar objects | Icons, glyphs, particles | |
| Memory constraints | Mobile apps, embedded systems | |
| Immutable shared state | Currency codes, tax rates | |
| Performance optimization | Reduce object creation overhead |
Component Characteristics
Flyweight Interface
- Defines operations
- Accepts extrinsic state as parameters
ConcreteFlyweight
- Stores intrinsic state (shared)
- Immutable
- Reusable across contexts
FlyweightFactory
- Creates and manages flyweights
- Returns existing or new flyweight
- Ensures sharing
Generation Process
Step 1: Generate Flyweight Interface
Path: src/Domain/{BoundedContext}/
{Name}Interface.php— Operations contract
Step 2: Generate ConcreteFlyweight
Path: src/Domain/{BoundedContext}/
{Name}Flyweight.php— Shared object
Step 3: Generate FlyweightFactory
Path: src/Domain/{BoundedContext}/Factory/ or src/Infrastructure/
{Name}FlyweightFactory.php— Manages flyweights
Step 4: Generate Tests
{ClassName}Test.php— Flyweight behavior and sharing verification
File Placement
| Component | Path | |
|---|---|---|
| Flyweight Interface | src/Domain/{BoundedContext}/ | |
| ConcreteFlyweight | src/Domain/{BoundedContext}/ | |
| FlyweightFactory | src/Domain/{BoundedContext}/Factory/ | |
| Unit Tests | tests/Unit/Domain/{BoundedContext}/ |
Naming Conventions
| Component | Pattern | Example | |
|---|---|---|---|
| Flyweight Interface | {Name}Interface | CurrencyInterface | |
| ConcreteFlyweight | {Name}Flyweight | CurrencyFlyweight | |
| FlyweightFactory | {Name}FlyweightFactory | CurrencyFlyweightFactory | |
| Test | {ClassName}Test | CurrencyFlyweightTest |
Quick Template Reference
Flyweight
FlyweightFactory
Usage Example
Common Flyweights
| Flyweight | Purpose | |
|---|---|---|
| CurrencyFlyweight | Currency codes and symbols | |
| IconFlyweight | UI icons | |
| TaxRuleFlyweight | Tax rates by region | |
| CharacterFlyweight | Text rendering glyphs | |
| ColorFlyweight | Color palettes |
Anti-patterns to Avoid
| Anti-pattern | Problem | Solution | |
|---|---|---|---|
| Mutable Flyweight | State changes affect all users | Make flyweights immutable | |
| No Factory | Manual object management | Use flyweight factory | |
| Large Intrinsic State | Memory not optimized | Keep intrinsic state minimal | |
| Extrinsic in Flyweight | Not reusable | Pass extrinsic via parameters | |
| Premature Optimization | Complexity without benefit | Profile first |
References
For complete PHP templates and examples, see:
references/templates.md— Flyweight, factory templatesreferences/examples.md— Currency, icon, tax rule flyweights with unit tests
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/create-flyweight/SKILL.md
Popularity
- Repository stars
- 96
- Repository forks
- 25
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dykyi-roman/awesome-claude-code/create-flyweight)