Source URL: https://simonwillison.net/2025/Apr/19/claude-code-best-practices/#atom-everything
Source: Simon Willison’s Weblog
Title: Claude Code: Best practices for agentic coding
Feedly Summary: Claude Code: Best practices for agentic coding
Extensive new documentation from Anthropic on how to get the best results out of their Claude Code CLI coding agent tool, which includes this fascinating tip:
We recommend using the word “think" to trigger extended thinking mode, which gives Claude additional computation time to evaluate alternatives more thoroughly. These specific phrases are mapped directly to increasing levels of thinking budget in the system: "think" < "think hard" < "think harder" < "ultrathink." Each level allocates progressively more thinking budget for Claude to use. Apparently ultrathink is a magic word! I was curious if this was a feature of the Claude model itself or Claude Code in particular. Claude Code isn't open source but you can view the obfuscated JavaScript for it, and make it a tiny bit less obfuscated by running it through Prettier. With Claude's help I used this recipe: mkdir -p /tmp/claude-code-examine cd /tmp/claude-code-examine npm init -y npm install @anthropic-ai/claude-code cd node_modules/@anthropic-ai/claude-code npx prettier --write cli.js Then used ripgrep to search for "ultrathink": rg ultrathink -C 30 And found this chunk of code: let B = W.message.content.toLowerCase(); if ( B.includes("think harder") || B.includes("think intensely") || B.includes("think longer") || B.includes("think really hard") || B.includes("think super hard") || B.includes("think very hard") || B.includes("ultrathink") ) return ( l1("tengu_thinking", { tokenCount: 31999, messageId: Z, provider: G }), 31999 ); if ( B.includes("think about it") || B.includes("think a lot") || B.includes("think deeply") || B.includes("think hard") || B.includes("think more") || B.includes("megathink") ) return ( l1("tengu_thinking", { tokenCount: 1e4, messageId: Z, provider: G }), 1e4 ); if (B.includes("think")) return ( l1("tengu_thinking", { tokenCount: 4000, messageId: Z, provider: G }), 4000 ); So yeah, it looks like "ultrathink" is a Claude Code feature - presumably that 31999 is a number that affects the token thinking budget, especially since "megathink" maps to 1e4 tokens (10,000) and just plain "think" maps to 4,000. Via @HamelHusain Tags: anthropic, claude, ai-assisted-programming, llm-reasoning, generative-ai, ai, llms AI Summary and Description: Yes Summary: The text describes new documentation from Anthropic about their Claude Code CLI coding agent tool, highlighting a method to enhance its reasoning capabilities through specific command triggers. This information is particularly relevant for professionals in AI and software development as it addresses best practices for optimizing AI-assisted programming. Detailed Description: The provided text details best practices for utilizing the Claude Code tool from Anthropic, focusing specifically on techniques to enhance the tool’s performance in reasoning and code generation tasks. Key points include: - **Extended Thinking Mode**: Users are encouraged to use specific phrases like "think," "think hard," "think harder," and "ultrathink" to engage different levels of reasoning capabilities, referred to as "thinking budgets." - **Incremental Thinking Budgets**: - "think" allocates 4,000 tokens. - "think hard" allocates 10,000 tokens (1e4). - "think harder" allocates 31,999 tokens. - "ultrathink" appears to unlock the highest level of reasoning, potentially allowing the tool to analyze complex requests more thoroughly. - **Exploration of the Tool’s Features**: The author demonstrates how to minimally obfuscate the Claude Code's JavaScript to better understand the function of these triggers, showing a hands-on approach that tech professionals might appreciate. - **Code Example**: A code snippet illustrates how the Claude Code checks for these specific phrases within user inputs, effectively mapping to different reasoning token thresholds. This documentation opens new avenues for developers using AI programming tools by illustrating how to optimize interactions with AI systems to yield better responses and assistive coding features. Emphasizing practical engagement with the code not only enhances user experience but also reinforces understanding of underlying AI mechanisms, which is beneficial for development and infrastructure security in software applications.