chore: update claude-api skill [auto-sync] (#729)

co-sign

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
cc-skill-sync[bot]
2026-03-22 12:16:01 -04:00
committed by GitHub
parent b0cbd3df15
commit 887114fd09
24 changed files with 1625 additions and 169 deletions
+44 -4
View File
@@ -24,7 +24,7 @@ anyio.run(main)
## Custom Tools
Custom tools require an MCP server. Use `ClaudeSDKClient` for full control, or pass the server to `query()` via `mcp_servers`.
Custom tools require an MCP server. Use `ClaudeSDKClient` for full control (custom SDK MCP tools require `ClaudeSDKClient``query()` only supports external stdio/http MCP servers).
```python
import anyio
@@ -216,8 +216,7 @@ async def main():
prompt="Set up the development environment",
options=ClaudeAgentOptions(
allowed_tools=["Bash", "Write"],
permission_mode="bypassPermissions",
allow_dangerously_skip_permissions=True
permission_mode="bypassPermissions"
)
):
pass
@@ -278,7 +277,7 @@ async def main():
options=ClaudeAgentOptions(allowed_tools=["Read", "Glob"])
):
if isinstance(message, SystemMessage) and message.subtype == "init":
session_id = message.session_id
session_id = message.data.get("session_id")
# Resume with full context from the first query
async for message in query(
@@ -293,6 +292,47 @@ anyio.run(main)
---
## Session History
```python
from claude_agent_sdk import list_sessions, get_session_messages
# List past sessions (sync function — no await)
sessions = list_sessions()
for session in sessions:
print(f"Session {session.session_id} in {session.cwd}")
# Retrieve messages from the most recent session (sync function — no await)
if sessions:
messages = get_session_messages(session_id=sessions[0].session_id)
for msg in messages:
print(msg)
```
---
## Session Mutations
```python
from claude_agent_sdk import rename_session, tag_session
session_id = "your-session-id"
# Rename a session
rename_session(session_id=session_id, title="Refactoring auth module")
# Tag a session for filtering
tag_session(session_id=session_id, tag="experiment-v2")
# Clear a tag
tag_session(session_id=session_id, tag=None)
# Scope to a specific project directory
rename_session(session_id=session_id, title="New title", directory="/path/to/project")
```
---
## Custom System Prompt
```python