simplicity-principles
БесплатноБез исполняемых скриптовНе проверенUse when designing solutions, adding features, or refactoring by applying KISS, YAGNI, and Principle of Least Astonishment to write simple, predictable code.
от TheBushidoCollective★ 202 звезды на GitHubОб этом скилле
Simplicity Principles
Write code that is simple, necessary, and unsurprising.
Three Core Principles
1. KISS - Keep It Simple, Stupid
Simple solutions are better than clever ones
What Simple Means
- Readable by developers of varying skill levels
- Fewer moving parts and abstractions
- Direct and obvious implementation
- Easy to debug and test
- Minimal cognitive load
Elixir Examples
# COMPLEX - Over-engineered
defmodule PaymentCalculator do
use GenServer
def start_link(_), do: GenServer.start_link(__MODULE__, %{}, name: __MODULE__)
def calculate(items), do: GenServer.call(__MODULE__, {:calculate, items})
def handle_call({:calculate, items}, _from, state) do
result = Enum.reduce(items, Money.new(:USD, 0), &Money.add(&2, &1.price))
{:reply, result, state}
end
end
# SIMPLE - Just a function
defmodule PaymentCalculator do
def calculate(items) do
Enum.reduce(items, Money.new(:USD, 0), &Money.add(&2, &1.price))
end
end
# Use GenServer only when you need state/concurrency
# COMPLEX - Unnecessary abstraction
defmodule UserQuery do
defmacro by_status(status) do
quote do
from u in User, where: u.status == ^unquote(status)
end
end
end
# SIMPLE - Direct query
def active_users do
from u in User, where: u.status == "active"
end
def inactive_users do
from u in User, where: u.status == "inactive"
end
# Macros only when you need metaprogramming
TypeScript Examples
// COMPLEX - Over-abstraction
class UserDataManager {
private dataSource: DataSource;
private cache: Cache;
private transformer: DataTransformer;
async getUser(id: string): Promise<User> {
const cached = await this.cache.get(id);
if (cached) return this.transformer.transform(cached);
const raw = await this.dataSource.fetch(id);
await this.cache.set(id, raw);
return this.transformer.transform(raw);
}
}
// SIMPLE - Direct approach
async function getUser(id: string): Promise<User> {
const response = await fetch(`/api/users/${id}`);
return response.json();
}
// Add cache/transform only when performance demands it
// COMPLEX - Clever but confusing
const isValid = (x: number) => !!(x >= 0 && x <= 100);
const process = (items: number[]) =>
items.filter(isValid).reduce((a, b) => a + b, 0);
// SIMPLE - Clear intent
function calculateTotal(scores: number[]): number {
const validScores = scores.filter(score => score >= 0 && score <= 100);
return validScores.reduce((sum, score) => sum + score, 0);
}
KISS Guidelines
- Prefer functions over classes (unless you need state)
- Prefer explicit over implicit
- Prefer boring over clever
- Prefer standard library over custom solutions
- Prefer clear names over short names
- Prefer straightforward logic over "elegant" one-liners
When NOT to KISS
- Performance-critical code (after profiling proves need)
- Preventing code duplication (after third instance)
- Enforcing constraints (types, validations)
2. YAGNI - You Aren't Gonna Need It
Don't implement features until you actually need them
Signs You're Violating YAGNI
- "We might need this someday"
- "Let me add flexibility for future use cases"
- "I'll build a generic solution"
- "This could be configurable"
Elixir Examples (YAGNI)
# YAGNI VIOLATION - Premature abstraction
defmodule NotificationService do
def send(notification, opts \\ []) do
provider = opts[:provider] || :default
priority = opts[:priority] || :normal
retry_strategy = opts[:retry_strategy] || :exponential
callback = opts[:callback]
# Complex routing logic for features we don't use yet
end
end
# GOOD - Build what you need now
defmodule NotificationService do
def send_email(to, subject, body) do
Email.send(to, subject, body)
end
# Add SMS when we actually need it
# Add priorities when we have the requirement
# Add retries when we see failures
end
# YAGNI VIOLATION - Unused flexibility
defmodule User do
schema "users" do
field :email, :string
field :settings, :map # "For future configuration"
field :metadata, :map # "For anything we might need"
field :flags, {:array, :string} # "For feature flags"
# None of these are used yet!
end
end
# GOOD - Add fields when needed
defmodule User do
schema "users" do
field :email, :string
# Add fields when requirements emerge
end
end
TypeScript Examples (YAGNI)
// YAGNI VIOLATION - Premature generalization
interface DataFetcher<T, P extends object = object> {
fetch(params: P): Promise<T>;
cache?(params: P): Promise<void>;
invalidate?(key: string): Promise<void>;
prefetch?(params: P[]): Promise<void>;
// We don't use cache, invalidate, or prefetch yet!
}
// GOOD - Start simple
interface DataFetcher<T> {
fetch(params: object): Promise<T>;
// Add methods when we need caching
}
// YAGNI VIOLATION - Config
Установить simplicity-principles в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadEditGrepGlobFAQ
Что делает скилл simplicity-principles?
Use when designing solutions, adding features, or refactoring by applying KISS, YAGNI, and Principle of Least Astonishment to write simple, predictable code.
Как установить скилл simplicity-principles?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл simplicity-principles запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic