AGENT SKILL

principle-keep-the-core-pure

WHEN domain logic lands in an adapter, handler, job or UI component; NOT for wiring that makes no domain decision; keeps decisions in pure functions behind thin framework wiring.

License 许可
MIT
所属仓库
mintuz/skills
最近更新
2026-11-11
Stars
★ 35
Forks
7

01 前言 Front Matter

name
principle-keep-the-core-pure
description
WHEN domain logic lands in an adapter, handler, job or UI component; NOT for wiring that makes no domain decision; keeps decisions in pure functions behind thin framework wiring.

03 SKILL.md 正文

Keep The Core Pure

Put domain decisions in pure functions; keep framework wiring thin and mechanical.

  1. Find each domain decision inside the adapter, request handler, job, view or component: the branch that applies a business rule, computes a result or chooses an outcome.
  2. Extract it into a pure function: explicit inputs in, a domain result out. Pass time, configuration and identifiers as arguments; read no clock, global, database or framework object inside it.
  3. Leave the shell to read input, call the function and perform effects with the result. Add new rules to the function, not to the shell. When several frameworks need the same rule, they share the function rather than copy it into each.
  4. Test the decision directly, without starting the framework, server, database or renderer.

Distinct from: principle-hide-representations (a private wire, storage or framework shape crosses a module boundary), principle-parse-at-the-boundary (untrusted data enters and needs validating), principle-minimize-reader-load (layers that own no decision make a path hard to trace).

Done: every domain rule touched is testable without the framework, and the wiring holds no domain branches.

04 同仓库更多 Skills

mintuz
mintuz/skills

xstate

WHEN React state changes in response to an external answer — async submit, in-flight or loading flags, retries, cancellation, polling, optimistic updates, stale responses — or to an interaction with an interruptible middle, such as a drag or a gesture; or WHEN building, reviewing, testing, or visualising XState 5 actors and @xstate/react integrations; NOT for a value one event sets completely, such as a text draft, a focus flag, or a plain open and closed toggle; models typed lifecycles and renders legal Mermaid stateDiagram-v2 charts.

测试与质量前端开发
★ 35
mintuz
mintuz/skills

web-design

WHEN refining UI layout, typography, color, or polish; NOT code implementation; provides concise principles for intentional, legible design.

设计师视觉设计
★ 35
mintuz
mintuz/skills

tailwind

WHEN building design systems or component libraries with Tailwind CSS; covers design tokens, CVA patterns and dark mode.

视觉设计
★ 35
mintuz
mintuz/skills

refactoring

WHEN you need a plan to refactor, restructure, or clean up working code and the test result is known, either green or a recorded failing set; NOT for new feature delivery or any behavior change; reversible-baseline safety with prioritized improvements.

代码审查
★ 35
mintuz
mintuz/skills

react

WHEN building or changing React components, pages, hooks, effects, or apps, including edits to existing components; NOT for test code (react-testing) or styling (css, tailwind); enforces scalable architecture, state management, API layer, performance patterns.

测试与质量前端开发
★ 35
mintuz
mintuz/skills

react-testing

WHEN testing React components/hooks/context with React Testing Library; NOT e2e; covers renderHook, providers, forms, and anti-patterns.

测试与质量前端开发
★ 35