Agent Skills
› NeverSight/learn-skills.dev
› cohesion-coupling-review
cohesion-coupling-review
GitHub审查代码变更是否遵循高内聚低耦合原则。检查所有权、依赖边界及导出面,推荐最小化重构方案,如迁移代码、引入端口或缩小接口,避免不当共享和深层导入。
Trigger Scenarios
变更涉及多个文件夹或层级
考虑跨能力导入文件
提议使用共享模块
Install
npx skills add NeverSight/learn-skills.dev --skill cohesion-coupling-review -g -y
SKILL.md
Frontmatter
{
"name": "cohesion-coupling-review",
"description": "Review a proposed change for high cohesion\/low coupling; recommends the smallest boundary-safe refactor (ownership, minimal public surface, no reach-in imports)."
}
High Cohesion / Low Coupling (Review Skill)
Use when
- A change touches multiple folders/layers/capabilities.
- You’re tempted to import a file from another capability.
- “Shared” is being considered for convenience.
Checklist (fast)
- Ownership: which capability/bounded context owns the rule/data?
- Cohesion: is the logic colocated with its change reason?
- Coupling: are dependencies narrow (ports/events) rather than concrete imports?
- Public surface: can exports be reduced to the minimal stable interface?
- Import hygiene: any deep imports into another capability/layer?
- Promotion: does it truly qualify for
shared(2+ contexts, no business policy)?
Smallest fixes (preferred order)
- Move code to the owner (increase cohesion).
- Introduce/adjust a port or event (reduce coupling).
- Narrow exports / add an explicit entry point (stabilize interface).
- Only then consider
shared(if it meets promotion rules).
References
.github/instructions/06-cohesion-coupling-copilot-instructions.md.github/instructions/05-design-principles-copilot-instructions.mdscripts/dependency-cruiser.js
Version History
- e0220ca Current 2026-07-05 21:25


