# \[技术日志\] claude-agent-sdk 开发第一步

**URL:** <https://linux.do/t/topic/1431541>\
**Category:** 搞七捻三\
**Tags:** 人工智能, 软件开发, 纯水\
**Created:** [2026 年1 月 12 日 06:01 UTC](https://linux.do/t/topic/1431541 "2026-01-12T06:01:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

作者： ![Zenf](https://cdn.ldstatic.com/user_avatar/linux.do/zenf/32/430529_2.png) [@Zenf](https://linux.do/u/Zenf)\
发布日期： [2026 年1 月 12 日 06:01 UTC](https://linux.do/t/topic/1431541/1 "2026-01-12T06:01:01Z")

</div>

最近启动了 [Ally-Health](https://github.com/huifer/Claude-Ally-Health) 项目的可视化工作。

> tips: 申请要个小⭐⭐

在这个可视化工作中我需要完成如下内容

1. 套壳
2. 能够正常交互到 claude code 的工具

遇到的问题

1. 我没有购买 claude code 官方的计划 因此我需要解决中转
2. 如何才可以读取到 某个目录下的 skill 或者斜杠命令

第一个问题的解决方案如下

```auto
# Claude API 配置
ANTHROPIC_API_KEY=GLM秘钥
ANTHROPIC_AUTH_TOKEN=GLM秘钥
ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic

# 工作目录（可选）
WORKSPACE_DIR=/Users/zhangsan/cc-sdk-demo

```

第二个问题需要采用下面代码

```auto
const result = query({
      prompt: '/get-profile',
      // prompt: '项目里面有什么？',

      options: {
        settingSources: ["user", "project", "local"],
        cwd: config.workspaceDir,
        permissionMode: 'bypassPermissions',
        allowDangerouslySkipPermissions: true,
        allowedTools: [
          "Skill",
          "Bash",
          "WebSearch",
          "WebFetch",
          "Bash",
          "Write",
          "Read",
          "Glob",
          "Task",
          "Grep",
          "LS",
          "ExitPlanMode",
          "Edit",
          "MultiEdit",
          "NotebookEdit",
          "TodoWrite",
          "BashOutput",
          "KillBash"
        ],

      }
    });

```

这里特别说明：

1. prompt: ‘/get-profile’, 是我们准备好的命令
2. 

```
 cwd: config.workspaceDir, 是项目目录

```

3. allowedTools 尽量按照上面的内容编写

验证

```auto
    for await (const message of result) {

      if (message.type === "system" && message.subtype === "init") {
        console.log("Available commands:", message.slash_commands);
      }

```

 ![image](https://cdn3.ldstatic.com/original/4X/e/6/f/e6f22a7d5584acb20297bb5fa1d84b084952d993.png)

套壳相关的就不具体展开讨论了~

---

<div class="post-metadata">

作者： ![Midflowers](https://cdn.ldstatic.com/user_avatar/linux.do/midflowers/32/1132030_2.png) [@Midflowers](https://linux.do/u/Midflowers)\
发布日期： [2026 年1 月 12 日 06:02 UTC](https://linux.do/t/topic/1431541/2 "2026-01-12T06:02:31Z")

</div>

支持支持w

---

<div class="post-metadata">

作者： ![handsome](https://cdn.ldstatic.com/user_avatar/linux.do/handsome/32/2484898_2.png) [@handsome](https://linux.do/u/handsome)\
发布日期： [2026 年1 月 12 日 06:56 UTC](https://linux.do/t/topic/1431541/3 "2026-01-12T06:56:24Z")

</div>

太强了，大佬

---

<div class="post-metadata">

作者： ![jettysun](https://cdn.ldstatic.com/user_avatar/linux.do/jettysun/32/2817001_2.png) [@jettysun](https://linux.do/u/jettysun)\
发布日期： [2026 年1 月 26 日 00:22 UTC](https://linux.do/t/topic/1431541/4 "2026-01-26T00:22:37Z")

</div>

在做相同的东西。但是我移除了Bash和Write等权限，因为这个会直接生成文件，比如我说“帮我生成一个贪吃蛇的代码，它会直接在服务器生成”。还有一个，联网搜索中转GLM的时候会搜不到东西，换anthropic就好了，目前还不知道为啥。

---

<div class="post-metadata">

作者： ![nanlandetian](https://cdn.ldstatic.com/user_avatar/linux.do/nanlandetian/32/2617085_2.png) [@nanlandetian](https://linux.do/u/nanlandetian)\
发布日期： [2026 年1 月 26 日 01:54 UTC](https://linux.do/t/topic/1431541/5 "2026-01-26T01:54:19Z")

</div>

佬，现在买了claude max 有什么项目可以中转吗？
