|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +Guidance for working on this repo. `claude-for-legal` is a Claude Code plugin |
| 4 | +marketplace — twelve first-party legal plugins, one vendor plugin, and five |
| 5 | +managed-agent cookbooks. Most work here is editing prompt content (skills, |
| 6 | +agents, hooks), plugin metadata, or cookbook config — not application code. |
| 7 | + |
| 8 | +## Layout |
| 9 | + |
| 10 | +``` |
| 11 | +.claude-plugin/marketplace.json # the marketplace manifest — one entry per plugin |
| 12 | +<plugin>/ # 12 first-party plugins (commercial-legal, privacy-legal, ...) |
| 13 | + .claude-plugin/plugin.json # plugin manifest (name, version, description, author) |
| 14 | + .mcp.json # MCP servers the plugin connects to |
| 15 | + CLAUDE.md # practice-profile TEMPLATE (see "Plugin CLAUDE.md" below) |
| 16 | + README.md # per-plugin docs |
| 17 | + skills/<name>/SKILL.md # one skill per directory |
| 18 | + agents/<name>.md # subagent definitions |
| 19 | + hooks/hooks.json # hook config (most plugins ship an empty stub) |
| 20 | + .gitignore |
| 21 | +external_plugins/<vendor>/ # vendor-maintained plugins (CoCounsel) |
| 22 | +managed-agent-cookbooks/<name>/ # CMA agent.yaml + subagents/ + steering-examples.json |
| 23 | +scripts/ # validate.py, lint-tool-scope.py, orchestrate.py, |
| 24 | + # deploy-managed-agent.sh, test-cookbooks.sh |
| 25 | +references/ # shared templates (company-profile, dashboard) |
| 26 | +``` |
| 27 | + |
| 28 | +## Validation — run before opening a PR |
| 29 | + |
| 30 | +This repo follows the same conventions `anthropics/claude-plugins-official` |
| 31 | +enforces in CI. Run the equivalent checks locally: |
| 32 | + |
| 33 | +```bash |
| 34 | +# 1. Marketplace + per-plugin schema validation (source of truth) |
| 35 | +claude plugin validate .claude-plugin/marketplace.json |
| 36 | +for d in */; do [ -f "$d/.claude-plugin/plugin.json" ] && claude plugin validate "$d"; done |
| 37 | +claude plugin validate external_plugins/cocounsel-legal |
| 38 | + |
| 39 | +# 2. Cookbook tool-scope lint (orchestrators must not over-grant tools) |
| 40 | +python3 scripts/lint-tool-scope.py |
| 41 | + |
| 42 | +# 3. JSON/YAML sanity |
| 43 | +python3 -c "import json,glob; [json.load(open(f)) for f in glob.glob('**/*.json', recursive=True)]" |
| 44 | +``` |
| 45 | + |
| 46 | +### Marketplace invariants (I1–I11) |
| 47 | + |
| 48 | +`claude-plugins-official` layers these on top of the schema check. They apply |
| 49 | +here too — the ones most likely to trip a contributor: |
| 50 | + |
| 51 | +- **I1** — `plugins[]` should be alpha-sorted by name (case-insensitive). |
| 52 | + *Currently a known warning: the array is in a curated display order. If you |
| 53 | + add a plugin, ask before re-sorting the whole array.* |
| 54 | +- **I2** — no duplicate plugin names. |
| 55 | +- **I3** — `description` 10–2000 chars, no leading/trailing whitespace. |
| 56 | +- **I8** — every vendored `source` (`"./<dir>"`) must point at a directory that |
| 57 | + contains `.claude-plugin/plugin.json`. |
| 58 | +- **I9** — `source` paths/URLs must contain no shell metacharacters or `..`. |
| 59 | +- **I10** — no hidden Unicode (zero-width chars, bidi controls) in |
| 60 | + `name`/`description`. |
| 61 | +- **I11** — `name` must match `^[a-z0-9][a-z0-9-]{1,63}$`. |
| 62 | + |
| 63 | +### Frontmatter requirements |
| 64 | + |
| 65 | +Every `agents/*.md` needs `name` and `description`. Every |
| 66 | +`skills/<name>/SKILL.md` needs `description`. Every `commands/*.md` needs |
| 67 | +`description`. Multi-line descriptions use `>` block scalars and that's fine — |
| 68 | +`claude plugin validate` parses them correctly. |
| 69 | + |
| 70 | +## Conventions |
| 71 | + |
| 72 | +### Keep `marketplace.json` in sync with `plugin.json` |
| 73 | + |
| 74 | +For first-party plugins, `marketplace.json`'s `name`, `description`, and |
| 75 | +`author` should match the plugin's own `.claude-plugin/plugin.json` field for |
| 76 | +field. If you change a plugin's description in one place, change it in the |
| 77 | +other. |
| 78 | + |
| 79 | +### Skill names in prose must be canonical |
| 80 | + |
| 81 | +When a `SKILL.md` (especially `customize` or `cold-start-interview`) tells the |
| 82 | +user "run `/foo`," `foo` must be the actual `skills/<foo>/` directory name. |
| 83 | +Short forms like `/triage` for `/use-case-triage` look right in prose but are |
| 84 | +dead commands — the user types them and nothing happens. Refs to Claude Code |
| 85 | +built-ins (`/mcp`, `/plugin`) and to other plugins (`/<other-plugin>:<skill>`) |
| 86 | +are fine. |
| 87 | + |
| 88 | +### Plugin CLAUDE.md is a template, not project context |
| 89 | + |
| 90 | +Each `<plugin>/CLAUDE.md` is a practice-profile template that the |
| 91 | +`cold-start-interview` skill copies to `~/.claude/plugins/config/claude-for-legal/<plugin>/CLAUDE.md` |
| 92 | +on the user's machine. It is *not* loaded as project context when the plugin is |
| 93 | +installed — `claude plugin validate` warns about this and the warning is |
| 94 | +expected. Don't "fix" it by moving the content into a skill. |
| 95 | + |
| 96 | +### `external_plugins/` is vendor-maintained |
| 97 | + |
| 98 | +Plugins under `external_plugins/` are built and maintained by the vendor |
| 99 | +(README.md has the policy). Don't change vendor-authored content without |
| 100 | +checking with them first; whitespace normalization and formatting are usually |
| 101 | +fine since the vendor lands changes via PR rather than mirroring a fork. |
| 102 | + |
| 103 | +### Formatting |
| 104 | + |
| 105 | +- 2-space indent in all JSON and `.mcp.json` files. |
| 106 | +- Final newline at end of every text file. |
| 107 | +- No trailing whitespace. |
| 108 | +- Markdown tables: pipe-aligned columns are nice but not required; just keep |
| 109 | + the column count consistent. |
| 110 | + |
| 111 | +## Cookbooks |
| 112 | + |
| 113 | +Each `managed-agent-cookbooks/<name>/` has `agent.yaml` (the orchestrator), |
| 114 | +`subagents/*.yaml` (the leaves), `steering-examples.json`, and `README.md`. Two |
| 115 | +rules that `scripts/lint-tool-scope.py` enforces: |
| 116 | + |
| 117 | +1. The orchestrator gets local-only tools (`read`, `grep`, `glob`, |
| 118 | + `agent_toolset`); MCP and write tools belong to specific subagent leaves. |
| 119 | +2. The README's security table and the `agent.yaml` comments must match what |
| 120 | + the YAML actually grants. Don't claim a tool a subagent doesn't have. |
| 121 | + |
| 122 | +## Things to leave alone |
| 123 | + |
| 124 | +- Per-plugin `.gitignore` files differ slightly across plugins. Probably |
| 125 | + intentional; ask before unifying. |
| 126 | +- `hooks/hooks.json` is missing in two plugins. Hooks are optional; the missing |
| 127 | + files are not a bug. |
| 128 | +- `references/` lives only at repo root and is not shipped inside any plugin |
| 129 | + directory. Several plugin `CLAUDE.md` templates reference it as if it were — |
| 130 | + that's a known gap, not a thing to silently move. |
0 commit comments