Skip to content

Commit 52c9a8d

Browse files
authored
docs: how to test the plugin locally (#119)
1 parent 4e4f242 commit 52c9a8d

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,101 @@ Add the new skill directory and files to the repository structure tree in `CLAUD
6969
- **Reference packages by full name** (e.g., `package:mocktail`, not just "mocktail").
7070
- **Show anti-patterns alongside correct patterns** when helpful, so readers understand both what to do and what to avoid.
7171

72+
## Testing Locally
73+
74+
Editing a skill or hook and pushing straight to a PR only tells you the files
75+
are valid, not that they work correctly. Load your working copy into a real Claude Code
76+
session and exercise it before you commit.
77+
78+
### Prerequisites
79+
80+
- **Claude Code CLI** installed (`npm install -g @anthropic-ai/claude-code`).
81+
- **Dart SDK** and **jq** on your `PATH` — the hooks need both.
82+
- **Very Good CLI** ≥ 1.3.0 (`dart pub global activate very_good_cli`) for the
83+
Very Good CLI MCP server tools.
84+
85+
See the README [Hooks](README.md#hooks) and [MCP Integration](README.md#mcp-integration)
86+
sections for the full prerequisite details.
87+
88+
### Load your local copy
89+
90+
From the repository root, launch Claude Code pointed at this directory:
91+
92+
```bash
93+
claude --plugin-dir .
94+
```
95+
96+
`--plugin-dir` loads the plugin for that session only, needs no install or
97+
marketplace, and overrides any marketplace-installed copy of the same plugin.
98+
`${CLAUDE_PLUGIN_ROOT}` (used throughout `hooks/hooks.json`) resolves to the
99+
directory you pass, so the hook script paths resolve correctly.
100+
101+
### Verify each component loaded
102+
103+
| Component | How to verify |
104+
| ----------- | --------------- |
105+
| **Skills** | Run `/help`. Skills appear namespaced as `/vgv-ai-flutter-plugin:<skill>` (e.g. `/vgv-ai-flutter-plugin:bloc`). Invoke one to confirm it triggers. |
106+
| **MCP servers** | Run `/mcp`. Confirm `dart` and `very-good-cli` both show connected. |
107+
| **Hooks** | Have Claude `Edit` or `Write` a `.dart` file and confirm `analyze.sh` and `format.sh` run. Launch without Very Good CLI to see the SessionStart warning fire. |
108+
109+
### Iterate on changes
110+
111+
After editing a `SKILL.md`, a hook script, or `.mcp.json`, **restart the
112+
`claude --plugin-dir .` session** to guarantee the change is picked up. Changes
113+
to `.claude-plugin/plugin.json` always require a restart. Edits to the hook
114+
`.sh` scripts take effect on the next matching tool call with no restart, since
115+
each hook runs the script fresh.
116+
117+
### Rehearse the real install (optional)
118+
119+
To mimic the marketplace install flow without pushing anything, register a
120+
throwaway local marketplace. Create `.claude-plugin/marketplace.json` in a temp
121+
directory with an **absolute** path to this repo:
122+
123+
```jsonc
124+
// /tmp/vgv-test-marketplace/.claude-plugin/marketplace.json
125+
{
126+
"plugins": [
127+
{
128+
"name": "vgv-ai-flutter-plugin",
129+
"source": {
130+
"type": "directory",
131+
"path": "/ABSOLUTE/path/to/vgv-ai-flutter-plugin"
132+
}
133+
}
134+
]
135+
}
136+
```
137+
138+
Then, inside a session:
139+
140+
```text
141+
/plugin marketplace add /tmp/vgv-test-marketplace
142+
/plugin install vgv-ai-flutter-plugin
143+
```
144+
145+
### Validate before you push
146+
147+
Run the same check CI runs, from the repository root:
148+
149+
```bash
150+
claude plugin validate .
151+
```
152+
153+
This validates the manifest, skill frontmatter, hook JSON, MCP config, and file
154+
references. It is static, so it confirms structure but does not replace the live
155+
checks above.
156+
157+
### Troubleshooting
158+
159+
| Symptom | Likely cause | Fix |
160+
| --------------------------------------- | ------------------------------------------- | ------------------------------------------------------------- |
161+
| Skill missing from `/help` | Invalid frontmatter, or `name` doesn't match the folder | Run `claude plugin validate .` and fix the reported error |
162+
| MCP server "executable not found" | `dart` or `very_good` not on `PATH` | Install the SDK / activate the CLI, then verify with `which` |
163+
| Hook never fires | `jq` not installed, or script lacks `+x` / a shebang | Install `jq`; `chmod +x` the script and add `#!/bin/bash` |
164+
| `${CLAUDE_PLUGIN_ROOT}` not resolving | Session not launched via `--plugin-dir` (or restart pending) | Restart with `claude --plugin-dir .` from the repo root |
165+
| Local marketplace won't install | `source.path` is relative | Use an absolute path in `marketplace.json` |
166+
72167
## CI Checks
73168

74169
Every pull request runs the following checks automatically:

0 commit comments

Comments
 (0)