> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/stackai-mcp/workflow-recipes/attach-a-skill-to-an-llm-node.md).

# Attach a skill to an LLM node

Attach existing instructions to the step that needs them, without rewriting the same instructions in each workflow.

## Before you start

You need an existing skill and edit access to the project. Attaching a skill changes the project draft. Updating the skill itself is a separate operation and immediately changes its latest live version.

## Find the skill and target node

1. Confirm the organization with `whoami`.
2. Use `skills_list` and `skills_get` to inspect the skill's instructions and actions.
3. Read the complete project draft with `projects_get(version="draft")`.
4. Identify the LLM node and its existing `data.skills` array. Keep every attachment you intend to retain.

## Preview the attachment

Call **`projects_edit`** with a direct patch. The example assumes the node is `llm-0` and already has one skill. Replace both IDs and include the full desired array:

```json
{
  "project_id": "<project-id>",
  "direct_patch": [
    {
      "op": "update_node",
      "node_id": "llm-0",
      "patch": {
        "data": {
          "skills": [
            {
              "skill_id": "<existing-skill-id>"
            },
            {
              "skill_id": "<new-skill-id>"
            }
          ]
        }
      }
    }
  ],
  "dry_run": true,
  "publish": false
}
```

The skills array replaces the existing array; it does not append automatically. An empty array detaches all skills.

## Save and verify

Review the returned `delta`. Send the same patch with `dry_run: false` and `publish: false` to save the draft. Call `projects_validate`, then read the target node again and confirm the complete attachment list.

Publish the reviewed draft only when intended. If the skill's instructions later change, agents using the skill resolve its latest version; publishing a project does not pin the skill to an older version.

## Tool reference

* [whoami](https://docs.stackai.com/stackai-mcp/tool-reference/connection-and-organization/whoami.md)
* [skills\_list](https://docs.stackai.com/stackai-mcp/tool-reference/skills-and-versions/skills-list.md)
* [skills\_get](https://docs.stackai.com/stackai-mcp/tool-reference/skills-and-versions/skills-get.md)
* [projects\_get](https://docs.stackai.com/stackai-mcp/tool-reference/projects-and-workflow-authoring/projects-get.md)
* [projects\_edit](https://docs.stackai.com/stackai-mcp/tool-reference/projects-and-workflow-authoring/projects-edit.md)
* [projects\_validate](https://docs.stackai.com/stackai-mcp/tool-reference/projects-and-workflow-authoring/projects-validate.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/stackai-mcp/workflow-recipes/attach-a-skill-to-an-llm-node.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
