|

Claude Code: Automatic Rule Loading via Plugin Marketplace

Automatic Rule Loading via Plugin Marketplace

Rev. 197 | Created: 2026-08-16 | Updated: 2026-10-25 06:57 CDT

Claude logo

1. Goal

이 문서는 Claude Code 전용으로 Desktop interface와 Web interface를 고려한다.

Automatic rule loading을 새 session과 새 machine에서 얻으려면 세 가지를 해 두면 된다.

  1. plugin marketplace에 rule을 기록한다.
  2. 그 marketplace를 remote git repository로 push 한다.
  3. Desktop interface는 user machine의 ~/.claude/settings.json 에, Web interface는 session을 열 때 고르는 remote project repository의 project settings file에, marketplace 등록과 plugin 활성화를 적어 bootstrap 한다.

셋째는 Desktop interface에서는 machine마다 한 번이고, Web interface에서는 여는 repository마다이다.

그 뒤에는 두 가지가 사람의 손을 거치지 않고 이루어진다.

  1. plugin이 새 session 시작 시 최신 상태로 update 된다. Desktop interface에서는 3.2 의 hook을 한 번 갖추어야 이 역할이 돌아간다.
  2. rule이 새 session과 새 prompt에 적용된다.

문서에서 자동이라고 할 때는 이 두 가지를 뜻한다.

2. Architecture

2.1 Plugin Marketplace and Copies

plugin marketplace의 사본은 네 곳에 있고 역할이 서로 다르다. [1]은 원본, [2]는 rule을 고치는 자리, [3]과 [4]는 각 interface가 clone 해 두고 실행하는 사본이다.

             +------------------------------------------------------------+
             |  [1] GitHub                                                |
             |      Remote repository for plugin marketplace              |
             |      marketplace manifest and plugins                      |
             +------------------------------------------------------------+
               ^                           |                           |
       git push|            add and install|            add and install|
        manual |                 automatic |                 automatic |
               |                           v                           v
   +------------------------+  +------------------------+  +------------------------+
   |  [2] Local repository  |  |  [3] Desktop interface |  |  [4] Web interface     |
   |      Working clone     |  |      Installed plugins |  |      Installed plugins |
   |                        |  |      (user machine)    |  |      (container)       |
   |                        |  |                        |  |                        |
   |  author edits          |  |  persists              |  |  discarded             |
   |  push to GitHub        |  |  across sessions       |  |  at session end        |
   +------------------------+  +------------------------+  +------------------------+

Fig. 1. Four copies of the plugin marketplace and how each one is obtained.

add and install은 Claude Code가 [1] 을 marketplace로 등록하고 그 안의 plugin을 설치하는 두 동작이다. settings file에 적힌 두 항목을 읽어 session 시작 시 자동으로 이루어지며, Desktop interface에서는 CLI로 같은 두 동작을 직접 시킬 수도 있다 (3.1).

[3]은 내려받은 사본을 machine의 한 folder 아래에 나누어 둔다. [4]도 같은 것을 내려받지만 저장 경로는 공식 문서에 없고, session이 끝나면 사라진다.

[3] Desktop interface
└── ~/.claude/
    └── plugins/
        ├── marketplaces/<name>/    : clone of <remote repository root>
        └── cache/<...>/            : copy of each plugin folder -> plugin cache

Fig. 2. Where the Desktop interface stores the downloaded marketplace.

[2], [3], [4]는 서로를 참조하지 않는다. 모두 [1]만 바라본다. Claude Code가 읽는 것은 [3] 또는 [4] 뿐이므로, working clone을 수정해도 push 전까지는 동작에 영향이 없다.

수동으로 하는 add and install은 Appendix F 에 있다.

2.2 Plugin Marketplace in Git Repository 🌳

rule을 담는 plugin marketplace는 일반 remote git repository이며, 뼈대는 manifest file 두 개이다. 이 둘만 갖추어 push 해도 등록 가능한 marketplace가 되고, 나머지 folder는 그 위에 얹는 component이다. marketplace는 catalog이고, plugin은 배포 단위이며, 실제 기능은 plugin 안의 component가 제공한다.

remote repository 최상위의 .claude-plugin/marketplace.json 은 자리가 정해져 있다. Claude Code가 remote repository를 내려받은 뒤 이 경로에서 catalog를 찾기 때문이며, 다른 곳에 두면 marketplace로 인식되지 않는다.

반면 plugins/ 라는 folder 이름은 정해진 것이 아니라 관례이다. 각 plugin의 위치는 marketplace.json 의 source 값이 가리키므로 ("source": "./plugins/<plugin-name>"), folder 이름을 달리 하거나 다른 remote repository를 가리켜도 된다. catalog는 자리를 고정하고 내용물은 그 옆에 모아 두는 이 배치 덕분에, remote repository 하나가 plugin 여러 개를 담는 marketplace가 된다.

<local or remote repository root>/
├── .claude-plugin/
│   └── marketplace.json          : Marketplace manifest (catalog)
└── plugins/
    └── <plugin-name>/            : Plugin (distribution unit)
        ├── .claude-plugin/
        │   └── plugin.json       : Plugin manifest
        ├── skills/               : loaded on trigger
        ├── hooks/
        │   ├── hooks.json        : event binding
        │   │                       - UserPromptSubmit : every prompt
        │   │                       - SessionStart     : session start
        │   └── <rule>.md         : text injected into context
        ├── commands/             : slash commands
        └── agents/               : subagents

Fig. 3. Layout of a plugin marketplace in a git repository.

marketplace manifest는 repository 최상위의 .claude-plugin/marketplace.json 하나뿐이며, 어떤 plugin이 어디에 있는지만 나열한다.

plugin manifest는 각 plugin folder 안의 .claude-plugin/plugin.json으로, 그 plugin의 이름과 정보를 담는다. 실제 기능은 plugin folder 아래의 component folder가 담는다.

component 중 load 시점이 고정된 것은 hook뿐이다. 나머지는 조건이 맞을 때만 올라온다.

  • skill: session에는 각 skill의 이름과 description 한 줄만 목록으로 떠 있다. 지금 하는 일이 그 설명과 들어맞는다고 Claude가 판단하면 그때 본문 file을 읽어 들인다. 그래서 description은 언제 쓰는 skill인지가 드러나게 적어야 하고, 그렇지 않으면 skill이 있어도 불려 나오지 않는다. 사용자가 /<skill-name> 을 입력하면 이 판단을 거치지 않고 곧바로 load 된다.
  • command: 사용자가 prompt에 /<command-name> 을 입력할 때 그 file이 load 된다.
  • agent: 사용자가 이름을 대어 지목하거나, Claude가 그 일을 subagent에 넘기기로 할 때 load 된다.
  • hook: hooks.json에 UserPromptSubmit으로 묶은 file은 매 prompt마다 조건 없이 context에 들어간다.

💡 반드시 지켜야 할 rule은 조건에 걸리지 않는 hook 경로에 둔다.

Manifest Examples

marketplace와 plugin manifest의 실제 예시는 다음과 같다. marketplace name은 kebab-case 규격이라 밑줄을 쓰지 않는다. catalog의 plugins 는 배열이므로, plugin을 여러 개 두면 entry를 나란히 적는다.

// .claude-plugin/marketplace.json
{
  "name": "<MARKETPLACE_NAME>",
  "owner": { "name": "<OWNER_NAME>", "email": "<OWNER_EMAIL>" },
  "plugins": [
    {
      "name": "<PLUGIN_NAME>",
      "source": "./plugins/<PLUGIN_NAME>",
      "description": "<PLUGIN_DESCRIPTION>"
    },
    {
      "name": "<PLUGIN_NAME_2>",
      "source": "./plugins/<PLUGIN_NAME_2>",
      "description": "<PLUGIN_DESCRIPTION_2>"
    }
  ]
}
// plugins/<PLUGIN_NAME>/.claude-plugin/plugin.json
{
  "name": "<PLUGIN_NAME>",
  "description": "<PLUGIN_DESCRIPTION>"
}

⛔ plugin.json에 version field는 넣지 않는다. version을 적으면 그 값이 바뀔 때까지 plugin이 갱신되지 않는다 (pin). 값을 그대로 두고 내용만 push 하면 Claude Code는 같은 version으로 판정하여 cache 사본을 유지한다. version을 생략하면 commit SHA가 version이 되어, push 할 때마다 새 version으로 인식되고 자동으로 갱신된다.

source 에 git-subdir 를 쓰면 다른 remote repository의 특정 folder를 plugin으로 삼는다. url 이 repository를, path 가 그 안의 folder를 가리킨다.

// .claude-plugin/marketplace.json
{
  "plugins": [
    {
      "name": "<PLUGIN_NAME>",
      "source": {
        "source": "git-subdir",
        "url": "https://github.com/<OWNER>/<REPO>.git",
        "path": "plugins/<PLUGIN_NAME>",
        "ref": "main"
      }
    }
  ]
}

ref 는 따라갈 branch이다. sha 를 함께 적으면 그 commit에 고정되어 갱신이 멈추므로, 최신을 따라가려면 ref 만 둔다.

3. Bootstrap

Interface에 따라, automatic rule loading을 위해, 직접 작성하여야 하는 file이 다르다.

Table 1. Where each interface is bootstrapped.

Interface Settings file Git repository File location Session Start Hook
Desktop ~/.claude/settings.json no user machine required
Web <project>/.claude/settings.json yes remote project repository not required

settings.json의 extraKnownMarketplaces 와 enabledPlugins 는 어느 interface에서든 있어야 plugin이 올라온다. 내용은 같고 적는 자리만 다르며, Desktop은 machine에 한 번 작성으로 완료되고, Web은 session을 열 때 고르는 remote project repository마다 적어 push 한다. Desktop도 project settings를 함께 읽지만 machine settings 하나면 그 machine의 모든 project가 덮이므로 표에는 그 자리만 적었다 (3.1).

Session Start Hook은 사람이 한 번 작성해 marketplace에 넣어 두는 Desktop 전용 항목이다. Desktop app이 session 프로세스에 DISABLE_AUTOUPDATER=1 을 심어 "autoUpdate": true 가 실행되지 않으므로, plugin이 설치 당시 commit에 고정되어 rule을 push 해도 따라오지 않는다. 그 갱신을 hook이 대신한다. Web은 session마다 새로 clone 하므로 갱신이 저절로 되어 hook이 필요 없다.

💡 사람이 적는 것은 Table 1의 settings file과 hook뿐이고, 그 뒤의 rule은 모두 clone 된 사본에서 온다. Desktop interface는 내려받아 둔 marketplace 사본을, Web interface는 session 시작 시 만들어진 clone을 읽는다.

3.1 Settings.json in Desktop Interface

자리가 둘이며 이름은 같지만 적용 범위가 다르다. 두 자리 모두 읽으며, 같은 내용이 있으면 병합되고 겹치는 값은 project settings가 이긴다.

Table 2. The two settings files the Desktop interface reads.

Settings file Git repository File location Coverage Delivery
~/.claude/settings.json no user machine machine written once per machine
<project>/.claude/settings.json yes user machine project kept in the local repository,
so it applies when the project is opened

💡 두 file은 자동으로 갱신되지 않는다. Claude Code가 project를 git pull 하지 않으므로 사람이 pull 해야 하며, 자동으로 갱신되는 것은 marketplace 사본뿐이다.

machine settings ~/.claude/settings.json 에 적는 내용은 다음과 같다.

// ~/.claude/settings.json
{
  "extraKnownMarketplaces": {
    "<MARKETPLACE_NAME>": {
      "source": {
        "source": "github",
        "repo": "<OWNER>/<REPO>"
      },
      "autoUpdate": true
    }
  },
  "enabledPlugins": {
    "<PLUGIN_NAME>@<MARKETPLACE_NAME>": true,
    "<PLUGIN_NAME_2>@<MARKETPLACE_NAME>": true
  }
}

💡 "autoUpdate": true 는 marketplace를 GitHub 최신 기준으로 갱신하라는 지시이다. 나머지 field는 무엇을 받을지 가리킬 뿐이고, 갱신 대상을 정하는 것은 이 값이다. Desktop interface에서는 DISABLE_AUTOUPDATER=1 때문에 이 지시가 실행되지 않지만, 같은 file을 Web에서도 쓰고 Desktop app이 이 제약을 거두면 그대로 동작하므로 적어 둔다. 실행되지 않는 동안의 갱신은 3.2 의 hook이 맡는다.

settings file에 사람이 적어야 하는 것은 extraKnownMarketplaces 와 enabledPlugins 두 항목뿐이다. 이 둘은 marketplace를 처음 가리키는 bootstrap이라 marketplace 자신이 배포할 수 없다.

  • extraKnownMarketplaces: marketplace의 이름과 source를 등록한다.
  • source.source: source type을 지정하며 github, git, url, npm, file, directory 를 지원한다.
  • autoUpdate: marketplace와 plugin을 session 시작 시 갱신 대상으로 삼는다.
  • enabledPlugins: plugin-name@marketplace-name 형식의 key를 true로 두어 활성화한다. 한 marketplace의 plugin이 여럿이면 쓰려는 plugin마다 한 줄씩 적고, 적지 않은 plugin은 그 repository에서 꺼진 채로 남는다.

방법은 세 가지이다. 앞의 둘은 settings file에 적고, CLI는 file을 거치지 않고 같은 등록과 활성화를 곧바로 한다.

Editor

file을 직접 열어 위의 JSON을 적는다. Claude Code가 관리하는 Appendix E 의 상태 file과 달리 사용자의 file이므로 손대도 된다.

Prompt

file을 열지 않고 prompt에서 지시하면 Claude가 위의 JSON과 같은 내용을 만들어 넣는다.

# prompt
~/.claude/settings.json에 extraKnownMarketplaces로
<OWNER>/<REPO> (github source, autoUpdate: true)을
<MARKETPLACE_NAME> 이름으로 등록하고,
enabledPlugins에 <PLUGIN_NAME>@<MARKETPLACE_NAME>: true 를 추가해줘.

CLI

add 와 install 두 명령을 terminal에서 실행하거나 prompt에 적어 Claude에게 시키면 각각 marketplace 등록과 plugin 설치가 이루어지며, 결과는 settings file이 아니라 Appendix E 의 상태 file에 기록된다. CLI 설치는 Appendix B 를 본다.

# claude CLI, or prompt asking Claude to run them
claude plugin marketplace add <OWNER>/<REPO>
claude plugin install <PLUGIN_NAME>@<MARKETPLACE_NAME>

3.2 Session Start Hook in Desktop Interface

💡 SessionStart hook이 update 두 명령을 실행하면 사람이 개입하지 않아도 session을 열 때마다 갱신이 이루어진다. Desktop interface에서 autoUpdate를 대신하는 자리이다.

# claude CLI, or prompt asking Claude to run them
claude plugin marketplace update <MARKETPLACE_NAME>
claude plugin update <PLUGIN_NAME>@<MARKETPLACE_NAME>

앞 명령은 marketplace clone을 최신 commit으로 옮기고, 뒤 명령은 설치본을 그 commit의 cache 사본으로 다시 고정한다. 앞 명령만으로는 설치본이 그대로이므로 둘을 차례로 실행해야 하며, 그렇게 갱신해도 지금 열려 있는 session이 아니라 다음 session부터 적용된다.

hook 자체는 plugin의 hooks/hooks.json 에 두고, 두 명령은 그 file이 부르는 script에 담는다. UserPromptSubmit과 같은 file에 나란히 놓이며, 전문은 다음과 같다.

// plugins/<PLUGIN_NAME>/hooks/hooks.json
{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "cat \"${CLAUDE_PLUGIN_ROOT}/hooks/conversation-rules.md\" \"${CLAUDE_PLUGIN_ROOT}/hooks/skill-loading-rules.md\""
          }
        ]
      }
    ],
    "SessionStart": [
      {
        "matcher": "startup",
        "hooks": [
          {
            "type": "command",
            "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/update-plugins.sh\"",
            "timeout": 180
          }
        ]
      }
    ]
  }
}

갱신 script는 같은 folder에 둔다. hooks.json 에 한 줄로 넣으면 길어져 읽기 어려우므로 file로 나누며, ${CLAUDE_PLUGIN_ROOT} 는 Claude Code가 그 plugin의 설치 folder로 바꾸어 준다.

# plugins/<PLUGIN_NAME>/hooks/update-plugins.sh
{
  command -v claude >/dev/null 2>&1 || { echo "claude CLI not found; skipping plugin self-update"; exit 0; }
  state="$HOME/.claude/plugins/installed_plugins.json"
  [ -f "$state" ] || { echo "no installed plugins"; exit 0; }
  date "+=== session start %Y-%m-%d %H:%M:%S"
  claude plugin marketplace update
  for p in $(grep -oE '"[A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+"' "$state" | tr -d '"' | sort -u); do
    claude plugin update "$p"
  done
} >> "$HOME/.claude/plugin-autoupdate.log" 2>&1

두 file을 만드는 방법은 두 가지이다. claude CLI에는 file을 만드는 명령이 없어 여기서는 쓰지 못한다.

Editor

두 file을 직접 만들어 위의 code block을 그대로 적는다. 만든 뒤에는 marketplace에 push 한다.

Prompt

위 code block을 그대로 붙여 넣고 file을 지정하면 Claude가 그 내용대로 만들어 넣는다. 설명으로 시키는 것과 달리 문구 해석이 끼지 않아 문서와 같은 file이 된다.

⛔ 첫 줄의 파일명 주석은 빼고 붙여 넣는다. JSON은 주석을 허용하지 않아 // 줄이 들어가면 hooks.json 을 읽을 때 실패한다. 이 주석은 code가 어느 file인지 문서에서 표시하는 표기일 뿐이고, 경로는 prompt에 따로 적는다.

# prompt
아래 내용 그대로 plugins/<PLUGIN_NAME>/hooks/hooks.json 을 만들어줘.
(hooks.json code block을 여기에 붙여 넣는다)

update-plugins.sh 도 경로와 code block만 바꾸어 같은 방식으로 지시한다.

Distribution

이 hook은 사람이 한 번 작성해 marketplace에 넣어 두면 그다음부터는 plugin과 함께 배포된다. 다른 machine은 plugin을 설치하는 것만으로 같은 갱신 동작을 얻으므로, 손으로 갖추는 것은 처음 한 번뿐이다.

3.3 Settings.json in Web Interface

settings.json에 적는 두 항목은 3.1 의 JSON과 같고, 그 file이 <project>/.claude/settings.json 이라는 점만 다르다. machine이 없어 자리가 하나뿐이며, 이 file은 session을 열 때 고르는 remote project repository 안에 있어야 하고 clone 되면서 그대로 따라온다.

Remote project repository
└── .claude/
    └── settings.json           : project settings - written and pushed by the author

Fig. 4. Where the settings file sits before the session starts.

Cloud session
└── <project>/                  : clone of the remote project repository
    └── .claude/
        └── settings.json       : project settings - the project only

Fig. 5. The same file after the cloud session clones the repository.

방법은 두 가지이다. Web interface에는 terminal도 CLI도 없으므로 CLI는 쓰지 못하며, 어느 쪽으로 만들든 remote project repository에 push 해야 session에 따라온다.

Editor

local repository (author machine) 에서 .claude/settings.json 을 직접 열어 3.1 의 JSON을 적고 push 한다. remote git repository의 url은 git remote -v 로 확인한다.

Prompt

prompt에서 지시하면 Claude가 만들어 넣는다.

# prompt
이 repository의 .claude/settings.json에 extraKnownMarketplaces로
<OWNER>/<REPO> (github source, autoUpdate: true)을
<MARKETPLACE_NAME> 이름으로 등록하고,
enabledPlugins에 <PLUGIN_NAME>@<MARKETPLACE_NAME>: true 를 추가해줘.

Claude가 고치는 것은 열려 있는 사본이므로, 이렇게 만든 뒤에도 remote project repository에 push 해야 session에 따라온다.

4. Verification

4.1 Session Command (Desktop)

prompt에 다음을 입력하면 설치된 marketplace와 plugin 목록을 확인할 수 있다.

# prompt
Show known_marketplaces.json
Show installed_plugins.json
Show me the installed plugins as a tree diagram
Show the active <SKILL_NAME> skill.

두 file의 상세는 Appendix E 에 있다.

4.2 Claude CLI (Desktop)

Desktop interface에서는 claude CLI로도 확인할 수 있다. shell 종류와 무관하므로 PowerShell, bash 등 아무 terminal에서나 실행하며, 같은 명령을 prompt에 적어 Claude에게 시켜도 된다. 단, CLI는 별도 설치가 필요하다. 설치 방법은 Appendix B 를 본다.

# claude CLI, or prompt asking Claude to run them
claude plugin marketplace list
claude plugin list
claude plugin details <PLUGIN_NAME>@<MARKETPLACE_NAME>

details 결과에 skill과 hook이 나타나면 정상이다. plugin마다 담은 component가 다르므로 details 는 확인할 plugin마다 실행한다.

4.3 Session Content (Web)

Web interface에는 terminal도 /plugin 도 없고 상태 file도 session이 끝나면 사라지므로, 설치 목록 대신 session에 rule이 실제로 올라왔는지로 확인한다. 셋 중 하나만 확인되어도 plugin이 붙은 것이다.

# prompt
context에 들어온 rule을 그대로 보여줘
쓸 수 있는 skill을 나열해줘
/context

첫 입력에는 hooks/ 의 rule file 내용이, 둘째 입력에는 plugin의 skill 이름과 description이 나오면 정상이다. /context 는 cloud session에서 동작하는 명령으로 지금 context에 올라온 것을 나열한다. 셋 다 비어 있으면 그 repository의 .claude/settings.json 부터 본다 (3.3).

5. Extension

확장은 모두 2.2 의 구조대로 local repository에 더하고 push 한다. push 하면 marketplace를 통해 두 interface의 새 session에 함께 따라오므로, settings file은 다시 건드리지 않는다. plugin을 새로 만드는 경우만 예외로 settings file의 enabledPlugins 에 한 줄이 더 필요하며, 이는 두 interface에 모두 해당한다 (3.1, 3.3).

remote repository에는 Claude Code가 읽는 경로가 정해져 있다. 그 밖의 file과 folder는 무시되므로 자유롭게 추가할 수 있다. 이 절의 확장이 놓이는 자리는 다음과 같다.

<local or remote repository root>/
├── .claude-plugin/
│   └── marketplace.json          : register when adding a plugin
├── plugins/
│   └── <plugin-name>/
│       ├── .claude-plugin/
│       │   └── plugin.json
│       ├── hooks/
│       │   ├── hooks.json
│       │   └── <rule>.md
│       ├── commands/
│       │   └── <command>.md
│       ├── agents/
│       │   └── <agent>.md
│       └── skills/
│           └── <skill-name>/
│               ├── SKILL.md
│               └── references/
│                   └── <topic>.md
└── docs/                         : non-loaded document

Fig. 6. Where each kind of extension is placed.

  • Hook: hooks/ 에 rule file을 추가하고 hooks.json에 event를 연결한다. UserPromptSubmit에 묶으면 매 prompt마다 조건 없이 context에 들어간다. 같은 file에 SessionStart를 함께 묶을 수 있으며, plugin이 자신을 갱신하는 hook이 그 자리에 놓인다.
  • Command: commands/ 에 md file을 추가하면 file 이름이 slash command 이름이 된다. 사용자가 /<command-name> 을 입력할 때만 load 된다.
  • Agent: agents/ 에 md file을 추가한다. subagent의 정의이며, 사용자가 지목하거나 Claude가 일을 넘길 때만 load 된다.
  • Plugin: plugins/ 아래에 새 plugin folder를 만들고 .claude-plugin/plugin.json을 둔다. marketplace.json 등록이 필요한 유일한 확장이다. plugin은 소비하는 repository가 켜고 끄는 단위이므로, 일부 repository에서만 쓰는 component는 별도 plugin으로 나눈다. 나누면 그 component를 쓰지 않는 repository의 session이 그것을 싣지 않는다.
  • Skill and reference file: skills/<skill-name>/SKILL.md 를 추가한다. folder 이름이 skill 이름이 되고, 상세 내용은 references/ 로 분리한다. description이 지금 하는 일과 맞을 때 또는 사용자가 /<skill-name> 을 입력할 때 load 된다. 작성 방법은 Appendix D 를 본다.
  • Non-loaded document: 설계 memo나 참고 자료처럼 Claude Code가 읽을 필요가 없는 문서는 plugin 구조 밖에 둔다. docs/ 같은 folder는 무시되므로 동작에 영향을 주지 않는다.

remote repository 전체가 실행용 사본으로 복사되므로 용량이 큰 file은 피한다. 필요하면 settings file의 source object에 "sparsePaths": [<path>, ...] 를 지정하여 일부 folder만 받도록 제한할 수 있다.

6. Constraints

두 interface에 공통인 제약이다.

  • plugin에 담을 수 있는 component는 skill, hook, command, agent뿐이다. CLAUDE.md는 plugin에 담을 수 없으므로, 반드시 지켜야 할 지시는 매 prompt 주입되는 UserPromptSubmit hook에 둔다.
  • 저장된 CLAUDE.md를 치환하는 것은, hook이 임의의 command를 실행할 수 있으므로, SessionStart hook에 "cache의 CLAUDE.md를 project로 복사"를 시켜서 기술적으로 가능하다. 하지만 CLAUDE.md는 session 시작 시 읽히는데, hook도 session 시작 시 돌므로 복사 결과가 이번 session에 잡힌다는 보장이 없다.
  • 갱신은 지금 열려 있는 session이 아니라 다음 session부터 적용되므로, push와 적용 사이에 한 session의 지연이 남는다.
  • private remote repository는 GitHub 인증이 된 환경에서만 설치된다. 설치가 실패하면 remote repository 공개 범위를 확인한다.

Desktop interface에만 해당하는 제약이다.

  • "autoUpdate": true 는 DISABLE_AUTOUPDATER=1 때문에 실행되지 않으므로, 갱신은 3.2 의 hook이 맡는다. 이 hook을 두지 않으면 갱신이 자동으로 이루어지지 않는다.
  • settings file은 자동으로 pull 되지 않는다 (3.1).

조직 단위로 배포하는 server-managed settings는 두 interface에 모두 적용되며, Team이나 Enterprise plan에서 owner 또는 admin이 claude.ai의 admin 화면에서 설정한다. enabledPlugins로 특정 plugin을 강제할 수는 있으나 extraKnownMarketplaces를 이 경로로 배포하는 방법은 문서에 없으므로, marketplace 등록은 여전히 Table 1 의 settings file이 맡는다.

