johnnystefan/test-saas-business/pattern-singleton

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 Singleton creational design pattern — ensuring a class has only one instance while providing a global access point to it. Trigger: When managing shared resources like database connections, config, or caches.

Install

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

SKILL.md

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

Skill: Implement Singleton Pattern

Purpose

Ensures that a class has only one instance while providing a global access point to that instance. Crucial for shared resources like database connections.

Procedural Instructions

  1. Private Constructor: Prevent direct instantiation with new.
  2. Static Field: Store the unique instance.
  3. Static Getter: Provide a method that initializes the instance (lazy loading) if it doesn't exist and returns it.

TypeScript Example

typescript
class Database {
private static instance: Database;
private constructor() {
// Init logic (e.g., connect to DB)
}
public static getInstance(): Database {
if (!Database.instance) {
Database.instance = new Database();
}
return Database.instance;
}
public query(sql: string) {
/* ... */
}
}

Payoff

  • Controlled Access: Strict control over a global resource.
  • Memory Savings: Avoids creating multiple heavy objects for the same task.

Security

  • Security scanPassed, 95 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-singleton/badge)](https://verified-skill.com/skills/johnnystefan/test-saas-business/pattern-singleton)

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