csharpfritz/squadui/vscode-optional-service-injection
Claude Code and agent skill by csharpfritz/squadui
- community
Checking that the SKILL.md file is still in the repository.
Pattern for VS Code tree views that consume optional services with graceful degradation
Install
npx vskill@latest install csharpfritz/squadui/vscode-optional-service-injectionSKILL.md
Context
VS Code tree views often need data from services that may not be available at activation time (e.g., API services requiring auth tokens, services built by other team members in parallel). The tree should work without the service and enhance when it becomes available.
Patterns
Late-Binding via Setter
Instead of requiring the service in the constructor, expose a setService() method. This allows the extension to wire the service when available without blocking tree view creation.
Guard + Try/Catch in Data Methods
When fetching optional data, check for service existence first, then wrap the call in try/catch to handle runtime failures (network errors, auth issues, etc.).
Interface-First Design
Define the contract in models (not in the service file) so consumers can compile without the concrete implementation existing yet.
Anti-Patterns
- Don't make the service a constructor requirement — breaks activation when service isn't ready
- Don't let service errors bubble up to
getChildren()— VS Code shows ugly error UI - Don't import the concrete service class in the tree provider — import the interface only
When to Use
- Tree view consumes data from an external API that may be offline
- Service is being built in parallel by another developer
- Service requires configuration (tokens, endpoints) that may not exist yet
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 repositoryChecking.ai-team/skills/vscode-optional-service-injection/SKILL.md
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
[](https://verified-skill.com/skills/csharpfritz/squadui/vscode-optional-service-injection)