本文へ移動
cccskills
無料GitHub で公開

solid

Apply SOLID principles to write flexible, maintainable, and testable code. Use when designing classes, interfaces, and module boundaries. Covers Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion with practical TypeScript examples and detection heuristics.

インストール方法を見る

含まれるファイル(2)

  • SKILL.md4.2 KB
  • references/PRINCIPLES.md11.5 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

SOLID Principles

Five principles for building software that is easy to understand, extend, and maintain. They reduce coupling, increase cohesion, and make code testable.

When to Apply

Reference these principles when:

  • Designing new classes, modules, or interfaces
  • Refactoring code with too many responsibilities
  • Reviewing PRs for architectural concerns
  • Breaking apart god objects or fat interfaces
  • Deciding where to draw module boundaries
  • Making code more testable

Quick Reference

PrincipleOne-LinerRed Flag
SRPOne reason to change"This class handles X and Y and Z"
OCPAdd, don't modifyGrowing if/else or switch chains for types
LSPSubtypes are substitutableType-checking or special-casing in calling code
ISPSmall, focused interfacesEmpty method implementations or throw new Error("Not implemented")
DIPDepend on abstractionsnew ConcreteClass() inside business logic

See references/PRINCIPLES.md for detailed explanations and TypeScript examples.

Detection Checklist

Ask these questions for every class and module:

QuestionViolated Principle
Does this class have multiple reasons to change?SRP
Do I need to modify existing code to add a new variant?OCP
Does calling code need type-checks or special cases for subtypes?LSP
Are implementors forced to stub out unused methods?ISP
Does high-level logic directly instantiate infrastructure?DIP

Applying SOLID at Different Scales

ScaleSRPOCPLSPISPDIP
FunctionDoes one thing———Takes abstractions as params
ClassOne reason to changeExtend via compositionSubtypes honor contractsImplements only what it usesConstructor injection
ModuleOne bounded contextPlugin architectureInterchangeable implementationsThin public APIDepends inward
ServiceSingle domainNew features = new servicesAPI contract stabilityMinimal API surfaceAbstractions at boundaries

Relationships Between Principles

  • SRP + ISP: Splitting responsibilities often means splitting interfaces too
  • OCP + DIP: Depending on abstractions is what makes extension without modification possible
  • LSP + OCP: If subtypes are substitutable, you can extend behavior by adding new subtypes
  • DIP + ISP: Small focused interfaces make dependency inversion practical

Common Anti-Patterns

Anti-PatternViolated PrinciplesFix
God class doing everythingSRPExtract focused classes
switch on type across codebaseOCP, LSPReplace with polymorphism
Subclass that throws "not supported"LSP, ISPRedesign hierarchy, split interface
Fat interface with 20 methodsISPSplit into role-based interfaces
Business logic importing DB driverDIPInject repository interface
Service creating its own dependenciesDIPConstructor injection

Best Practices

DO

  • Start with SRP — it's the foundation for all others
  • Use interfaces to define boundaries between components
  • Let violations emerge from real problems, then fix them
  • Prefer composition over inheritance for extending behavior
  • Keep interfaces small and role-specific
  • Inject dependencies through constructors

DON'T

  • Apply SOLID dogmatically to trivial code (a 5-line utility doesn't need an interface)
  • Create abstractions before you have at least two implementations
  • Confuse SRP with "single method" — it's about reasons to change, not size
  • Force Liskov compliance on classes that shouldn't be in the same hierarchy
  • Over-segregate interfaces into single-method fragments when a cohesive group makes sense

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.

日本語の概要は準備中です。原文の説明を表示しています。

fellipeutaka/denji62026年8月3日 更新

Set up and optimize repositories for AI coding agents. Creates minimal AGENTS.md, CLAUDE.md symlink, docs/REQUIREMENTS.md, docs/BUSINESS-RULES.md, feedback loops, and deterministic enforcement (Claude Code hooks, OpenCode plugins). Use when user wants to make a repo AI-friendly, set up AGENTS.md/CLAUDE.md, document requirements/business rules for AI, add pre-commit hooks for AI workflows, or optimize codebase structure for coding agents.

日本語の概要は準備中です。原文の説明を表示しています。

fellipeutaka/denji62026年8月3日 更新

bun

無料

Bun runtime, package manager, bundler, and test runner. Use when running scripts with bun, managing packages, serving HTTP with Bun.serve, querying databases with Bun.sql/bun:sqlite/Bun.redis, shell scripting with $, using S3/file I/O, writing tests with bun:test, bundling or compiling to executable, or using any Bun-specific API (spawn, glob, semver, FFI, workers, plugins, HTMLRewriter).

日本語の概要は準備中です。原文の説明を表示しています。

fellipeutaka/denji62026年8月3日 更新

Write clean, readable, and maintainable code following principles from Robert C. Martin's "Clean Code" and Object Calisthenics. Use when writing, reviewing, or refactoring code to improve naming, function design, formatting, error handling, and class structure. Includes code smell detection and refactoring guidance.

日本語の概要は準備中です。原文の説明を表示しています。

fellipeutaka/denji62026年8月3日 更新

Create high-quality git commits: review/stage intended changes, split into logical commits, and write clear commit messages (including Conventional Commits). Use when the user asks to commit, craft a commit message, stage changes, or split work into multiple commits.

日本語の概要は準備中です。原文の説明を表示しています。

fellipeutaka/denji62026年8月3日 更新

denji

無料

Manage SVG icons as framework components using Denji CLI. Use when the user needs to add, remove, list, export, import, or manage SVG icons in React, Preact, Solid, Qwik, Vue, or Svelte projects. Triggers include requests to "add an icon", "set up icons", "manage SVG icons", "remove an icon", "list icons", "export icons", "import icons", "dry-run icon add", or any task involving Iconify icons as framework components.

日本語の概要は準備中です。原文の説明を表示しています。

fellipeutaka/denji62026年8月3日 更新

fellipeutaka のスキルをすべて見る

このスキルの問題を報告する