help Command
The help
command provides users with information about Claude Code's usage, available commands, and general guidance for effective interaction with the tool.
Implementation
The command is implemented in commands/help.tsx
as a type: 'local-jsx' command that renders a React component:
import { Command } from "../commands";
import { Help } from "../components/Help";
import * as React from "react";
const help = {
type: "local-jsx",
name: "help",
description: "Show help and available commands",
isEnabled: true,
isHidden: false,
async call(onDone, { options: { commands } }) {
return <Help commands={commands} onClose={onDone} />;
},
userFacingName() {
return "help";
},
} satisfies Command;
export default help;
The command delegates to the Help
component in components/Help.tsx
, passing the list of available commands and an onClose
callback to handle when the help screen should be dismissed.
Functionality
The Help
component implements a progressive disclosure pattern for displaying information:
-
Basic Information:
- Shows the product name and version
- Displays a brief description of Claude Code's capabilities and limitations
- Presents a disclaimer about the beta nature of the product
-
Usage Modes (shown after a brief delay):
- Explains the two primary ways to use Claude Code:
- REPL (interactive session)
- Non-interactive mode with the
-p
flag for one-off questions
- Mentions that users can run
claude -h
for additional command-line options
- Explains the two primary ways to use Claude Code:
-
Common Tasks (shown after a longer delay):
- Lists examples of typical use cases:
- Asking questions about the codebase
- Editing files
- Fixing errors
- Running commands
- Running bash commands
- Lists examples of typical use cases:
-
Available Commands (shown after the longest delay):
- Displays a comprehensive list of all enabled slash commands
- Shows command names and descriptions
- Filters out hidden commands
-
Additional Resources:
- Provides links for getting more help
- Shows different resources based on user type (internal vs. external)
Technical Implementation Notes
The help
command demonstrates several effective patterns:
-
Progressive Disclosure: Uses a time-based mechanism to gradually reveal information:
const [count, setCount] = React.useState(0); React.useEffect(() => { const timer = setTimeout(() => { if (count < 3) { setCount(count + 1); } }, 250); return () => clearTimeout(timer); }, [count]);
This approach avoids overwhelming users with too much information at once, showing more details as they spend time on the help screen.
-
Filtering System: Uses
filter
to show only non-hidden commands:const filteredCommands = commands.filter((cmd) => !cmd.isHidden);
This keeps the help screen focused on commands relevant to users.
-
Dynamic Resource Links: Changes help resources based on user type:
const isInternal = process.env.USER_TYPE === "ant"; const moreHelp = isInternal ? "[ANT-ONLY] For more help: go/claude-cli or #claude-cli-feedback" : `Learn more at: ${MACRO.README_URL}`;
This customizes the experience for different user populations.
-
Input Handling: Uses Ink's
useInput
hook to detect when the user presses Enter:useInput((_, key) => { if (key.return) onClose(); });
This allows for clean dismissal of the help screen.
-
Conditional Rendering: Uses the
count
state to progressively show different sections:{ count >= 1 && ( <Box flexDirection="column" marginTop={1}> <Text bold>Usage Modes:</Text> {/* Usage content */} </Box> ); }
This creates the staggered reveal effect for information groups.
User Experience Benefits
The help
command addresses several important needs for CLI tool users:
-
Onboarding Assistance: Provides new users with immediate guidance on how to use the tool effectively.
-
Command Discovery: Makes it easy to see what slash commands are available without having to memorize them.
-
Progressive Learning: The staggered reveal of information allows users to absorb basics first before seeing more advanced options.
-
Usage Examples: Shows concrete examples of common use cases, helping users understand practical applications.
-
Quick Reference: Serves as a compact reference for command options during regular use.
The help command exemplifies Claude Code's approach to user experience: it's focused on being informative while remaining concise and unobtrusive, with multiple levels of detail available as users need them.