重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
claude-config-optimizer by i9wa4/dotfiles
npx skills add https://github.com/i9wa4/dotfiles --skill claude-config-optimizerClaude Code 配置优化的规则与跟踪。
配置通过 Nix (programs.claude-code home-manager 模块) 以声明式方式管理。
单一事实来源:
| 目标位置 | 来源 | 管理方式 |
|---|---|---|
~/.claude/settings.json | 从 Nix 属性生成 | claude-code.nix |
~/.claude/CLAUDE.md | 从 AGENTS.md + 片段生成 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
CLAUDE.mdinstruction-artifacts.nix |
~/.claude/rules/ | nix/home-manager/agents/rules/ | claude-code.nix |
~/.claude/agents/ | nix/home-manager/agents/subagents/ | claude-code.nix |
~/.claude/scripts/ | nix/home-manager/agents/scripts/ | claude-code.nix |
~/.claude/skills/ | 多个 flake 输入 + 本地 | agent-skills.nix |
| MCP 服务器 | nix/home-manager/agents/mcp-servers.nix | claude-code.nix |
始终先检测已安装的版本:
claude --version
这将返回本地安装的版本(例如 2.1.72 (Claude Code))。所有更新日志分析必须限定在此版本及以下。请勿报告比本地安装版本更新的版本中的功能或更改。
FILE=$(mkmd --dir tmp --label claude-code-changelog)
gh api repos/anthropics/claude-code/contents/CHANGELOG.md \
--jq '.content' | base64 -d > "$FILE"
然后读取文件,但只分析到本地版本(含)为止的章节。
重要提示:以下所有操作均限定在本地安装版本范围内。忽略任何版本号比 claude --version 新的更新日志章节。
claude --version 检测本地版本## <本地版本> 章节(不是第一个章节)claude --version 检测本地版本claude --version 检测本地版本Deprecated、Removed、Breaking、Changed关于 Claude Code 规范、功能和用法的详细问题:
你必须:通过 Task 工具使用 claude-code-guide 子代理
示例查询:钩子、MCP 服务器、设置、IDE 集成
Task tool with subagent_type: claude-code-guide
| 类别 | 示例 |
|---|---|
| 显示 | showTurnDuration, language |
| 行为 | respectGitignore, autoUpdate |
| 工具 | disallowedTools, allowedTools |
| MCP | MCP 服务器配置 |
| 钩子 | PreToolUse, PostToolUse, Stop 钩子 |
| 计划 | plansDirectory |
rules/ 目录中| 包含 | 排除 |
|---|---|
| Claude 无法猜测的 Bash 命令 | Claude 通过阅读代码可以弄清楚的任何内容 |
| 与默认值不同的代码风格规则 | Claude 已经知道的标准语言约定 |
| 测试说明和首选的测试运行器 | 详细的 API 文档(改为链接到文档) |
| 仓库规范(分支命名、PR 约定) | 频繁更改的信息 |
| 特定于你项目的架构决策 | 冗长的解释或教程 |
| 开发者环境特性(必需的环境变量) | 对代码库逐文件的描述 |
| 常见的陷阱或不明显的行为 | 不言自明的实践,如“编写干净的代码” |
测试每一行:“删除这个会导致 Claude 犯错吗?”如果不会,就删掉它。
CLAUDE.md 可以导入其他文件:
See @README.md for project overview and @package.json for available npm
commands.
# Additional Instructions
- Git workflow: @docs/git-instructions.md
- Personal overrides: @~/.claude/my-project-instructions.md
| 位置 | 作用范围 |
|---|---|
~/.claude/CLAUDE.md | 所有 Claude 会话(全局) |
./CLAUDE.md | 项目根目录 — 提交到 git 以便与团队共享 |
./CLAUDE.local.md | 项目根目录 — 添加到 .gitignore 以进行个人覆盖 |
| 父目录 | 对单体仓库有用(自动加载) |
| 子目录 | 在处理那里的文件时按需加载 |
| 类型 | 加载时机 | 用途 |
|---|---|---|
| CLAUDE.md / rules/ | 启动时完全加载 | 始终应用的全局规则 |
| commands/ | 用户显式调用 | 预定义的提示词、工作流 |
| skills/ | 由对话自动触发 | 专业知识 |
| agents/ | 通过 Task 工具委托 | 独立的上下文 |
编辑 CLAUDE.md 时检查以下内容:
检查 settings.json 的权限块:
Bash(cmd *) 而不是已弃用的 :*?git -C * 是否被阻止以防止跨仓库操作?---
name: skill-name
description: |
When to trigger this skill.
Use when:
- condition 1
- condition 2
disable-model-invocation: true # For workflows with side effects (manual invoke only)
---
disable-model-invocation: true — 防止自动触发;用户必须使用 /skill-name 显式调用。用于具有副作用的工作流。$ARGUMENTS 调用参数化工作流:/fix-issue 1234---
name: agent-name
description: What this agent does and when to use it
tools: Read, Grep, Glob, Bash # Restrict available tools
model: opus # Optional: specify model
isolation: worktree # Run in isolated git worktree (v2.1.49+)
background: true # Always run as background task (v2.1.49+)
---
在 rules/、skills/、agents/ 或 commands/ 中添加/删除文件时:
上次审查的 Claude Code 版本:v2.1.94 (2026-04-09)
language 设置 - 设为 "English"ENABLE_TOOL_SEARCH 环境变量 - 设为 "auto:3":* 语法迁移到现代 * 语法CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS 启用CLAUDE_CODE_ENABLE_TASKS 环境变量 - 已移除(任务默认启用)CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC 已移除 - 启用远程控制和功能标志刷新 (v2.1.51+)CLAUDE_AUTOCOMPACT_PCT_OVERRIDE = "70" - 在上下文使用率达到 70% 时自动压缩includeGitInstructions = false - 禁用内置的 git 说明;自定义的 rules/github.md 是唯一权威 (v2.1.69)CLAUDE_CODE_SUBPROCESS_ENV_SCRUB = "1" - 从子进程中剥离凭据 (v2.1.83)showThinkingSummaries = true - v2.1.89 默认值更改后需要显式选择加入(在交互式会话中默认不再生成思考摘要)CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING - 有意保持未设置(自适应思考保持开启)。结合启动时的 /effort high,与 v2.1.94 中正式化的 Team/Enterprise 默认设置一致。完整理由和 HN 讨论链接请参见 references/changelog-tracking.md 中的决策日志。memory: user|project|local 用于有状态的代理isolation: worktree - 每个代理使用独立的 git 工作树 (v2.1.49, v2.1.50)compact_summary 字段 (v2.1.76)if 字段 - 使用权限规则语法过滤来减少进程生成开销 (v2.1.85)hookSpecificOutput.sessionTitle (v2.1.94) - 根据提示词动态设置会话/tmux 窗格标题CLAUDE_CODE_NO_FLICKER=1 环境变量 (v2.1.89) - 无闪烁的备用屏幕渲染;如果观察到渲染故障,请重新审视关于决策日志(“不采纳”)和每个版本的更新日志,请参见 更新日志跟踪。
# Claude Code vX.X.X
## New Features
- [Feature]: [Description]
## Bug Fixes
- [Fix description]
## Improvements
- [Improvement description]
## Deprecated/Removed
- [Affected settings and migration path]
---
Source: https://github.com/anthropics/claude-code
将文档网站转换为 Claude Agent Skills。
要求:Python 3.10+,wget (brew install wget)
uvx --from git+https://github.com/laiso/site2skill site2skill <URL> <SKILL_NAME>
# Example
uvx --from git+https://github.com/laiso/site2skill site2skill https://docs.pay.jp/v1/ payjp
选项:
--output, -o - 输出目录(默认:.claude/skills)--skill-output - 保存 .skill 文件的位置(默认:当前目录)--skip-fetch - 跳过下载(重用现有文件)--clean - 完成后删除临时文件要更新现有的技能文档,请在不使用 --skip-fetch 的情况下重新运行。
官方文档:
社区资源:
| 模式 | 描述 |
|---|---|
default | 首次使用每个工具时请求权限 |
acceptEdits | 自动接受会话中的文件编辑权限 |
plan | 计划模式:仅分析,不修改 |
dontAsk | 自动拒绝,除非通过允许规则预先批准 |
bypassPermissions | 跳过所有提示(仅在隔离环境中使用) |
规则按以下顺序评估:拒绝 -> 询问 -> 允许。第一个匹配的规则胜出。
{
"permissions": {
"allow": [
"Bash(npm run *)",
"Bash(git commit *)",
"Bash(* --version)",
"Bash(* --help *)"
],
"deny": ["Bash(git push *)"]
}
}
注意:* 前的空格很重要:Bash(ls *) 匹配 ls -la 但不匹配 lsof。
| 模式 | 含义 | 示例 |
|---|---|---|
//path | 从根目录开始的绝对路径 | Read(//Users/alice/**) |
~/path | 从主目录开始的路径 | Read(~/.zshrc) |
/path | 相对于设置文件的路径 | Edit(/src/**/*.ts) |
path | 相对于当前目录的路径 | Read(*.env) |
注意:* 匹配单个目录,** 递归匹配。
{
"permissions": {
"allow": ["mcp__puppeteer__*"],
"deny": ["Task(Explore)"]
}
}
| 平台 | 路径 |
|---|---|
| macOS | /Library/Application Support/ClaudeCode/managed-settings.json |
| Linux/WSL | /etc/claude-code/managed-settings.json |
| Windows | C:\Program Files\ClaudeCode\managed-settings.json |
| 设置 | 描述 |
|---|---|
disableBypassPermissionsMode | 设为 "disable" 以防止绕过模式 |
allowManagedPermissionRulesOnly | 仅应用托管规则 |
allowManagedHooksOnly | 仅允许托管/SDK 钩子 |
基于使用情况分析(55K 条消息,4.7K 个会话):
https://code.claude.com/docs/en/hookshttps://code.claude.com/docs/en/permissionshttps://code.claude.com/docs/en/skills#inject-dynamic-contexthttps://vercel.com/blog/agents-md每周安装数
78
仓库
GitHub 星标数
9
首次出现
Jan 24, 2026
安全审计
安装于
gemini-cli75
opencode75
codex75
github-copilot74
cline74
cursor74
Rules and tracking for Claude Code configuration optimization.
Config is managed declaratively via Nix (programs.claude-code home-manager module).
Source of truth:
| Destination | Source | Managed by |
|---|---|---|
~/.claude/settings.json | Generated from Nix attributes | claude-code.nix |
~/.claude/CLAUDE.md | Generated from AGENTS.md + CLAUDE.md fragment | instruction-artifacts.nix |
~/.claude/rules/ | nix/home-manager/agents/rules/ | claude-code.nix |
~/.claude/agents/ | nix/home-manager/agents/subagents/ | claude-code.nix |
~/.claude/scripts/ | nix/home-manager/agents/scripts/ | claude-code.nix |
~/.claude/skills/ | Multiple flake inputs + local | agent-skills.nix |
| MCP servers | nix/home-manager/agents/mcp-servers.nix | claude-code.nix |
Always detect the installed version first:
claude --version
This returns the locally installed version (e.g. 2.1.72 (Claude Code)). All CHANGELOG analysis MUST be scoped to this version and below. Do NOT report features or changes from versions newer than the local install.
FILE=$(mkmd --dir tmp --label claude-code-changelog)
gh api repos/anthropics/claude-code/contents/CHANGELOG.md \
--jq '.content' | base64 -d > "$FILE"
Then read the file, but only analyze sections up to and including the local version.
IMPORTANT: All operations below are scoped to the locally installed version. Ignore any CHANGELOG sections for versions newer than claude --version.
claude --version## <local-version> section (not the first section)claude --versionclaude --versionDeprecated, Removed, Breaking, ChangedFor detailed questions about Claude Code specifications, features, and usage:
YOU MUST: Use the claude-code-guide subagent via Task tool
Example queries: hooks, MCP servers, settings, IDE integrations
Task tool with subagent_type: claude-code-guide
| Category | Examples |
|---|---|
| Display | showTurnDuration, language |
| Behavior | respectGitignore, autoUpdate |
| Tools | disallowedTools, allowedTools |
| MCP | MCP server configurations |
| Hooks | PreToolUse, PostToolUse, Stop hooks |
| Plans |
rules/| Include | Exclude |
|---|---|
| Bash commands Claude can't guess | Anything Claude can figure out by reading code |
| Code style rules that differ from defaults | Standard language conventions Claude already knows |
| Testing instructions and preferred test runners | Detailed API documentation (link to docs instead) |
| Repository etiquette (branch naming, PR conventions) | Information that changes frequently |
| Architectural decisions specific to your project | Long explanations or tutorials |
| Developer environment quirks (required env vars) | File-by-file descriptions of the codebase |
| Common gotchas or non-obvious behaviors | Self-evident practices like "write clean code" |
Test each line: "Would removing this cause Claude to make mistakes?" If not, cut it.
CLAUDE.md can import additional files:
See @README.md for project overview and @package.json for available npm
commands.
# Additional Instructions
- Git workflow: @docs/git-instructions.md
- Personal overrides: @~/.claude/my-project-instructions.md
| Location | Scope |
|---|---|
~/.claude/CLAUDE.md | All Claude sessions (global) |
./CLAUDE.md | Project root — check into git to share with team |
./CLAUDE.local.md | Project root — add to .gitignore for personal overrides |
| Parent directories | Useful for monorepos (auto-loaded) |
| Child directories | Loaded on demand when working with files there |
| Type | Load Timing | Purpose |
|---|---|---|
| CLAUDE.md / rules/ | Full load at startup | Global rules always applied |
| commands/ | Explicit user invocation | Predefined prompts, workflows |
| skills/ | Auto-triggered by conversation | Specialized knowledge |
| agents/ | Delegated via Task tool | Independent context |
Check the following when editing CLAUDE.md:
Check settings.json permissions block:
Bash(cmd *) not deprecated :*?git -C * blocked to prevent cross-repo operations?---
name: skill-name
description: |
When to trigger this skill.
Use when:
- condition 1
- condition 2
disable-model-invocation: true # For workflows with side effects (manual invoke only)
---
disable-model-invocation: true — Prevents auto-triggering; user must invoke explicitly with /skill-name. Use for workflows that have side effects.$ARGUMENTS for parameterized workflows: /fix-issue 1234---
name: agent-name
description: What this agent does and when to use it
tools: Read, Grep, Glob, Bash # Restrict available tools
model: opus # Optional: specify model
isolation: worktree # Run in isolated git worktree (v2.1.49+)
background: true # Always run as background task (v2.1.49+)
---
When adding/removing files in rules/, skills/, agents/, or commands/:
Last reviewed Claude Code version: v2.1.94 (2026-04-09)
language setting - set to "English"ENABLE_TOOL_SEARCH env - set to "auto:3":* to modern * syntaxCLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMSCLAUDE_CODE_ENABLE_TASKS env - removed (tasks enabled by default)CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC removed - enables Remote Control and feature flag refresh (v2.1.51+)memory: user|project|local for stateful agentsisolation: worktree in agent defs - isolated git worktree per agent (v2.1.49, v2.1.50)compact_summary field (v2.1.76)if field for hooks - reduce process spawning overhead with permission rule syntax filtering (v2.1.85)hookSpecificOutput.sessionTitle in UserPromptSubmit hooks (v2.1.94) - dynamic session/tmux pane title per promptCLAUDE_CODE_NO_FLICKER=1 env (v2.1.89) - flicker-free alt-screen rendering; revisit if rendering glitches observedFor decision log ("Not Adopting") and per-version changelog, see Changelog Tracking.
# Claude Code vX.X.X
## New Features
- [Feature]: [Description]
## Bug Fixes
- [Fix description]
## Improvements
- [Improvement description]
## Deprecated/Removed
- [Affected settings and migration path]
---
Source: https://github.com/anthropics/claude-code
Convert documentation websites into Claude Agent Skills.
Requirements: Python 3.10+, wget (brew install wget)
uvx --from git+https://github.com/laiso/site2skill site2skill <URL> <SKILL_NAME>
# Example
uvx --from git+https://github.com/laiso/site2skill site2skill https://docs.pay.jp/v1/ payjp
Options:
--output, -o - Output directory (default: .claude/skills)--skill-output - Where to save .skill file (default: current directory)--skip-fetch - Skip download (reuse existing files)--clean - Remove temporary files after completionTo update existing skill docs, re-run without --skip-fetch.
Official Documentation:
Community Resources:
| Mode | Description |
|---|---|
default | Prompts for permission on first use of each tool |
acceptEdits | Auto-accepts file edit permissions for the session |
plan | Plan Mode: analyze only, no modifications |
dontAsk | Auto-denies unless pre-approved via allow rules |
bypassPermissions | Skips all prompts (use only in isolated environments) |
Rules are evaluated: deny - > ask -> allow. First matching rule wins.
{
"permissions": {
"allow": [
"Bash(npm run *)",
"Bash(git commit *)",
"Bash(* --version)",
"Bash(* --help *)"
],
"deny": ["Bash(git push *)"]
}
}
NOTE: Space before * matters: Bash(ls *) matches ls -la but not lsof.
| Pattern | Meaning | Example |
|---|---|---|
//path | Absolute path from root | Read(//Users/alice/**) |
~/path | Path from home directory | Read(~/.zshrc) |
/path | Relative to settings file | Edit(/src/**/*.ts) |
path |
NOTE: * matches single directory, ** matches recursively.
{
"permissions": {
"allow": ["mcp__puppeteer__*"],
"deny": ["Task(Explore)"]
}
}
| Platform | Path |
|---|---|
| macOS | /Library/Application Support/ClaudeCode/managed-settings.json |
| Linux/WSL | /etc/claude-code/managed-settings.json |
| Windows | C:\Program Files\ClaudeCode\managed-settings.json |
| Setting | Description |
|---|---|
disableBypassPermissionsMode | Set to "disable" to prevent bypass mode |
allowManagedPermissionRulesOnly | Only managed rules apply |
allowManagedHooksOnly | Only managed/SDK hooks allowed |
Based on usage analysis (55K messages, 4.7K sessions):
https://code.claude.com/docs/en/hookshttps://code.claude.com/docs/en/permissionshttps://code.claude.com/docs/en/skills#inject-dynamic-contexthttps://vercel.com/blog/agents-mdWeekly Installs
78
Repository
GitHub Stars
9
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
gemini-cli75
opencode75
codex75
github-copilot74
cline74
cursor74
Azure Data Explorer (Kusto) 查询技能:KQL数据分析、日志遥测与时间序列处理
152,400 周安装
plansDirectoryCLAUDE_AUTOCOMPACT_PCT_OVERRIDE = "70" - autocompact at 70% context usageincludeGitInstructions = false - disables built-in git instructions; custom rules/github.md is sole authority (v2.1.69)CLAUDE_CODE_SUBPROCESS_ENV_SCRUB = "1" - strips credentials from subprocesses (v2.1.83)showThinkingSummaries = true - explicit opt-in required after v2.1.89 default change (thinking summaries no longer generated by default in interactive sessions)CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING - intentionally left unset (adaptive thinking stays ON). Combined with startup /effort high, mirrors the Team/Enterprise default formalized in v2.1.94. See decision log in references/changelog-tracking.md for full rationale and HN discussion link.| Relative to current directory |
Read(*.env) |