johnnystefan/test-saas-business/pattern-visitor

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 Visitor behavioral design pattern — separating an algorithm from the object structure it operates on, enabling new operations without modifying existing classes. Trigger: When adding operations to a stable class hierarchy without modifying those classes.

Install

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

SKILL.md

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

Skill: Implement Visitor Pattern

Purpose

Separates an algorithm from the object structure on which it operates, allowing you to add new operations to existing object structures without modifying them.

Procedural Instructions

  1. Declare Visitor Interface: Define a "visit" method for each class in the object structure.
  2. Declare Element Interface: Add an accept(visitor) method to the base of the object structure.
  3. Implement Accept in Elements: Each concrete class calls the visitor method corresponding to its own class (Double Dispatch).
  4. Implement Concrete Visitors: Create a class for each new operation that needs to be performed across the object structure.

TypeScript Example

typescript
interface Shape {
accept(v: Visitor): void;
}
class Circle implements Shape {
accept(v: Visitor) {
v.visitCircle(this);
}
}
interface Visitor {
visitCircle(c: Circle): void;
visitRectangle(r: Rectangle): void;
}
class XMLExportVisitor implements Visitor {
visitCircle(c: Circle) {
console.log('Exporting Circle to XML...');
}
visitRectangle(r: Rectangle) {
/* ... */
}
}

Payoff

  • OCP: Add new behaviors that work with objects of different classes without changing those classes.
  • SRP: Moves multiple versions of the same behavior into a single Visitor class.

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-visitor/badge)](https://verified-skill.com/skills/johnnystefan/test-saas-business/pattern-visitor)

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