johnnystefan/test-saas-business/pattern-iterator

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 Iterator behavioral design pattern — providing sequential access to elements of a collection without exposing its internal representation. Trigger: When traversing complex data structures or building custom collection iterators.

Install

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

SKILL.md

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

Skill: Implement Iterator Pattern

Purpose

Provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation (list, stack, tree, etc.).

Procedural Instructions

  1. Declare Iterator Interface: Define methods for fetching the next() element and checking if there are hasMore() items.
  2. Declare Collection Interface: Define a method to createIterator().
  3. Implement Concrete Iterator: Encapsulate traversal logic and maintain the current position for a specific collection type.
  4. Implement Concrete Collection: Return a new instance of the appropriate iterator.

TypeScript Example

typescript
interface MyIterator<T> {
next(): T;
hasNext(): boolean;
}
class AlphabeticalIterator implements MyIterator<string> {
private position: number = 0;
constructor(private collection: string[]) {}
next(): string {
return this.collection[this.position++];
}
hasNext(): boolean {
return this.position < this.collection.length;
}
}
interface IterableCollection {
getIterator(): MyIterator<string>;
}

Payoff

  • Uniformity: Client code can work with various collections using a single iterator interface.
  • Clean Code: Moves bulky traversal algorithms out of business logic.

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

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