1# Chapter 2: .claude-plugin, the name on the door 2 3Every plugin has a folder called `.claude-plugin` holding one file, 4`plugin.json`, and Claude Code reads it before anything else. It is the 5plugin's `package.json`: a name, a version, a sentence about what it does. 6Here is all of it: 7 8```json 9{ 10 "name": "jevhooks", 11 "version": "0.1.0", 12 "description": "Jev judges Bash commands before they run and turn ends before they stop", 13 "types": "./types/index.d.ts" 14} 15``` 16 17The first three lines are what you would expect. The fourth is the 18interesting one. A mod can keep state that outlives one hook call (the last 19decision, here, so the band above the prompt can show it), and Claude Code 20wants to know its shape in advance. `types` points at a TypeScript file 21that declares it, so the engine can check every read and write of that 22state against one contract. That file is chapter 4. 23 24> **Aside: the folder that appears by itself.** Once Claude Code has 25> loaded the plugin, a `types/` folder turns up in here too. Claude Code 26> puts it there: the type declarations for its own API (`claude-code`, 27> `claude-code-tools`, `claude-code-mcp`) and a `tsconfig.json`, covering 28> `hooks/`, `types/` and `tests/`, that the plugin's own `tsconfig.json` 29> extends. It is not ours, so `.gitignore` keeps it out of the repository, 30> and nothing here links to it. 31 32> **Try it.** `claude plugin validate plugin`. The first thing it checks is 33> this file, and it reports `types ./types/index.d.ts declares state: 34> jevhooks.last`: the manifest pointed at the contract, and the contract 35> was read. It also warns that there is no `author`, which is true. 36 37## For the people who maintain it 38 39`name` is also the plugin's key in its state (`jevhooks.last`), in the 40`atom` that `hooks/register.tsx` makes, and in the test that mounts the 41band (`plugin: 'jevhooks'`). `version` matches the Cargo workspace's 42`0.1.0`, by hand. 43 44### In this folder 45 46| Path | What | 47| --- | --- | 48| [plugin.json](plugin.json) | The manifest: name, version, description, and where the state's types are. | 49| `types/` | Laid down by Claude Code; gitignored. | 50 51← Previous: [Chapter 1, plugin/](../) · Up: [plugin](../) · Next: [Chapter 3, hooks/](../hooks/) →