็™ป้Œฒใ—ใฆๆ‹›ๅพ…ใƒชใƒณใ‚ฏใ‚’ๅ…ฑๆœ‰ใ™ใ‚‹ใจใ€ๅ‹•็”ปๅ†็”Ÿๅ ฑ้…ฌใจ็ดนไป‹ๅ ฑ้…ฌใ‚’็ฒๅพ—ใงใใพใ™ใ€‚

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture ๆŠ•็จฟใฏๅ€‹ไบบใฎๆ„่ฆ‹ใงใ™ใ€‚
ๅ‚ๅŠ  May 2026
258 ใƒ•ใ‚ฉใƒญใƒผไธญ    220 ใƒ•ใ‚กใƒณ
# Useful but Little-Known Features of Claude Agent SDK ๐ŸŒ Want Claude to plan changes without touching your code? Plan mode restricts the agent to read-only exploration! Claude Agent SDK's plan mode lets Claude analyze your codebase and propose changes using only read-only tools, never editing source files. ๐Ÿ“Œ Title: Plan Mode (Read-Only Execution Only) ๐Ÿ”— URL: ๐Ÿงฉ Overview Setting `permission_mode="plan"` restricts Claude to read-only tools such as Read, Grep, Glob, and read-only shell commands. Edit, Write, and write-mode Bash operations are blocked. Claude may use `AskUserQuestion` to clarify requirements before finalizing the plan. This mode is ideal for code review, architecture analysis, and change proposals where you want insights without side effects. ๐Ÿ›  How to Use ```python # Python - plan mode for code review import asyncio from claude_agent_sdk import query, ClaudeAgentOptions async def main(): async for message in query( prompt="Analyze security issues in the auth module and propose a fix plan", options=ClaudeAgentOptions( permission_mode="plan", # Read-only analysis ), ): if hasattr(message, "result"): print(message.result) ``` ```typescript // TypeScript for await (const message of query({ prompt: "Analyze security issues in the auth module and propose a fix plan", options: { permissionMode: "plan" // Read-only analysis } })) { if ("result" in message) console.log(message.result); } ``` ๐Ÿ— Integration into Production Systems - Use for automated PR reviews that surface issues and suggestions without modifying code - Safely explore and understand new codebases during onboarding or investigation phases - Implement a "plan then execute" workflow: review the plan, then switch to `acceptEdits` mode - Combine with `set_permission_mode()` to transition from planning to execution after human approval ๐Ÿ’ก Use Cases ๐Ÿ“‹ Generate change proposals in code reviews, leaving actual modifications to human judgment ๐Ÿ” Safely analyze architecture of large codebases without risk of accidental changes ๐Ÿ“ Build refactoring plans for team consensus before execution โš ๏ธ Caveats - Read-only shell commands may still execute - `AskUserQuestion` may be triggered, so for fully unattended operation, dontAsk mode is more appropriate - To act on the plan, you need a new session or a dynamic permission mode change โœจ "Plan first, execute second" is a fundamental engineering practice. Use plan mode to safely analyze, then commit to changes only after you're confident in the approach! #ClaudeAgentSDK# #AIAgent#
ใ‚‚ใฃใจ่ฆ‹ใ‚‹