Appendix A. Terminology

  • Agent: plugin의 agents/ 에 두는 subagent 정의이다. 사용자가 지목하거나 Claude가 일을 넘길 때 load 된다.

  • autoUpdate: marketplace 등록 항목의 field이다. session 시작 시 marketplace와 plugin을 remote 기준으로 갱신하지만, Desktop interface에서는 DISABLE_AUTOUPDATER=1 때문에 실행되지 않는다.

  • Bootstrap: marketplace가 스스로 배포할 수 없어 사람이 한 번 갖추어 주는 것이다. settings file에 적는 extraKnownMarketplaces 와 enabledPlugins 두 항목이 여기에 들고, Desktop interface에서는 갱신을 맡는 Session Start Hook도 처음 한 번은 함께 놓는다.

  • claude.ai: Claude 계정으로 접속하는 web service이다. Web interface는 이 service 안에서 열리며, 개인 skill을 켜고 끄는 화면과 조직의 server-managed settings를 다루는 admin 화면도 여기에 있다. 두 interface가 코드를 다루는 곳이라면, claude.ai는 계정과 조직을 다루는 곳이다.

  • Claude Code in the Desktop: local machine에서 실행하는 interface이다. ~/.claude/ 아래의 machine settings와 plugin cache를 사용한다. Desktop interface로 줄여 쓴다.

  • Claude Code on the Web: cloud에서 remote repository를 clone 하여 실행하는 interface이다. local file system이 없으므로 remote repository에 push 된 설정만 적용된다. Web interface로 줄여 쓴다.

  • Command: plugin의 commands/ 에 두는 md file이다. file 이름이 곧 명령 이름이 되며, 사용자가 /<command-name> 을 입력할 때 load 된다.

  • Context: model이 응답을 만들 때 참조하는 입력 전체이다. 대화 내용과 함께 load 된 skill, hook이 주입한 rule이 여기에 들어간다. 크기에 한계가 있으므로 항상 load 되는 file은 짧게 유지한다.

  • DISABLE_AUTOUPDATER: Desktop app이 session 프로세스에 심는 환경변수이다. 값이 1 이면 plugin 자동 갱신이 skip 되며, settings file의 env block으로 덮이지 않는다.

  • Hook: 지정한 event에 개입하는 실행 지점이다. session 시작 시 동작하는 SessionStart hook과 매 prompt마다 동작하는 UserPromptSubmit hook을 사용한다.

  • kebab-case: 낱말을 모두 소문자로 적고 사이를 hyphen ( - ) 으로 잇는 이름 규격이다. 밑줄과 대문자를 쓰지 않으므로 yrocket_md_doc 가 아니라 yrocket-md-doc 으로 적는다.

  • Machine settings: ~/.claude/settings.json 이다. 사용자가 자기 machine에 두는 file이므로 그 machine의 모든 project에 적용되고, git 밖에 있어 machine마다 새로 갖추어야 한다. Web interface에는 존재하지 않는다.

  • Marketplace: plugin의 catalog이다. .claude-plugin/marketplace.json 하나로 정의하며, 어떤 plugin이 어디에 있는지 나열한다.

  • Plugin: 배포 단위이다. .claude-plugin/plugin.json에 자신의 이름과 정보를 두고, 하위 folder에 skill, hook, command, agent를 담는다.

  • Plugin cache: Desktop interface가 내려받은 plugin을 실행하는 위치인 ~/.claude/plugins/cache/ 이다. 원본을 그 자리에서 쓰지 않고 이곳으로 복사해 실행한다. Claude Code가 관리하므로 직접 수정하지 않는다.

  • Plugin marketplace: marketplace manifest와 plugin들을 함께 담은 git repository 전체이다. rule은 이 안에서 관리되며, 사람은 local repository에서 고쳐 push 하고 각 interface는 remote repository에서 내려받아 쓴다.

  • Project in Claude Code: 작업 중인 directory 그 자체이며, 보통 local git repository이다. 별도로 등록하는 절차가 없고, Claude Code를 연 위치가 곧 project가 된다. .claude/ 와 CLAUDE.md도 그 directory를 기준으로 찾는다. Web interface에서는 clone 된 remote repository가 project가 된다.

  • Project settings: project의 .claude/settings.json 이다. Desktop interface는 local repository의 사본을 읽고, Web interface는 session 시작 시 clone 된 remote repository의 사본을 읽는다.

  • Prompt: session 안에서 사용자가 보내는 한 번의 입력이다. session보다 작은 단위이며, UserPromptSubmit hook은 이 단위로 동작한다.

  • Server-managed settings: 조직 단위로 배포되는 settings이다. Team이나 Enterprise plan의 조직에서 owner 또는 admin이 claude.ai의 admin 화면에서 설정하며, session 시작 시 서버에서 내려와 두 interface에 모두 적용된다. OS 단위로 배포하는 managed settings file과 달리 Web interface까지 도달한다.

  • Session: 하나의 Claude Code 실행 단위이다. 시작 시점에 settings, plugin, CLAUDE.md, hook 정의를 읽어 들이고, 그 구성으로 대화가 끝날 때까지 동작한다. rule 변경이 반영되는 경계가 곧 session이다.

  • Session Start Hook: SessionStart event에 걸어 두는 hook이다. Desktop interface에서 실행되지 않는 autoUpdate를 대신하여 session을 열 때마다 marketplace와 plugin을 갱신한다.

  • Skill: 필요한 시점에 load 되는 rule 묶음이다. folder 이름이 skill 이름이 되고, SKILL.md의 description이 지금 하는 일과 맞을 때 load 된다. 사용자가 /<skill-name> 을 입력해 곧바로 부를 수도 있다.

  • Working clone: rule을 수정하기 위해 받아 둔 plugin marketplace의 local repository이다. Fig. 1의 [2] 가 이것이며, 실행에는 쓰이지 않고 push를 통해서만 동작에 반영된다.

  • Working directory: Claude Code를 실행한 folder이다. 이 folder가 곧 project가 되며, .claude/ 와 CLAUDE.md도 이 위치를 기준으로 찾는다.

Appendix B. Claude CLI (Desktop)

B.1 CLI Installation

이 appendix는 Desktop interface에만 해당한다. Web interface에는 terminal이 없어 CLI를 쓸 수 없다.

Desktop app을 설치해도 claude CLI는 PATH에 들어오지 않는다. terminal에서 claude 명령을 쓰려면 별도로 설치한다.

Table 3. CLI installation command per environment.

