nixos-config: Skill for Claude Code

.claude/skills/refactor/SKILL.md

refactor is a skill for Claude Code from MCB-SMART-BOY/nixos-config. It costs 45 tokens per session (517 once invoked), scanned A, original, Apache-2.0.

A procedure for reorganising NixOS configuration files while preserving their behaviour. It covers splitting modules, removing unused code, consolidating duplicates, and checking the result.

In plain words
What is it for?
Use it to extract modules, clean unused configuration, consolidate package lists, review user profiles, check overlays, format files, and run NixOS quality checks.
Why use it?
It makes a large configuration easier to maintain while reducing dead code and repeated package or module definitions.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is MCB-SMART-BOY/nixos-config's own configuration. It tells Claude Code how to work on nixos-config itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything nixos-config configures →

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /home/admin/mcbctl/profiles/.

Reuse

Borrowing it

Nothing to install: this file belongs to MCB-SMART-BOY/nixos-config. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/MCB-SMART-BOY/nixos-config/solo/.claude/skills/refactor/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/MCB-SMART-BOY/nixos-config

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/mcb-smart-boy/nixos-config/refactor.svg)](https://agentmods.dev/skills/mcb-smart-boy/nixos-config/refactor)
Your own site
<a href="https://agentmods.dev/skills/mcb-smart-boy/nixos-config/refactor"><img src="https://agentmods.dev/badge/skills/mcb-smart-boy/nixos-config/refactor.svg" alt="Measured on agentmods" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 517 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00045 $0.00517
Opus 5 $0.00023 $0.00259
Sonnet 5 $0.00009 $0.00103
Haiku 4.5 $0.00005 $0.00052

Measured 2d ago against content hash c338e435c7d1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/refactor/SKILL.md · 41 lines

What it actually says

Refactor

原则

不改行为、小块提交、每次改动后 nix flake check、保留中文注释。

操作清单

A. 提取模块

  1. 识别可独立逻辑块(>150 行或清晰语义边界)
  2. 创建 modules/<name>.nix
  3. modules/default.nix imports 中按类别插入
  4. 从原文件删除已移动配置
  5. nix flake check

不提取:逻辑高度耦合(greetd+regreet)、<50 行独立功能、导致复杂模块间依赖。

B. 清理 tryEval 与用户输出边界

  • modules/lib.nix 提供统一的 resolvePkgmanagedUserNames,系统模块必须复用,不能本地重定义
  • Home Manager 的用户入口校验、NixOS 上下文投影和 Home Manager 输出聚合属于独立 mcbctl 项目,不与 NixOS 模块共享实现
  • 新增弹性包解析逻辑请使用 resolvePkg,不要手动实现;不要在同一项目内复制用户列表 fallback

C. 清理 overlay

当前没有本地 overlay。新增前先确认锁定 nixpkgs 未原生解决问题;仅在确有必要时添加,并附带上游 issue 与移除条件。

D. 去重包列表

  • 系统基础设施保留在 NixOS modules/packages.nix,由独立系统开关控制;gaming 跟随 programs.steam.enable
  • 用户应用与偏好放在 mcbctl /home/admin/mcbctl/profiles/;不要让 profile 反向设置 NixOS 系统包开关
  • 检查 mcbctl 16 个 profile 间包重叠并合并/拆分;游离用户包归入对应 profile,确保在 mcbctl profiles/default.nix 注册

F. 死代码扫描

deadnix --fail .
statix check
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago Changed · +1 lines c338e435c7d1
  2. 7d ago First seen · 40 lines · 45 tokens per session scan A a07f1838032f

Subscribe to this mod's changes

refactor is a skill published in the GitHub repository MCB-SMART-BOY/nixos-config (10 stars, last pushed 2d ago), licensed Apache-2.0. It adds 45 tokens to every session and 517 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

vercel/next.js · 103 tokens

chronicle

Analyze Copilot session history for standup reports, usage tips, session search, and session reindexing. Use when the user asks for a standup, daily summary, usage tips, workflow recommendations, wants to search or find past sessions by keyword/file/PR, wants to reindex their session store, or asks about deleting…

microsoft/vscode · 72 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens