Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计通过

code-principles代码原则

Agent Skill

code-principles 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

216

周安装

9

GitHub Stars

公开资料未说明

下载量

72
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:code-principles(代码原则)
来源仓库:https://github.com/wiseiodev/skills
仓库路径:skills/code-principles
安装命令:
npx skills add https://github.com/wiseiodev/skills --skill code-principles
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/wiseiodev/skills --skill code-principles

简介

code-principles 汇集 SRP、OCP、LSP 等 SOLID 原则与 KISS/YAGNI 简化法则的简明索引。

  • 适用于代码评审、重构指导与新成员规范培训,提供各原则的一行摘要。
  • 按组归类原则:SOLID(单一职责、开闭、里氏替换等)、DRY、YAGNI 与 AHA 反模式。
  • 可作为快速查阅手册,辅助判断代码是否符合简洁性与可扩展性要求。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Code Principles

Principle Index

PrincipleGroupOne-liner
SRPsolidOne reason to change
OCPsolidOpen for extension, closed for modification
LSPsolidSubtypes must be substitutable
ISPsolidSmall interfaces > fat interfaces
DIPsolidDepend on abstractions
DRYsimplicityDon't repeat yourself
YAGNIsimplicityYou aren't gonna need it
AHAsimplicityAvoid hasty abstractions
Rule of ThreesimplicityAbstract after 3 occurrences
CQSdesignCommands mutate, queries return
Law of DemeterdesignDon't talk to strangers
Tell Don't AskdesignPush logic to the object
POLAdesignCode should behave as expected
Composition > InheritancedesignCompose behavior from small pieces
IoCdesignFramework calls you
Fail FastresilienceValidate early, throw early
Robustness PrincipleresilienceLiberal in, strict out
Least PrivilegeresilienceMinimum access needed
Hyrum's LawmetaAll observable behavior becomes API
ConnascencemetaMeasure and minimize coupling
Locality of BehaviormetaUnderstand code in one place
Pit of SuccessmetaEasiest path = correct path
TDDtestingRed-green-refactor
AAAtestingArrange-Act-Assert
Test IsolationtestingTests don't affect each other
Test BehaviortestingTest what, not how
Testing PyramidtestingMany unit, fewer integration, few e2e
Idempotencyapi-designSame request = same result
Backwards Compatapi-designDon't break existing consumers
Semverapi-designCommunicate change impact
Defensive Codingapi-designValidate at boundaries
SoCarchitectureEach layer handles one concern
CQRSarchitectureSeparate read and write models
Hexagonal ArchitecturearchitecturePorts and adapters
Bounded ContextsarchitectureExplicit domain boundaries
Feature DirectoriesreactOrganize by feature, not type
Component SRPreactOne job per component
ColocationreactKeep related files together
Unidirectional FlowreactData down, events up
State PlacementreactState at lowest common ancestor
Barrel ExportsreactPublic API via index.ts

Usage Modes

1. Checklist mode (default)

Scan code or a plan against relevant principles. Read the reference files for the groups most relevant to the task, then output a checklist:

- [ ] SRP: Does each module have one reason to change?
- [ ] DRY: Is logic duplicated unnecessarily?
- [x] YAGNI: No speculative features found
...

Select groups based on context:

  • Code review → solid, simplicity, design, testing
  • Architecture/design review → architecture, design, resilience, meta
  • API review → api-design, design, resilience
  • React review → react, solid, simplicity

2. Council mode

Generate a review criteria block for injection into review-council prompts. Read the reference files for the persona's relevant groups (see review-council personas), extract the "Review question" from each principle, and format as:

## Code Principles Review Criteria
- SRP: Does each class/module have exactly one reason to change?
- OCP: Can behavior be extended without modifying existing code?
...

3. Deep-dive mode

When user asks about a specific principle ("what is the Law of Demeter?", "explain CQS"), read the relevant reference file and present the full entry: rule, violation example, correct example, when to break it.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.09%
按下载量换算25

Claude

28.97%
按下载量换算21

Cursor

18.88%
按下载量换算14

Gemini CLI

8.33%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills