Skip to main content

best-practices

Read when adding a new function, module, or component, or when a file is growing large enough that splitting it is worth considering. Covers SOLID design principles, minimal interfaces, composition over inheritance, and the size and complexity limits for functions, files, and nesting depth.

ソース情報

リポジトリ
lightly-ai/lightly-studio
ソースの最終更新活動
2026年8月5日 08:10
検出された SKILL.md の言語
英語
スター
896
フォーク
40

インストール方法

デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。

ソースファイルを確認

インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。

SKILL.md を表示中

SKILL.md
ソースの指示 · 読み取り専用プレビュー
name
best-practices
description
Read when adding a new function, module, or component, or when a file is growing large enough that splitting it is worth considering. Covers SOLID design principles, minimal interfaces, composition over inheritance, and the size and complexity limits for functions, files, and nesting depth.
# Best Practices ## Design Principles Apply SOLID principles to create maintainable, scalable components. ### Single Responsibility A function or module should have one reason to change. If it has two, split it. Do not mix data fetching, business logic and presentation in the same component. Small files are welcome. ### Minimal Interfaces Components should only accept the data that they actually use. Avoid passing entire objects when a few fields suffice. Create an abstracted interface that only exposes what the component needs. ### Composition over Inheritance Don't create deep class hierarchies. Build complex behavior by combining small, focused units. Use dependency injection and dependency inversion. ## Managing Complexity ### Split Large Units When adding new code, always consider splitting the logic into a new function, component or a file. As a rule of thumb: - Functions should be under 20 lines - Files should be under 400 lines ### Reducing Complexity Keep logic easy to understand by reducing horizontal, vertical and cyclomatic complexity. As a rule of thumb: - **Nesting depth** should be under 3 levels - use early returns to flatten - **Conditional branches** per function should be limited - extract complex logic into separate functions - **Extract helper variables** instead of writing complex inline expressions
GitHubで見る