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

nullables-refactor可空重构

Agent Skill

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

总安装

321

周安装

13

GitHub Stars

公开资料未说明

下载量

101
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/danielbush/skills --skill nullables-refactor

简介

nullables-refactor 用于处理 GitHub 仓库、Issue 和 Pull Request 协作信息。

  • 适用于围绕代码变更、仓库状态或协作事项进行整理与分析。
  • 通过 npx skills add 命令安装,需结合原始 README 确认具体用法。
  • 安装前建议确认权限范围、维护状态及是否触发联网或文件读写操作。
  • 可结合来源仓库进一步核验功能细节和使用限制。

SKILL.md

Nullables Refactor

Analyze a file and produce a step-by-step refactoring plan to make OUTSIDE_WORLD code nullable.

Vocabulary

This skill uses terms from references/vocabulary.md. Key terms: PURE, IN_MEMORY, OUTSIDE_WORLD, INFRASTRUCTURE_WRAPPER, NULLABLE_CLASS, HARDWIRED_INFRA, INJECTED_INFRA, CREATE_BOUNDARY_RULE, DUAL_FACTORY, EMBEDDED_STUB, NULLABLE, FACTORY_OBJECT, DELAYED_INSTANTIATION, CONFIGURABLE_RESPONSE, OUTPUT_TRACKING, VALUE_OBJECT.

How We Break Down The World

Code is classified by where its side effects reach:

CategorySide effectsNullable treatment needed?Examples
PURENoneNoComputations, transformations, formatters
IN_MEMORYMutates things passed in or held in memoryNoDOM manipulation, mutable data structures, in-memory state
OUTSIDE_WORLDCrosses the process boundary (I/O)YesNetwork calls, disk access, database queries, environment reads

The nullables pattern specifically targets OUTSIDE_WORLD code. PURE and IN_MEMORY code is fine as-is.

Within OUTSIDE_WORLD code, there are two kinds of entity:

EntityRoleHas DUAL_FACTORY?Contains I/O directly?
INFRASTRUCTURE_WRAPPERWraps one external system. Leaf of the dependency graph.Yes — owns the EMBEDDED_STUBYes — that's its job
NULLABLE_CLASSOrchestrates injected dependencies that talk to the outside world.Yes — injects NULLABLEs in .createNull()No — receives wrappers via injection

An application-level class is effectively a high-level NULLABLE_CLASS because it holds instances that ultimately reach the outside world.

Code that doesn't talk to the outside world:

EntityTreatment
PURE functions/classesNo special treatment. Plain functions or classes with .create() if stateful.
VALUE_OBJECT.create() + .createTestInstance(). No .createNull(). Mutable VALUE_OBJECTs are IN_MEMORY, not OUTSIDE_WORLD.

Input

The user provides a file path (or file contents). The agent reads the file, analyzes it, and produces a plan. The agent does NOT execute the plan without confirmation.

Analysis Algorithm

For each exported class, function, or significant code unit in the file:

Step 1: Classify by side-effect boundary

For each code unit, ask: where do its side effects reach?

  • PURE — no side effects. Same inputs → same outputs, touches nothing else.
  • IN_MEMORY — mutates things passed to it or held in memory (DOM nodes, data structures), but never crosses the process boundary.
  • OUTSIDE_WORLD — performs I/O across the process boundary (network, disk, database, environment, third-party services).

Step 2: For OUTSIDE_WORLD code — INFRASTRUCTURE_WRAPPER or NULLABLE_CLASS?

Skip to Step 3 for PURE or IN_MEMORY code.

This is the critical first question for any OUTSIDE_WORLD code unit. Before checking anything else:

If it's a standalone function with OUTSIDE_WORLD side effects

This is HARDWIRED_INFRA. A function that performs I/O should become an INFRASTRUCTURE_WRAPPER class:

  • Recommend: convert to a class with DUAL_FACTORY (.create() / .createNull()).
  • The class wraps the external system and provides a clean API.
  • .createNull() uses an EMBEDDED_STUB to replace the real I/O.
  • Name it descriptively: HttpClient, FileStore, DatabaseRepo, etc.
  • The class should provide data in the form the application needs, not the external system's raw format.

If it's a class — determine its role:

  • Is its sole purpose to wrap one external system (e.g., HTTP, database, filesystem)? → It should be an INFRASTRUCTURE_WRAPPER. It owns the EMBEDDED_STUB, provides CONFIGURABLE_RESPONSE, and is the leaf of the dependency graph.
  • Does it have business logic or orchestration AND also contain I/O calls? → It is a NULLABLE_CLASS that has HARDWIRED_INFRA. The I/O should be extracted into a separate INFRASTRUCTURE_WRAPPER and injected into this class.

The difference matters: an INFRASTRUCTURE_WRAPPER *contains* the external calls and stubs them internally. A NULLABLE_CLASS *uses* INFRASTRUCTURE_WRAPPERs via injection and gets NULLABLE versions in tests.

Then check the following:

  1. HARDWIRED_INFRA?

- Scan for any OUTSIDE_WORLD calls used directly inside the class (imported and called inline rather than injected). These are HARDWIRED_INFRA. - PURE and IN_MEMORY code is fine — only flag code that crosses the process boundary. - Recommend: extract into an INFRASTRUCTURE_WRAPPER and inject through CREATE_BOUNDARY_RULE. - This check comes first because it often reshapes the class — the remaining checks apply to the class *after* extraction.

  1. Has DUAL_FACTORY?

- Does the class have a static .create() method? If not, flag it. - Does the class have a static .createNull() method? If not, flag it. - Does .createNull() accept CONFIGURABLE_RESPONSE parameters? If it has OUTSIDE_WORLD dependencies, it should.

  1. CREATE_BOUNDARY_RULE compliance?

- Scan .create(): every OUTSIDE_WORLD dependency should be instantiated via Dependency.create(), not new Dependency(). - These calls must be lexically inside the static .create() method — this is the CREATE_BOUNDARY_RULE. Not in instance methods, not in the constructor. - Scan .createNull(): same rule, using Dependency.createNull(). - CONFIGURABLE_RESPONSE parameters from the outer .createNull() should flow down to inner .createNull() calls where appropriate. - If an instance method or constructor calls SomeClass.create(), this is a CREATE_BOUNDARY_RULE violation. Two remedies: - Immediate instantiation: move the .create() call into the static .create() and inject the instance via constructor. - DELAYED_INSTANTIATION: if the dependency is only needed conditionally or after an event, pass a FACTORY_OBJECT via the constructor instead.

  1. Decide on DELAYED_INSTANTIATION

- For each dependency, ask: is it always needed, or only under certain conditions? - Always needed → immediate instantiation in .create(). - Conditionally needed (based on runtime state, events, user input) → DELAYED_INSTANTIATION via FACTORY_OBJECT. - If multiple delayed dependencies exist, group them into a single FACTORY_OBJECT: {Bar: (...) => Bar.create(...), Baz: (...) => Baz.create(...)}.

  1. OUTPUT_TRACKING needed?

- If the class writes to external systems, recommend adding event emission and trackX() methods for testability.

Step 3: For PURE, IN_MEMORY, and VALUE_OBJECT code

PURE or IN_MEMORY code

  • No nullable treatment needed.
  • If stateless → plain functions are fine.
  • If stateful with IN_MEMORY mutation → a class with .create() is fine. No .createNull() needed.
  • Flag any OUTSIDE_WORLD calls found here — they're HARDWIRED_INFRA that should be extracted.

VALUE_OBJECT

  • Should have .create() (may require all params).
  • Should have .createTestInstance() with convenient defaults.
  • No .createNull() needed.
  • Mutable VALUE_OBJECTs doing IN_MEMORY work are fine.
  • Flag any OUTSIDE_WORLD operations — they don't belong here.

Step 3: Check for third-party framework interactions

  • If the code uses a DI framework (e.g., effect-ts), flag it. The boundary between framework-managed injection and DUAL_FACTORY needs case-by-case discussion.
  • If the code uses a third-party library for I/O (e.g., tanstack-query, axios), note whether the library provides a test client. Recommend how it fits into the DUAL_FACTORY architecture.

Step 4: Identify the dependency graph

  • List all dependencies the code creates or uses.
  • For each dependency, note whether it already has DUAL_FACTORY.
  • If not, flag it — the refactoring may need to recurse into those dependencies.
  • Order the plan so that leaf dependencies (INFRASTRUCTURE_WRAPPERs) are refactored first, then work up to Application layer.

Output Format

Present the plan as:

## Refactoring Plan: <filename>

### Classification
| Code Unit | Side Effects | Entity Type | Current State | Target State |
|-----------|-------------|-------------|--------------|--------------|
| ...       | PURE / IN_MEMORY / OUTSIDE_WORLD | INFRASTRUCTURE_WRAPPER / NULLABLE_CLASS / PURE / VALUE_OBJECT | ... | ... |

### Issues Found
1. **[HARDWIRED_INFRA | CREATE_BOUNDARY_RULE_VIOLATION | MISSING_DUAL_FACTORY | ...]** `CodeUnit` — description
   - **Recommendation**: what to do
   - **Why**: brief rationale

### Dependency Graph
- `AppClass` → `ServiceClass` → `HttpClient` (leaf)
  - Refactor order: HttpClient → ServiceClass → AppClass

### Steps
1. ...
2. ...
3. ...

### Questions for the human
- Any decisions that need human input (e.g., naming, DELAYED_INSTANTIATION vs immediate, third-party framework boundaries)

After Refactoring

Once the refactoring plan has been executed, use the nullables-test skill to write tests. That skill checks that:

  • All HARDWIRED_INFRA has been replaced by INJECTED_INFRA
  • Every piece of INJECTED_INFRA has .createNull() (recursing into dependencies if needed)
  • The class under test is ready for narrow, sociable, state-based tests via .createNull()

What This Skill Does NOT Do

  • Does not execute the refactoring — it produces the plan for the human to review.
  • Does not write tests — use nullables-test after refactoring is complete.
  • Does not make decisions about third-party framework boundaries — it flags them for discussion.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

36.9%
按下载量换算37

Claude

29.57%
按下载量换算30

Cursor

17.49%
按下载量换算18

Gemini CLI

9.6%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills