InkdownInkdown
Start writing

Claude-Code

62 files·4 subfolders

Shared Workspace

Claude-Code
codex

04-commands-and-skills

Shared from "Claude-Code" on Inkdown

Commands, Skills & Plugins

How users interact with Claude Code and how the system is extended.


Commands (Slash Commands)

Commands are user-facing actions triggered by typing /command in the REPL.

Command Types
TypeScript
type Command =
  | { type: 'prompt', name, description, getPromptForCommand(args, context) }
  | { type: 'local', name, description, action(args, context) }
  | { type: 'local-jsx', name, description, action(args, context) }
0000_start_here_index_and_recommended_reading_order.md
0100_project_overview_tech_stack_runtime_modes_and_folder_map.md
0200_startup_flow_entry_points_and_cold_start_sequence.md
0300_codebase_modules_layers_state_models_and_schemas.md
0400_system_architecture_and_design_rationale.md
0500_interactive_repl_request_flow_end_to_end.md
0600_headless_sdk_and_print_mode_request_flow_end_to_end.md
0700_mcp_integration_connection_and_tool_call_flow.md
0800_external_services_sdks_storage_and_local_dependencies.md
0900_environment_variables_settings_feature_flags_and_failure_modes.md
1000_non_obvious_patterns_gotchas_and_debugging_traps.md
1100_full_codebase_file_inventory_grouped_by_directory.md
kimi
00-overview.md
01-entrypoints.md
02-state-management.md
03-query-system.md
04-tools-system.md
05-tasks-system.md
06-ui-components.md
07-bridge-remote.md
08-services.md
09-skills-plugins.md
10-commands.md
11-testing-architecture.md
12-permission-system.md
13-build-system.md
14-ink-internals.md
15-git-internals.md
16-context-compaction.md
17-vim-mode.md
18-mailbox-notifications.md
19-session-persistence.md
20-hooks-system.md
21-error-recovery.md
README.md
qwen
00-overview.md
01-entry-points.md
02-query-engine.md
03-tools-and-tasks.md
04-commands-and-skills.md
05-state-management.md
06-ink-rendering.md
07-bridge-remote.md
08-mcp-services.md
09-services-overview.md
10-multi-agent.md
11-system-prompt-constants.md
12-tool-interface.md
13-memory-system.md
14-buddy-companion.md
15-keybindings.md
16-stop-hooks.md
17-vim-mode.md
18-upstreamproxy.md
19-cost-tracking-history.md
20-contexts-styles-onboarding.md
21-hooks.md
22-screens.md
tweets-explain
claude-code-memory-analysis.md
compact
memory-system
agentic-architecture
TypeBehavior
promptExpands to a text prompt sent to the AI model
localExecutes locally, outputs text
local-jsxRenders Ink UI components
Command Sources

Commands come from multiple sources, assembled in getCommands(cwd):

Plain text
All Commands = [
  ...bundledSkills,        // Shipped with the app
  ...builtinPluginSkills,  // From enabled built-in plugins
  ...skillDirCommands,     // From /skills/ directories
  ...workflowCommands,     // From workflow scripts
  ...pluginCommands,       // From installed plugins
  ...pluginSkills,         // Skills from plugins
  ...COMMANDS(),           // Built-in commands
  ...dynamicSkills,        // Discovered at runtime
]
Built-in Commands

Session Management:

CommandTypeDescription
/clearlocalClear the conversation
/compactpromptSummarize the conversation to save context
/resumelocal-jsxResume a previous session
/sessionlocal-jsxView session info / QR code
/renamelocalRename the current session
/taglocalAdd a tag to the session
/sharelocalShare the session
/exportlocalExport the conversation
/rewindlocal-jsxGo back to a previous point
/forklocal-jsxFork the conversation

Model & Settings:

CommandTypeDescription
/modellocal-jsxChange the AI model
/configlocal-jsxView/edit settings
/effortlocal-jsxAdjust effort level
/fastlocal-jsxToggle fast mode
/planlocalToggle plan mode
/output-stylelocal-jsxChange output formatting
/themelocal-jsxChange terminal theme
/colorlocal-jsxChange agent color

Tools & Extensions:

CommandTypeDescription
/mcplocal-jsxManage MCP servers
/pluginlocal-jsxManage plugins
/skillslocal-jsxView/manage skills
/agentslocal-jsxManage custom agents
/hookslocal-jsxView/manage hooks
/chromelocal-jsxChrome integration

Git & PRs:

CommandTypeDescription
/difflocalShow git diff
/commitlocalCommit changes
/reviewpromptReview changes
/pr_commentspromptFetch PR comments
/branchlocal-jsxManage branches
/autofix-prpromptAuto-fix PR issues

Information:

CommandTypeDescription
/helplocal-jsxShow help
/doctorlocalDiagnose issues
/statuslocalShow session status
/costlocalShow session cost
/usagelocalShow usage stats
/statslocalShow performance stats
/contextlocalShow context usage
/fileslocalList tracked files
/memorylocal-jsxView/edit memory files
/insightspromptAnalyze sessions

Actions:

CommandTypeDescription
/btwpromptAdd a side note
/copylocalCopy last message
/feedbacklocal-jsxSend feedback
/good-claudepromptPraise Claude
/thinkbackpromptReflect on the conversation
/summarylocalSummarize conversation
/release-noteslocalShow changelog

Auth:

CommandTypeDescription
/loginlocal-jsxAuthenticate
/logoutlocalLog out
/permissionslocal-jsxManage permissions
/privacy-settingslocal-jsxPrivacy settings

Other:

CommandTypeDescription
/vimlocalToggle vim mode
/keybindingslocal-jsxView keybindings
/statuslinelocalToggle status line
/passeslocalView pass eligibility
/sandboxlocal-jsxToggle sandbox
/upgradelocalUpgrade Claude Code
/versionlocalShow version
/exitlocalExit
/envlocalShow environment variables
/remote-envlocalShow remote environment
/mobilelocalShow mobile QR
/desktoplocalDesktop integration
/idelocalIDE integration
/terminal-setuplocalTerminal setup
/stickerslocalStickers
/advisorlocalAdvisor settings
/taskslocal-jsxTask management
/initlocalInitialize project
/add-dirlocalAdd directory to context
/reload-pluginslocalReload plugins
/heapdumplocalGenerate heap dump (debug)
Internal-Only Commands (ant-only, feature-gated)
CommandFeature FlagDescription
/backfill-sessions—Backfill session data
/break-cache—Debug prompt cache
/bughunter—Bug hunting tool
/commit-push-pr—Commit, push, and create PR
/ctx_viz—Context visualization
/good-claude—Internal feedback
/issue—Create issue
/init-verifiers—Initialize verifiers
/force-snipHISTORY_SNIPForce snip compaction
/mock-limits—Mock rate limits
/bridge-kick—Kick bridge session
/version—Show version
/ultraplanULTRAPLANUltraplan mode
/subscribe-prKAIROS_GITHUB_WEBHOOKSSubscribe to PR
/reset-limits—Reset rate limits
/onboarding—Onboarding flow
/share—Share session
/summary—Session summary
/teleport—Teleport session
/ant-trace—Debug tracing
/perf-issue—Performance diagnostics
/env—Environment dump
/oauth-refresh—Refresh OAuth token
/debug-tool-call—Debug tool calls
/agents-platform—Platform agents
/autofix-pr—Auto-fix PR
Remote-Safe Commands

When in remote mode (--remote), only these commands are available: /session, /exit, /clear, /help, /theme, /color, /vim, /cost, /usage, /copy, /btw, /feedback, /plan, /keybindings, /statusline, /stickers, /mobile


Skills

Skills are prompt-based capabilities that extend what Claude Code can do.

What Are Skills?

A skill is a directory containing:

  • SKILL.md — The skill definition (markdown with frontmatter)
  • Optional scripts, references, and bundled files

