johnnystefan/test-saas-business/pattern-composite

Claude Code and agent skill by johnnystefan/test-saas-business

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Teaches and applies the Composite structural design pattern — composing objects into tree structures to represent part-whole hierarchies, treating individual and composite objects uniformly. Trigger: When working with tree hierarchies, nested components, or recursive structures.

Install

npx vskill@latest install johnnystefan/test-saas-business/pattern-composite

SKILL.md

The same SKILL.md was published earlier as johnnystefan/test-saas-business/pattern-composite.

Skill: Implement Composite Pattern

Purpose

Composes objects into tree structures to represent part-whole hierarchies. It lets clients treat individual objects and compositions of objects uniformly.

Procedural Instructions

  1. Identify Tree Structure: Ensure your model can be represented as a tree (e.g., File system, UI components).
  2. Define Component Interface: Declare common operations for both simple and complex elements.
  3. Implement Leaf: Create classes for basic elements that have no children.
  4. Implement Composite: Create container classes that store child components and delegate work to them.

TypeScript Example

typescript
interface Component {
execute(): string;
}
class Leaf implements Component {
execute() {
return 'Leaf';
}
}
class Composite implements Component {
private children: Component[] = [];
add(c: Component) {
this.children.push(c);
}
execute(): string {
const results = this.children.map((child) => child.execute());
return `Branch(${results.join('+')})`;
}
}

Payoff

  • Polymorphism: Clients work with complex structures as if they were single objects.
  • Flexibility: Easy to add new element types to the tree.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/johnnystefan/test-saas-business/pattern-composite/badge)](https://verified-skill.com/skills/johnnystefan/test-saas-business/pattern-composite)

Something wrong with this skill or its page? Tell us.