Environment Command
Windows (PowerShell) # Windows shell
irm https://claude.ai/install.ps1 | iex
macOS / Linux / WSL # Bash
curl -fsSL https://claude.ai/install.sh | bash

WSL은 Windows와 별개의 환경이므로 양쪽에서 쓰려면 각각 설치한다. 설치 후 terminal을 새로 열고 claude --version 으로 설치를 확인한다.

B.2 CLI Commands

plugin 관련 명령들이며, terminal에서 실행하거나 prompt에 적어 Claude에게 시킨다.

  • claude plugin marketplace add <OWNER>/<REPO>: plugin marketplace를 등록한다.
  • claude plugin install <PLUGIN_NAME>@<MARKETPLACE_NAME>: plugin을 설치한다.
  • claude plugin marketplace update <MARKETPLACE_NAME>: marketplace clone을 최신 commit으로 옮긴다.
  • claude plugin update <PLUGIN_NAME>@<MARKETPLACE_NAME>: 설치본을 새 commit의 cache 사본으로 다시 고정한다.
  • claude plugin marketplace list, claude plugin list, claude plugin details <PLUGIN_NAME>@<MARKETPLACE_NAME>: 등록과 설치 상태를 확인한다 (4.2).

Appendix C. Prompt Command

session의 prompt에 입력하는 명령이다. 다음 하나는 두 interface에서 같다.

  • /<skill-name>: description의 판단과 무관하게 그 skill을 바로 load 한다.

/plugin 명령은 Desktop interface의 prompt에서 동작하지 않을 수 있다. 그때는 Appendix B 의 CLI 명령을 prompt에 적어 Claude에게 시킨다. Web interface에는 /plugin 도 CLI도 없으므로 이 방법을 쓸 수 없고, 확인은 4.3 을 본다.

Appendix D. Skill

D.1 Skill

새 rule 묶음은 2.2 의 구조대로 local repository에 skill folder를 추가해 push 하는 것으로 끝난다. plugin manifest는 수정하지 않아도 되고, push 하면 두 interface의 새 session에 함께 따라온다.

어느 plugin에 둘지는 그 skill을 켜야 하는 repository의 범위로 정한다. 모든 repository가 쓰는 skill은 기존 plugin에 두고, 일부만 쓰는 skill은 5 의 기준대로 별도 plugin에 둔다. skill의 정식 이름에는 plugin 이름이 namespace로 붙어 <PLUGIN_NAME>:<skill-name> 이 되므로, 옮기면 그 이름도 함께 바뀐다.

file 이름은 반드시 SKILL.md이며, folder 이름이 skill 이름이 된다. frontmatter의 description이 언제 이 skill을 load 할지 판단하는 근거이므로, 적용 시점을 분명히 적는다.

---
name: <skill-name>
description: 적용 대상과 load 시점을 명시한다.
---

사용자가 prompt에 /<skill-name> 을 입력하면 description의 판단과 무관하게 그 skill이 바로 load 된다.

D.2 Reference File

skill의 상세 내용은 별도 file로 분리하고 SKILL.md에서 가리킨다. SKILL.md는 항상 load 되지만 reference file은 필요할 때만 읽히므로, 기본 context 소비를 줄이면서 깊은 내용에 도달할 수 있다.

skills/<skill-name>/
├── SKILL.md              (always loaded, keep short)
└── references/
    └── <topic>.md        (loaded on demand)

Fig. 7. A skill folder and its reference file.

Appendix E. Plugin State Files (Desktop)

~/.claude/plugins/ 아래의 두 file은 Claude Code가 plugin 기능을 실제로 사용할 때 자동으로 생성하고 관리하는 내부 상태 file이다. 이 경로는 machine에 있으므로 Desktop interface에만 남으며, Web interface의 상태는 session이 끝나면 사라진다.

  • known_marketplaces.json: marketplace를 처음 추가할 때 (settings file의 extraKnownMarketplaces 항목을 읽어 clone 할 때) 생성된다. marketplace를 하나도 등록한 적 없는 새 설치 환경에는 없다.
  • installed_plugins.json: plugin을 처음 설치할 때 생성된다. 마찬가지로 설치한 plugin이 없으면 없다.

예시는 다음과 같다.

known_marketplaces.json — 등록된 marketplace와 그 clone 위치, 마지막 갱신 시각을 기록한다:

// ~/.claude/plugins/known_marketplaces.json
{
  "<MARKETPLACE_NAME>": {
    "source": {
      "source": "github",
      "repo": "<OWNER>/<REPO>"
    },
    "installLocation": "<USER_HOME>\\.claude\\plugins\\marketplaces\\<MARKETPLACE_NAME>",
    "lastUpdated": "<TIMESTAMP>",
    "autoUpdate": true
  }
}

installed_plugins.json — 설치된 plugin의 version, 설치 시각, 설치 당시의 commit을 기록한다. plugin.json에 version field가 없으면 commit SHA가 version으로 기록된다:

// ~/.claude/plugins/installed_plugins.json
{
  "version": 2,
  "plugins": {
    "<PLUGIN_NAME>@<MARKETPLACE_NAME>": [
      {
        "scope": "user",
        "installPath": "<USER_HOME>\\.claude\\plugins\\cache\\<MARKETPLACE_NAME>\\<PLUGIN_NAME>\\<COMMIT_SHA>",
        "version": "<COMMIT_SHA>",
        "installedAt": "<TIMESTAMP>",
        "lastUpdated": "<TIMESTAMP>",
        "gitCommitSha": "<COMMIT_SHA>"
      }
    ]
  }
}

Appendix F. Manual Add and Install