Skills are discovered from:

  1. Bundled skills — Shipped with the app (src/skills/bundled/)
  2. Project skills — In .claude/skills/ within the project
  3. User skills — In ~/.claude/skills/
  4. Plugin skills — From installed plugins
Skill Format
Markdown
---
name: my-skill
description: What this skill does
---

# My Skill

Instructions for the AI on how to use this capability...
Skill Loading
  1. At startup, bundled skills are registered
  2. getSkillDirCommands(cwd) walks .claude/skills/ and ~/.claude/skills/
  3. Plugin skills are loaded from installed plugins
  4. All skills are merged into the command list
  5. The SkillTool exposes available skills to the AI model
Skill Change Detector

A file watcher monitors skill directories for changes:

  • New skills appear → added to command list
  • Skills modified → cache invalidated
  • Skills deleted → removed from command list

Plugins

Plugins are versioned packages that can add tools, commands, hooks, MCP servers, and more.

Plugin Architecture
Plain text
Plugin Package
├── manifest.json          — Plugin metadata
├── skills/                — Plugin skills
├── commands/              — Plugin commands
├── hooks/                 — Plugin hooks
├── mcp/                   — MCP server configs
└── versions/              — Versioned plugin code
Plugin Lifecycle
  1. Discovery: Plugins are found in:

    • ~/.claude/plugins/ (user plugins)
    • .claude/plugins/ (project plugins)
    • --plugin-dir flag (inline plugins)
    • Managed plugins (enterprise)
  2. Installation: claude plugin install <name>

    • Downloads plugin package
    • Extracts to versioned cache
    • Validates manifest
  3. Loading: At startup:

    • initBuiltinPlugins() loads bundled plugins
    • loadAllPlugins() discovers and loads user/project plugins
    • Plugin hooks are registered
    • Plugin commands are added to command list
    • Plugin skills are merged
  4. Hot Reload: When settings change:

    • Plugin state is refreshed
    • New plugins detected → loaded
    • Removed plugins → unloaded
Plugin Hooks

Plugins can register hooks that fire at specific events:

Hook EventWhen It Fires
SessionStartWhen a session starts
SessionEndWhen a session ends
UserPromptSubmitBefore sending user prompt to API
AssistantResponseSubmitBefore sending assistant response to transcript
ToolCallWhen a tool is called
NotificationWhen a notification is generated
Plugin Management Commands
CommandDescription
/plugin listList installed plugins
/plugin install <name>Install a plugin
/plugin uninstall <name>Remove a plugin
/plugin update <name>Update a plugin
/plugin search <query>Search for plugins
/plugin info <name>Show plugin details
Plugin Versioning

Plugins are versioned and cached:

  • Each version gets its own cache directory
  • Multiple versions can coexist
  • cleanupOrphanedPluginVersionsInBackground() removes old versions
Plugin Directories
LocationScope
~/.claude/plugins/User-global
.claude/plugins/Project-specific
--plugin-dir <path>Session-specific
Bundled pluginsShipped with app

Command Processing Flow

Plain text
User types: /compact
    │
    ▼
processUserInput()
    │
    ├─ Is it a slash command?
    │   ├─ Find command in command list
    │   ├─ Check availability (auth requirements)
    │   ├─ Check isEnabled()
    │   │
    │   ├─ type: 'prompt'
    │   │   └─ getPromptForCommand() → send to model
    │   │
    │   ├─ type: 'local'
    │   │   └─ action() → output text
    │   │
    │   └─ type: 'local-jsx'
    │       └─ action() → render Ink UI
    │
    └─ Not a slash command
        └─ Send as regular prompt to model

Key Files Reference

FilePurpose
src/commands.tsCommand registry and assembly
src/types/command.tsCommand type definitions
src/commands/Command implementations (70+ commands)
src/skills/Skill loading system
src/skills/bundled/Bundled skills
src/plugins/Plugin system
src/plugins/bundled/Bundled plugins
src/utils/plugins/Plugin utilities
src/utils/skills/Skill utilities
src/utils/hooks/Hook system