Claude Code Slash / Commands
Slash / commands are thequick control entry of Claude Code's interactive session;by entering instructions starting with /, / you can quickly invoke functions, manage sessions, and customize workflows.

View all available commands:
/help
/help It lists all built-in commands, current project custom commands (Skills / Commands), and commands exposed by connected MCP servers.
Command types:
| Type | Trigger Method | Source | Storage location | Applicable scenarios |
|---|---|---|---|---|
| Built-in commands | /command |
Installed with Claude Code | Internal Implementation | System operations such as session management, configuration, integration |
| Built-in Skills | /skill-name |
Bundled with Claude Code | Internal Implementation | Preset AI workflows such as code review, debugging, batch processing |
| Project custom Skills Recommend | /skill-name |
User-created directory + SKILL.md | .claude/skills/<名称>/SKILL.md |
Team-shared reusable workflows, included in git; supports Claude auto-triggering |
| Project custom commands Legacy format | /command |
User-created .md file |
.claude/commands/ |
Team-shared repetitive workflows, included in git |
| Personal custom Skills | /skill-name |
User-created directory + SKILL.md | ~/.claude/skills/<名称>/SKILL.md |
Personal workflows common across projects |
| Personal custom commands | /command |
User-created .md file |
~/.claude/commands/ |
Personal workflows common across projects (legacy format) |
| MCP commands | /mcp__服务器__命令 |
Automatically exposed by MCP servers | Provided by MCP servers | Invoke external tools such as GitHub, Slack, databases |
! Shell Commands |
!bash命令 |
Direct execution | — | Bypass AI processing, directly run terminal commands |
Command priority (when names conflict): Enterprise level > Personal level > Project level > Built-in
Skills vs Commands
: Both are triggered with /,
/
but Skills (
.claude/skills/
) are the new-generation format, supporting multi-file organization, Claude auto-triggering, and richer frontmatter control; Commands (
.claude/commands/
) are the legacy format, still fully compatible; new projects are recommended to use Skills directly.
I. Common built-in slash commands
Built-in commands are core functions that come with Claude Code and can be used by direct input. Beginners should prioritize these high-frequency commands:
Basic operation commands
| Command | Purpose | Beginner examples |
|---|---|---|
/help |
View all available commands and descriptions (including MCP commands) | Input /help Quickly check the command list |
/exit |
Exit the current interactive session | If you don't want to continue chatting, enter /exit and leave directly |
/clear |
Clear current conversation history | Session too messy?/clear One-click clear |
For example, we use the /help command to view help information; the Tab key switches menus, and Esc exits:

Session management commands
| Command | Syntax | Description | Usage examples | Notes |
|---|---|---|---|---|
/clear |
/clear |
Clear all conversation history and start a new session | /clear |
Irreversible, recommended to first /export |
/compact |
/compact [侧重点] |
Intelligently compress historical conversation, preserve semantics, reduce Token usage | /compact 保留数据库设计部分 |
The difference between /clear Difference: preserves a semantic summary rather than completely clearing |
/resume |
/resume [id或名称] |
Resume a historical session; without parameters, list all resumable sessions | /resume task-hub-backend |
together with /rename Better effect |
/rewind |
/rewind |
Undo recent operations, including file modifications and conversation content, restoring to the previous checkpoint; the new version adds a "code-only rollback" option that preserves conversation history | Press Esc Invoke the rollback menu twice |
Suitable for rolling back when unsatisfied with Agent execution results |
/rename |
/rename <名称> |
Name the current session for easier /resume retrieval later |
/rename auth-module-refactor |
Recommended naming convention:功能-操作 |
/export |
/export [文件名] |
Export the conversation to a file; if no filename is specified, copy to clipboard | /export debug-session.md |
Supports Markdown format |
/copy NEW |
/copy |
Copy Claude's most recent reply to the clipboard; if it contains multiple code blocks, an interactive selector will pop up | /copy |
Much faster than manually selecting text |
/btw NEW |
/btw <问题> |
Quickly insert a temporary question without affecting the main task context; the answer won't pollute the main conversation flow | /btw Redis 的默认端口是多少? |
Suitable for temporary lookup without disturbing the current task |
/exit |
/exit |
Safely exit the Claude Code REPL | /exit |
— |
Context and memory
| Command | Syntax | Description | Usage examples | Notes |
|---|---|---|---|---|
/context |
/context |
Visualize context window usage, showing the proportion of each part (history / files / system prompt / Skills) | /context |
When approaching the limit, execute /compact or /clear |
/memory |
/memory |
Open the editor to modify CLAUDE.md(project-level and global-level), persisting project conventions across sessions |
/memory |
After modification, takes effect for all subsequent sessions |
/add-dir |
/add-dir <路径> |
Include additional directories in the working scope, suitable for monorepo or cross-directory operations | /add-dir ../packages/shared |
Can be called multiple times to add multiple directories |
/todos |
/todos |
List the to-do items recorded by Claude in the current session | /todos |
— |
/diff NEW |
/diff |
View a diff summary of all file changes in this session, making it easy to review what modifications Claude made | /diff |
The difference between /rewind Use with: first /diff Confirm the changes, then decide whether to roll back |
Projects and Configuration
| Command | Syntax | Description | Usage examples | Notes |
|---|---|---|---|---|
/init |
/init |
Analyze the project structure and automatically generate CLAUDE.md, writing in the tech stack / build commands / code standards |
/init |
The essential first step for a new project |
/config |
/config |
Manage Claude Code global configuration through an interactive interface | /config |
— |
/status |
/status |
Open the settings status page to view an overview of the current configuration | /status |
— |
/hooks |
/hooks |
Interactively configure lifecycle Hooks (such as pre-commit lint, post-save formatting) | /hooks |
Supports PreToolUse / PostToolUse / Notification / Stop |
/permissions |
/permissions |
View or update tool permissions (read files / write files / execute commands, etc.) | /permissions |
Restricting permissions can improve operational security |
/sandbox |
/sandbox |
Enable an isolated sandbox environment to execute Bash commands, preventing impact on the host system | /sandbox |
Suitable for testing uncertain scripts |
/doctor |
/doctor |
Diagnose installation status, check whether dependencies / configuration / network connections are normal | /doctor |
Run this first when encountering errors |
Models and Output
| Command | Syntax | Description | Usage examples | Notes |
|---|---|---|---|---|
/model |
/model [模型名] |
Switch the underlying AI model; without parameters, displays an interactive selection menu | /model claude-haiku-4-5-20251001 |
See the model comparison table below |
/plan |
/plan [任务描述] |
Enter plan mode; Claude first outputs an execution plan for confirmation before acting | /plan 重构认证模块并补充测试 |
Suitable for complex multi-step tasks, avoiding going off track |
/output-style |
/output-style |
Set the response format (code-first / explanation-first / concise mode, etc.) | /output-style |
— |
/theme |
/theme |
Switch the terminal interface color scheme | /theme |
— |
/statusline |
/statusline |
Customize the content displayed in the terminal's bottom status bar | /statusline |
— |
/vim |
/vim |
Enable Vim key bindings | /vim |
Suitable for Vim users |
/terminal-setup |
/terminal-setup |
Installation Shift+Enter Line-wrap binding for conveniently entering multi-line Prompts |
/terminal-setup |
Recommended configuration for first-time use |
Available model comparison table (2026):
| Model Identifier | Locate | Applicable scenarios |
|---|---|---|
claude-sonnet-4-6 |
Balanced (default) | Daily development tasks, first choice for Pro/Max5 users |
claude-haiku-4-5-20251001 |
Fast and lightweight | Save Tokens in simple queries and custom commands |
claude-opus-4-6 |
High-capability flagship | Complex architecture planning, difficult code reasoning; Max20 users can use as default |
Code and Tools
| Command | Syntax | Description | Usage examples | Notes |
|---|---|---|---|---|
/review |
/review |
Perform a structured Code Review on recently modified code, outputting improvement suggestions by priority | /review |
— |
/security-review |
/security-review |
Perform a specialized security review of current changes (SQL injection / XSS / sensitive information leakage, etc.) | /security-review |
Must run before going live |
/pr-comments |
/pr-comments |
Pull review comments from the PR associated with the current branch and handle them directly in the terminal | /pr-comments |
Requires GitHub integration to be configured |
/install-github-app |
/install-github-app |
Configure GitHub Actions integration so Claude automatically Reviews new PRs | /install-github-app |
Generation .github/workflows/claude-code-review.yml |
/agents |
/agents |
View, create, and manage specialized subagents (DB expert / security expert / testing expert, etc.) | /agents |
— |
/bashes |
/bashes |
View currently running background Bash processes; can interrupt or view output | /bashes |
— |
/skills NEW |
/skills |
List all available Skills (built-in + project-level + personal-level), including descriptions and trigger methods | /skills |
When the context budget is insufficient, some Skills are excluded; use this command to confirm the loading status |
Integration and Extension
| Command | Syntax | Description | Usage examples | Notes |
|---|---|---|---|---|
/mcp |
/mcp |
Manage MCP server connections (connect / disconnect / view available tools) | /mcp |
See Section 7 for detailed MCP command explanations |
/ide |
/ide |
Configure integrated linkage with IDEs such as VSCode / JetBrains | /ide |
— |
/plugin |
/plugin [子命令] |
Manage Claude Code plugins: install, uninstall, update, browse the marketplace | /plugin install typescript-lsp |
The official plugin marketplace contains 36 curated plugins |
/teleport |
/teleport |
Migrate a session started on the claude.ai web version to the local terminal to continue (cloud to local direction) | /teleport |
Requires the GitHub App to be installed; only supports GitHub-hosted repositories |
/plugin Subcommand details:
| Subcommands | Function |
|---|---|
/plugin install <名称> |
Install a specified plugin |
/plugin list |
List all installed plugins |
/plugin update |
Update all installed plugins |
/plugin marketplace |
Browse the official plugin marketplace |
/plugin uninstall <名称> |
Uninstall a specified plugin |
Statistics and Account
| Command | Syntax | Description | Usage examples | Notes |
|---|---|---|---|---|
/cost |
/cost |
Display the Token consumption and estimated cost of the current session | /cost |
Visible to API-billed users; for subscription users, Tokens are included in the plan |
/usage |
/usage |
View current plan usage, remaining quota, and rate limit status | /usage |
— |
/stats |
/stats |
Display historical usage data in chart form (daily Tokens / number of sessions) | /stats |
— |
/release-notes |
/release-notes |
View the changelog of the latest Claude Code version | /release-notes |
— |
/bug |
/bug |
Package the current session context and submit a Bug report to Anthropic | /bug |
— |
/login |
/login |
Log in or switch Anthropic accounts | /login |
Suitable for developers with multiple accounts |
/logout |
/logout |
Log out of the current account | /logout |
— |
/privacy-settings |
/privacy-settings |
Manage data usage preferences (whether to allow conversations to be used for model training, etc.) | /privacy-settings |
— |
/remote-env |
/remote-env |
Configure environment variables for remote sessions | /remote-env |
— |
II. Built-in Skills NEW
Built-in Skills are preset AI workflows that come with Claude Code. Unlike built-in commands, they load detailed prompts and are then executed by Claude through reasoning, producing richer analysis and operational results, also using / .
Difference: built-in commands vs built-in Skills
Built-in commands (such as
/clear
、
/compact
) execute fixed logic, do not involve AI reasoning, and are extremely fast.
Built-in Skills (such as
/debug
、
/simplify
) load prompts and are then executed by Claude through reasoning, producing richer results and suitable for complex analysis tasks.
| Command | Description | Applicable scenarios |
|---|---|---|
/simplify |
Simplify the specified code or text, improving readability and eliminating unnecessary complexity | Refactor verbose functions, simplify over-engineered code |
/debug |
Perform systematic root cause analysis of error messages or abnormal behavior and provide fix ideas | Locate hard-to-reproduce bugs |
/batch |
Execute the same task in parallel across multiple files or targets (such as batch renaming, batch adding type annotations) | Large-scale repetitive code changes |
/loop |
Repeatedly execute an operation in a loop until an exit condition is met (such as continuously retrying tests until they pass) | Automated CI fix loops |
/claude-api |
Quickly generate sample code that calls the Anthropic API, supporting specified models and task types | Build a Claude API integration prototype |
III. Command Prefix Syntax
| Prefix | Syntax | Description | Example | compares |
|---|---|---|---|---|
/ |
/command |
Trigger built-in commands, built-in Skills, or custom Skills/Commands | /review |
— |
! |
! |
Execute Shell commands directly, bypassing AI processing, saving Tokens | !git status |
Equivalent to running directly in the terminal, but saves more Tokens than "help me check the git status" |
@ |
@<文件路径> |
Inject file contents into the current context | @src/api/users.ts |
More precise than manually pasting code, supports multiple files |
! Prefix usage examples:

> ! ls
> !git log --oneline -10
> !npm test -- --coverage
> !cat logs/error.log | tail -50
@ prefix usage examples:

> 对比 @src/auth/v1.ts 和 @src/auth/v2.ts 的实现差异
> 审查 @src/api/users.ts 中的错误处理逻辑是否完善
IV. Custom Skills (New Recommended Format)
Skills are the new generation format for custom commands, replacing the old version .claude/commands/. Both formats work normally, but new projects are recommended to use Skills directly.
Skills vs Commands comparison
| Feature | Skills (recommended) | Commands (old format) |
|---|---|---|
| Storage paths | .claude/skills/<名称>/SKILL.md |
.claude/commands/<名称>.md |
| Trigger Method | /名称 Manually triggered, or automatically triggered by Claude based on the description |
/名称(manual trigger only) |
| Multi-file support | ** Supports attaching templates, examples, helper scripts | ** Single file |
| Claude automatic triggering | ** Claude intelligently decides whether to invoke based on the description | ** |
| Agent Skills standard | ** Conforms to open standards, can be shared across tools | ** |
Steps to create a Skill
Step 1: Create the directory structure
Custom Skills come in two types, stored in different locations:
- Project Skill: Only effective in the current project, shared with the team. Directory:
.claude/skills/<名称>/ - Personal Skill: Common to all projects, for personal use. Directory:
~/.claude/skills/<名称>/
# 创建项目级 Skill(团队共享,纳入 git)
mkdir -p .claude/skills/optimize
# Create a personal-level Skill (cross-project universal, local private)
mkdir -p ~/.claude/skills/fix-bug
Step 2: Write SKILL.md
Create SKILL.md file, with YAML frontmatter for configuration and Markdown body below for the prompt.name The field defines the trigger command name.
Example: Create a code performance optimization Skill
---
name: optimize
description: 分析代码性能瓶颈,给出优化建议。当用户提到性能问题时自动触发。
allowed-tools: Read, Grep, Glob
argument-hint: [目标文件或目录]
model: claude-sonnet-4-6
---
Analyze the performance bottlenecks of the following code, and provide specific optimization suggestions, prioritizing time complexity and memory usage:
$ARGUMENTS
When using, enter:
/optimize src/utils/data-processor.ts
Subdirectory namespace organization
You can use subdirectories under .claude/skills/ to categorize by function; the directory name is the command name:
.claude/skills/
├── optimize/ → /optimize
│ ├── SKILL.md
│ └── examples/ # 可选:示例文件辅助 Claude 理解
├── debug/ → /debug
│ ├── SKILL.md
│ └── scripts/ # 可选:辅助脚本
└── commit/ → /commit
└── SKILL.md
V. Custom Slash Commands (Old Format, Compatible)
If you haverepeatedly used prompts(such as fixed code review requirements, repetitive instruction templates), you can turn them into custom commands for one-click invocation.
Command file storage locations:
| Scope | Storage paths | Sharing method | Applicable scenarios |
|---|---|---|---|
| Project-level | .claude/commands/<命令名>.md |
Include in git, shared with the team | Project-specific workflows (such as code generation for a specific framework) |
| Personal level | ~/.claude/commands/<命令名>.md |
Local private | General development habits (such as personal code style checks) |
Parameter syntax:
| Syntax | Description | Command file example | Invocation example |
|---|---|---|---|
$ARGUMENTS |
Capture everything after the command name | 分析并修复:$ARGUMENTS |
/fix 登录接口返回 500,见 logs/error.log |
$1 $2 |
Positional arguments split by spaces | 修复 Issue #$1,优先级 $2 |
/fix-issue 42 high |
!cmd`` |
Execute a Shell command and embed the output into the Prompt | !git diff HEAD`` |
Automatically expands to the command execution result |
@文件路径 |
Inject file contents into the Prompt | 审查 @src/utils/helpers.ts |
Automatically reads file content |
Core principle
Custom commands are essentially Markdown text files—the file name is the command name, the file content is the prompt to execute, supporting parameter passing and Bash command invocation.
Steps to create a custom command
Step 1: Create the command storage directory
Custom commands come in two types, stored in different locations:
- Project commands: Only effective in the current project, shared with the team. Directory:
.claude/commands/ - Personal commands: Common to all projects, for personal use. Directory:
~/.claude/commands/
Taking creating a project command as an example, first create the directory:
# 在项目根目录执行
mkdir -p .claude/commands
Step 2: Write the Markdown command file
Create a new .md file, where the file name is the command name (for example optimize.md command /optimize), with the prompt written in the file content.
Example: Create a code performance optimization command
# 写入提示词到文件
echo "分析这段代码的性能瓶颈,给出具体的优化建议,优先考虑时间复杂度和内存占用:" > .claude/commands/optimize.md
Now, in the session, enter /optimize, then paste the code, and Claude will perform performance analysis as you requested!
Advanced tip: Add parameters to commands
Commands can take parameters, using $ARGUMENTS(captures all parameters) or $1 $2(takes parameters by position).
Example: Bug fix command with parameters
Create the command file .claude/commands/fix-issue.md:
修复 Issue #$ARGUMENTS,要求:
1. 符合项目编码规范
2. 附上测试用例
3. 说明修复思路
Using the command:
/fix-issue 123 # $ARGUMENTS 会被替换成 "123"
VI. Frontmatter Field Reference
Custom command files (commands/*.md) and Skills (skills/*/SKILL.md) can both have YAML Frontmatter added at the top for fine-grained configuration:
---
name: commit # Skills 中必填;命令文件中可选(默认取文件名)
allowed-tools: Bash(git add:*), Bash(git commit:*), Read, Edit
argument-hint: [commit-message]
description: 检查代码质量后提交
model: claude-haiku-4-5-20251001
context: fork
agent: general-purpose
disable-model-invocation: false
user-invocable: true
hooks:
PreToolUse:
- matcher: "Bash"
hooks:
- type: command
command: "./scripts/validate.sh"
once: true
---
Field descriptions
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | Required for Skills | Define the trigger command name (/name); command files default to the file name |
allowed-tools |
string | No | Tools available to the command; matching tools do not require manual confirmation each time |
argument-hint |
string | No | in /help Parameter format hints displayed in the list, such as [message] |
description |
string | No | Command function description, displayed in the /help and /skills list; in Skills, also used to let Claude decide whether to auto-trigger |
model |
string | No | Force a specified model; using Haiku for simple tasks can reduce costs |
context |
enum | No | fork: Run as an independent subagent;inline: Run within the current session |
agent |
string | No | context: fork specify the agent type when |
disable-model-invocation |
bool | No | is true prohibits programmatic invocation of this command via the Skill tool when |
user-invocable NEW |
bool | No | is false allows only Claude auto-triggering when, users cannot manually /调用 |
hooks |
object | No | Lifecycle Hooks during command execution |
allowed-tools Writing examples
| Syntax | Meaning |
|---|---|
Read |
Allow reading any file |
Read(src/*) |
Only allow reading src/ directory |
Bash(git *:*) |
Allow all git subcommands |
Bash(npm test:*) |
Only allow running npm test |
Read, Grep, Glob |
Combine multiple tools |
Hook trigger timing
| Timing | Description | Typical use |
|---|---|---|
PreToolUse |
Before tool call | Run lint before commit, back up before writing files |
PostToolUse |
After a tool call | Auto-format after modification, generate changelog |
Notification |
When Claude sends a notification | Send Slack messages, desktop notifications |
Stop |
When Claude finishes responding | Log events, trigger downstream tasks |
VII. Plugins and MCP Commands
Besides writing your own, you can also, throughPluginand MCP serversobtain more extension commands.
Naming format:
/mcp__<服务器名>__<命令名> [参数]
Common MCP command examples
| MCP servers | Command example | Function |
|---|---|---|
| GitHub | /mcp__github__list_prs |
List PRs in the current repository |
| GitHub | /mcp__github__create_issue "Bug标题" high |
Create an Issue |
| PostgreSQL | /mcp__postgres__query "SELECT * FROM users LIMIT 10" |
Executes an SQL query |
| Slack | /mcp__slack__send_message "#dev" "部署完成" |
Send a Slack message |
| Jira | /mcp__jira__create_issue "修复登录Bug" high |
Create a Jira ticket |
| Figma | /mcp__figma__get_component "Button" |
Get Figma component information |
View all available MCP commands:/help(MCP commands are displayed in a separate group at the bottom of the help list)
1. Plugin commands
After installing a Claude Code plugin, plugin-specific commands are automatically added, usually in the format:
/plugin-name:command-name # 避免命令名冲突
For example, after installing the Git plugin, there might be a /git:commit command that generates standardized commit messages with one click.
2. MCP commands
MCP (Model Context Protocol) servers can turn the functionality of external tools (such as GitHub, Jira) into slash commands, in the format:
/mcp__<服务器名>__<功能名> [参数]
Example:
/mcp__github__list_prs # 列出 GitHub 仓库的 PR
/mcp__jira__create_issue "登录按钮失效" high # 在 Jira 创建高优先级问题
VIII. Practical Command Template Library
Template overview
| Template name | File path | Recommended model | Function |
|---|---|---|---|
| Smart Git commit | .claude/commands/commit.md |
Haiku | Commit after checking for debug leftovers |
| PR code review | .claude/commands/pr-review.md |
Sonnet | Comprehensive graded review |
| Smart test run | .claude/commands/test.md |
Sonnet | Run and automatically fix failing cases |
| Security vulnerability scan | .claude/commands/security-scan.md |
Opus | OWASP Top 10 scan |
| API documentation generation | .claude/commands/api-docs.md |
Sonnet | Automatically generate REST API documentation |
| Code Refactoring | .claude/commands/refactor.md |
Sonnet | Readability / DRY / type safety refactoring |
| Documentation link check | .claude/commands/check-links.md |
Haiku | Batch verify the validity of hyperlinks in documentation |
Smart Git commit:
---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git diff:*), Bash(git commit:*)
argument-hint: [commit-message]
description: 检查代码质量后提交
model: claude-haiku-4-5-20251001
---
## 暂存区内容
!`git diff --cached`
Check the following issues before submission, report them if found, and ask if you want to continue:
1. 遗留的 `console.log` / `print` 调试语句
2. 未处理的 `TODO` / `FIXME` 注释
3. 大段被注释掉的代码
4. 测试文件中的 `.only` / `.skip` 标记
若无问题,使用以下信息提交:$ARGUMENTS
PR code review:
---
allowed-tools: Read, Grep, Glob, Bash(git diff:*), Bash(git log:*)
description: 全面的 PR 代码审查
---
## Changed files
!`git diff --name-only HEAD~1`
## Detailed differences
!`git diff HEAD~1`
## 近期提交
!`git log --oneline -5`
Output review results based on three levels of priority: Critical / Major / Minor, covering:
代码逻辑与可读性、安全漏洞、性能隐患(N+1 查询)、测试覆盖率、文档完整性
Smart test run:
---
allowed-tools: Bash, Read, Edit
argument-hint: [test-pattern]
description: 运行测试并自动修复失败用例
---
Run tests matching "$ARGUMENTS":
1. 自动检测测试框架(Jest / pytest / Go test)
2. 运行指定模式的测试
3. 若有失败,分析根因并修复代码
4. 重新运行验证修复
不提供参数则运行全量测试并输出覆盖率报告。
Security vulnerability scan:
---
allowed-tools: Read, Grep, Glob
description: OWASP Top 10 安全漏洞扫描
model: claude-opus-4-6
---
Review the codebase from a security engineer's perspective:
高危:SQL 注入、XSS、命令注入、硬编码密钥
中危:不安全的反序列化、过时依赖、敏感信息写入日志、CORS 配置过宽
低危:缺失安全响应头、错误信息暴露内部细节
输出格式:漏洞位置 + 危险级别 + 修复建议代码示例
API documentation generation:
---
allowed-tools: Read, Glob, Edit
argument-hint: [输出文件路径]
description: 自动生成 REST API 文档
---
Scan @src/routes/ and @src/controllers/, and generate Markdown documentation for all endpoints:
- 端点路径与 HTTP 方法
- 请求参数(Query / Body / Path)及类型
- 响应结构(成功与错误)
- 认证要求
- curl 调用示例
保存到:$ARGUMENTS(默认:docs/api.md)
Code refactoring:
---
allowed-tools: Read, Edit, Glob
argument-hint: [目标文件或目录]
description: 代码质量重构
---
Refactor $ARGUMENTS following the principles:
- 可读性:变量/函数命名语义化,消除魔法数字
- DRY 原则:提取重复逻辑为复用函数
- 单一职责:拆分超过 50 行的函数
- 错误处理:完善异常捕获和错误边界
- TypeScript:消除 `any` 类型,补全类型注解
重构前先输出变更计划,确认后再执行。
Documentation link check:
---
allowed-tools: Read, Bash, WebFetch
argument-hint: [文档文件路径]
description: 检查文档中的链接是否全部有效
model: claude-haiku-4-5-20251001
---
读取 $ARGUMENTS 文件,提取所有超链接(http/https),逐一请求并检查响应状态码。
Output format:
- 有效链接(200)
- 重定向链接(3xx)及目标地址
- 失效链接(4xx/5xx)及建议替代链接
最后输出汇总:共 N 个链接,M 个失效。
Appendix: Configuration file description
Note:
data to the child component via
CLAUDE.local.md
and
.claude/settings.local.json
Add to
.gitignore
, to avoid personal preferences affecting team members.
| File / Directory | Purpose | Versioning |
|---|---|---|
CLAUDE.md |
Project-level shared instructions (tech stack, build commands, coding standards, etc.) | ** Include in git |
CLAUDE.local.md NEW |
Personal private instructions (personal preferences, not shared with the team) | ** Add to .gitignore |
~/.claude/CLAUDE.md |
Global instructions, common to all projects | — |
.claude/settings.json |
Project shared configuration (tool permissions, hooks, etc.) | ** Include in git |
.claude/settings.local.json |
Project personal configuration (overrides settings.json, not shared) | ** Add to .gitignore |
.claude/skills/ Recommend |
Project-level custom Skills (new recommended format) | ** Include in git |
.claude/commands/ Legacy format |
Project-level custom commands (old format, still fully compatible) | ** Include in git |
~/.claude/skills/ |
Personal global Skills (common across projects, locally private) | — |