add and install은 settings file을 읽어 session 시작 시 자동으로 이루어지지만, Desktop interface에서는 다음 두 명령으로 같은 두 동작을 손으로 시킬 수도 있다. 이미 등록과 설치를 마친 뒤라면 두 명령이 그 자리를 remote repository의 최신 commit으로 다시 맞춘다. CLI 설치는 Appendix B 를 본다.

# claude CLI, or prompt asking Claude to run them
claude plugin marketplace update <MARKETPLACE_NAME>
claude plugin update <PLUGIN_NAME>@<MARKETPLACE_NAME>
  • claude plugin marketplace update <MARKETPLACE_NAME>: marketplace clone을 최신 commit으로 옮긴다. 이때 옮겨지는 것은 clone뿐이고 설치본은 그대로이다.
  • claude plugin update <PLUGIN_NAME>@<MARKETPLACE_NAME>: 그 commit의 plugin folder를 plugin cache로 새로 복사하고 설치본을 그 사본에 다시 고정한다.

앞 명령이 clone을 옮겨 놓아야 뒤 명령이 새 내용을 집으므로 순서를 지켜 차례로 실행하며, 갱신 결과는 다음 session부터 적용된다. 같은 두 명령을 session 시작 시 자동으로 실행하는 것이 3.2 의 hook이다.

Appendix G. Obsidian

Obsidian은 local folder에 놓인 md file을 그대로 읽고 쓰는 편집 도구이다. 자체 file 형식이나 database를 두지 않고, folder 하나를 vault로 지정해 그 안의 md file을 note로 다룬다. file 사이의 link를 따라가거나 전체를 한 번에 검색하는 기능이 편집기와 다른 점이다.

rule은 결국 md file이므로 Obsidian으로 편집할 수 있다. vault에 별도의 형식이 없으므로 working clone을 vault로 삼으면 그대로 열린다. 이 appendix는 author의 machine에서 rule을 고치는 이야기이며, 두 interface의 동작에는 영향을 주지 않는다.

G.1 Vault Placement

배치는 세 가지가 있다.

Table 4. Three ways to place the working clone in an Obsidian vault.

Placement Description Note
open the working clone itself as a vault a standalone vault holding only the rules simplest, and nothing else is mixed in
keep the working clone inside an existing vault a vault subfolder becomes a local git repository searchable with existing notes, but a vault sync tool and git touch the same files
keep it outside the vault and add a symlink the files live outside and the vault holds only a link placement is free, but Obsidian may treat the target as outside the vault

기록용 vault를 이미 쓰고 있다면 첫 번째를 권한다. rule의 remote repository는 push 시점이 곧 배포 시점이라, 일반 note와 commit 주기를 섞지 않는 편이 안전하다.

G.2 Link Style

Obsidian의 기본 link 형식인 [[wikilink]] 는 Claude Code가 해석하지 않는다. skill이 reference file을 가리키는 link는 상대 경로 markdown link로 적는다.

좋음: 자세한 내용은 [naming](references/naming.md) 을 본다.
나쁨: 자세한 내용은 [[naming]] 을 본다.

Obsidian 설정에서 wikilink를 끄고 link를 상대 경로로 두면, 새로 만드는 link도 같은 형식이 된다. vault 안에서만 쓰는 note끼리는 wikilink를 써도 무방하지만, plugin folder 아래 file에는 쓰지 않는다.

G.3 File Hygiene

working clone 자체를 vault로 열었을 때의 구조는 다음과 같다. Obsidian이 더하는 것은 최상위의 .obsidian/ 하나뿐이다.

<working clone> = vault root
├── .obsidian/                : Obsidian settings, not read by Claude Code
│   ├── app.json              : editor settings, link format set here
│   ├── workspace.json        : window layout, changes often
│   └── plugins/              : Obsidian community plugin
├── .claude-plugin/
│   └── marketplace.json
├── plugins/                  : Claude Code plugins, keep attachments out
│   └── <plugin-name>/
│       ├── .claude-plugin/
│       │   └── plugin.json
│       └── skills/
│           └── <skill-name>/
│               ├── SKILL.md
│               └── references/
└── docs/
    ├── <document>.md
    └── assets/               : set attachment location here

Fig. 8. The working clone opened as an Obsidian vault.

plugins 라는 이름이 두 곳에 나오지만 서로 관계가 없다. .obsidian/plugins/ 는 Obsidian이 쓰는 것이고, 최상위의 plugins/ 는 Claude Code가 쓰는 것이다.

.obsidian/ 은 혼자 쓰는 vault라면 .gitignore 에 넣고, 설정을 함께 쓰고 싶다면 push 한다.

첨부 file이 생길 자리를 미리 지정한다. 지정하지 않으면 note를 만든 위치, 즉 plugin folder 안에 image가 쌓인다.

frontmatter를 자동으로 정리하는 부류의 community plugin은 SKILL.md에 적용하지 않는다. name 과 description 은 skill이 언제 load 될지 정하는 값이라, key 순서나 표기가 바뀌면 의도와 다르게 동작할 수 있다.

G.4 Sync

vault 전체를 장치 사이에서 자동으로 복제하는 기능이 있다. Obsidian이 제공하는 sync service, vault folder를 cloud drive 안에 두는 방식, folder를 실시간으로 맞추는 file 동기화 도구가 모두 여기에 해당한다. 이 기능을 모두 끄고 Obsidian은 편집기로만 사용하며, rule의 local repository는 git의 commit과 push로만 관리하여 원본이 remote repository에 있도록 한다.

Our Score
Click to rate this post!
[Total: 1 Average: 5]
Visited 36 times, 1 visit(s) today

Leave a Comment

Your email address will not be published. Required fields are marked *