Index of every page on this site: llms.txt
All skills
qiao-925 avatar

/single-responsibility

@50a1ee4
Run it yourself

单一职责能力单元,帮助 Agent 在文件拆分、函数重构、模块设计、代码审查与边界澄清场景中,识别职责混杂、变化原因耦合与命名失真问题,让文件、函数、类与模块都能围绕一个稳定职责组织。关键词:单一职责、职责拆分、边界澄清、重构、文件拆分、函数重构、模块设计。

Use this Skill: https://skilld.dev/gh/qiao-925/qiao-skills/single-responsibility

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesfile-level.md

≈358 tokens on demand. Your agent reads this file only when SKILL.md points to it.

文件级:一个文件围绕一个稳定职责

核心问题

文件级职责失控,最常见的表现不是“大”,而是“杂”。

判断一个文件是否健康,先问两件事:

  • 能不能一句话说明这个文件做什么
  • 文件里的函数、类是否都服务于这句话

典型问题模式

1. 工具杂烩

一个文件里同时放日期处理、JSON 解析、邮件发送、哈希计算这类不相关能力。

这类文件的表面好处是“方便找”,实际问题是:

  • 变化原因完全不同
  • 命名会越来越泛
  • 测试和维护边界越来越模糊

2. 上帝类文件

一个文件里的主类同时做解析、验证、执行、格式化、缓存、日志。

这通常意味着文件职责已经不是“一个能力”,而是“整个流程的杂糅实现”。

拆分原则

  • 按职责边界拆,不按代码块大小平均切。
  • 如果几个函数总是围绕同一稳定意图变化,可以保留在同一文件。
  • 如果几个函数只是恰好都叫“工具”,但变化原因不同,应拆开。

拆分建议格式

当前问题:
- ...

建议拆分:
- a.py:...
- b.py:...

拆分理由:
- ...

检查清单

  • 文件职责能一句话说明。
  • 文件内成员都围绕同一职责。
  • 不存在明显不相关的功能堆叠。
  • 拆分后文件名会更准确,而不是更模糊。

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning7mo4 checks · Risk SAFE
  • Gen Agent Trust Hub7mo

    This skill provides comprehensive architectural guidelines and best practices for implementing the Single Responsibility Principle (SRP). It is purely educational and instructional, containing no executable code, network operations, or sensitive data access. No security issues were detected.

  • Socket7mo

    No alerts

  • Snyk7mo

    Risk: LOW · No issues

  • Runlayer9mo

    4/4 files flagged

Signed by skilld at 50a1ee4. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago
Other metadata
metadata
{
  "type": "declarative",
  "category": "engineering",
  "scope": "generic",
  "role": "skill-unit"
}

README badge

README badge for qiao-925/qiao-skills/single-responsibility