Skip to content

Commit 8356693

Browse files
sjnimsclaude
andcommitted
docs: comprehensive documentation improvements
Critical fixes: - Update README.md version badge from 0.1.0 to 0.2.0 - Add 0.2.x to SECURITY.md supported versions table Medium priority improvements: - Change test repo command to use --private (security) - Reword "No External Dependencies" to "Minimal Dependencies" - Change grep to rg in SECURITY.md audit command - Add CI checks table and version release reference to CONTRIBUTING.md - Add cleanup instructions for test repositories Low priority enhancements: - Add FAQ section to README.md - Add mermaid diagram text fallback for viewers without mermaid support - Expand Best Practices with anti-patterns table - Add [BANG] security pattern mention to README.md - Add Quick Links section to CLAUDE.md - Make Architecture Note more prominent with table format - Add Troubleshooting section to CLAUDE.md - Add Common Mistakes to Avoid table to CONTRIBUTING.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent be56227 commit 8356693

File tree

4 files changed

+160
-16
lines changed

4 files changed

+160
-16
lines changed

CLAUDE.md

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,33 @@ This repository is a **plugin marketplace** containing the **plugin-dev** plugin
1010

1111
**Current Version**: v0.2.0 (see [CHANGELOG.md](CHANGELOG.md) for release history)
1212

13+
### Quick Links
14+
15+
| Topic | Location |
16+
|-------|----------|
17+
| Testing locally | [Testing](#testing) |
18+
| Version release | [Version Release Procedure](#version-release-procedure) |
19+
| Linting | [Linting](#linting) |
20+
| Component patterns | [Component Patterns](#component-patterns) |
21+
| Workflows | [Workflow](#workflow) |
22+
| CI/CD | [CI/CD](#cicd) |
23+
24+
## ⚠️ Architecture Note (Important)
25+
26+
**This repo has two levels of `.claude-plugin/`:**
27+
28+
| Level | Path | Purpose |
29+
|-------|------|---------|
30+
| Root | `/.claude-plugin/marketplace.json` | Marketplace manifest listing available plugins |
31+
| Plugin | `/plugins/plugin-dev/.claude-plugin/plugin.json` | Individual plugin manifest |
32+
33+
**When testing locally**, point to the plugin directory, not the root:
34+
35+
```bash
36+
claude --plugin-dir plugins/plugin-dev # ✓ Correct
37+
claude --plugin-dir . # ✗ Wrong (loads marketplace, not plugin)
38+
```
39+
1340
## Repository Structure
1441

1542
```
@@ -26,15 +53,6 @@ plugin-dev/ # Marketplace root
2653
└── .github/workflows/ # CI/CD workflows
2754
```
2855

29-
## Architecture Note
30-
31-
This repo has two levels of `.claude-plugin/`:
32-
33-
- **Root level**: `/.claude-plugin/marketplace.json` - Marketplace manifest listing available plugins
34-
- **Plugin level**: `/plugins/plugin-dev/.claude-plugin/plugin.json` - Individual plugin manifest
35-
36-
When testing locally, point to the plugin directory, not the root.
37-
3856
## Key Conventions
3957

4058
### Skill Structure
@@ -115,6 +133,41 @@ Utility scripts (paths relative to `plugins/plugin-dev/`):
115133
./skills/plugin-settings/scripts/parse-frontmatter.sh .claude/plugin.local.md
116134
```
117135

136+
## Troubleshooting
137+
138+
### Common Issues
139+
140+
| Problem | Cause | Solution |
141+
|---------|-------|----------|
142+
| Plugin not loading | Wrong directory path | Use `plugins/plugin-dev`, not root |
143+
| Skill not triggering | Weak trigger phrases | Add specific user queries to description |
144+
| Hook not firing | Incorrect matcher pattern | Check regex syntax, test with `test-hook.sh` |
145+
| Validation script fails | Missing dependencies (`jq`) | Install required tools (see [README.md](README.md#prerequisites)) |
146+
| Shell execution in skills | Using `!` backtick pattern | Replace with `[BANG]` placeholder |
147+
148+
### Debug Mode
149+
150+
Run Claude Code with debug output:
151+
152+
```bash
153+
claude --debug --plugin-dir plugins/plugin-dev
154+
```
155+
156+
### Validation Failures
157+
158+
If components fail validation:
159+
160+
1. **Run the specific validator** for the component type (see utility scripts above)
161+
2. **Check frontmatter** - ensure all required fields are present
162+
3. **Verify file location** - components must be in correct directories
163+
4. **Check naming** - use kebab-case for names (e.g., `my-agent`, not `myAgent`)
164+
165+
### Getting More Help
166+
167+
- Check [README.md FAQ](README.md#faq) for common questions
168+
- Review [CONTRIBUTING.md](CONTRIBUTING.md#common-mistakes-to-avoid) for common mistakes
169+
- Open an [issue](https://github.com/sjnims/plugin-dev/issues) if you're stuck
170+
118171
## Linting
119172

120173
```bash

CONTRIBUTING.md

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ gh auth status # Should show logged in with 'repo' and 'project' scopes
120120

121121
1. **Simplicity First**: Don't over-engineer. Keep solutions simple and focused.
122122
2. **Consistency**: Follow existing patterns in the codebase.
123-
3. **No External Dependencies**: This is a pure Claude Code plugin (only GitHub CLI dependency).
123+
3. **Minimal Dependencies**: This plugin only requires GitHub CLI (`gh`) as an external dependency.
124124
4. **Documentation**: Document all user-facing changes.
125125
5. **Testing**: Always test locally before submitting.
126126

@@ -279,6 +279,19 @@ When creating and/or modifying hooks:
279279
2. **Timeout**: Set appropriate timeouts (default: 10 seconds)
280280
3. **Testing**: Test thoroughly to avoid false positives
281281

282+
## Common Mistakes to Avoid
283+
284+
| Mistake | Problem | Solution |
285+
|---------|---------|----------|
286+
| Testing in development repo | Pollutes your environment with test files | Create a separate test repository |
287+
| Using `!` in skill documentation | Shell execution during skill load | Use `[BANG]` placeholder (see [SECURITY.md](SECURITY.md)) |
288+
| Missing trigger phrases | Skills don't load when expected | Include specific user queries in descriptions |
289+
| Overly broad tool matchers | Hooks trigger unexpectedly | Use specific patterns like `Write\|Edit` not `*` |
290+
| Hardcoded paths | Plugin breaks on other machines | Use `${CLAUDE_PLUGIN_ROOT}` |
291+
| Large SKILL.md files | Slow loading, excessive context | Keep core <2,000 words; use `references/` for details |
292+
| Missing frontmatter fields | Components fail validation | Always include required fields (`name`, `description`) |
293+
| Committing test files | Repository bloat | Use `.gitignore` and clean up test repos |
294+
282295
## Testing
283296

284297
### Validation Scripts
@@ -321,17 +334,27 @@ For significant changes, test the complete lifecycle:
321334
Create a test repository to avoid polluting your development environment:
322335

323336
```bash
324-
# Create a test repo
325-
mkdir test-requirements-repo
326-
cd test-requirements-repo
337+
# Create a private test repo (recommended for security)
338+
mkdir test-plugin-repo
339+
cd test-plugin-repo
327340
git init
328-
gh repo create test-requirements-repo --public --source=. --remote=origin
341+
gh repo create test-plugin-repo --private --source=. --remote=origin
329342
git push -u origin main
330343

331344
# Now test the plugin
332345
claude --plugin-dir /path/to/plugin-dev/plugins/plugin-dev
333346
```
334347

348+
**Cleanup**: After testing, delete the test repository:
349+
350+
```bash
351+
# Delete local directory
352+
cd .. && rm -rf test-plugin-repo
353+
354+
# Delete remote repository
355+
gh repo delete test-plugin-repo --yes
356+
```
357+
335358
## Submitting Changes
336359

337360
### 1. Update Documentation
@@ -388,6 +411,25 @@ See [pull_request_template.md](.github/pull_request_template.md) for the complet
388411
- [ ] Component-specific checks completed
389412
- [ ] No breaking changes (or clearly documented)
390413

414+
### CI Checks on Pull Requests
415+
416+
Your PR will automatically run these checks:
417+
418+
| Workflow | What It Checks |
419+
|----------|----------------|
420+
| `markdownlint.yml` | Markdown style and formatting |
421+
| `links.yml` | Broken links in documentation |
422+
| `component-validation.yml` | Plugin component structure |
423+
| `version-check.yml` | Version consistency across manifests |
424+
| `validate-workflows.yml` | GitHub Actions syntax |
425+
| `claude-pr-review.yml` | AI-powered code review |
426+
427+
All checks must pass before merging. Fix any failures before requesting review.
428+
429+
### Version Releases
430+
431+
Version releases are handled by maintainers. If your contribution requires a version bump, maintainers will follow the [Version Release Procedure](CLAUDE.md#version-release-procedure) in CLAUDE.md.
432+
391433
## Style Guide
392434

393435
### Markdown

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[![CI](https://github.com/sjnims/plugin-dev/actions/workflows/component-validation.yml/badge.svg)](https://github.com/sjnims/plugin-dev/actions/workflows/component-validation.yml)
88
[![Markdown](https://github.com/sjnims/plugin-dev/actions/workflows/markdownlint.yml/badge.svg)](https://github.com/sjnims/plugin-dev/actions/workflows/markdownlint.yml)
9-
[![Version](https://img.shields.io/badge/version-0.1.0-blue.svg)](https://github.com/sjnims/plugin-dev/releases)
9+
[![Version](https://img.shields.io/badge/version-0.2.0-blue.svg)](https://github.com/sjnims/plugin-dev/releases)
1010
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
1111

1212
A comprehensive toolkit for developing Claude Code plugins with expert guidance on hooks, MCP integration, plugin structure, and marketplace publishing.
@@ -24,6 +24,7 @@ A comprehensive toolkit for developing Claude Code plugins with expert guidance
2424
- [Development Workflow](#development-workflow)
2525
- [Use Cases](#use-cases)
2626
- [Best Practices](#best-practices)
27+
- [FAQ](#faq)
2728
- [Contributing](#contributing)
2829
- [Getting Help](#getting-help)
2930
- [Attribution](#attribution)
@@ -275,6 +276,19 @@ graph TD
275276
E -.- E1[validation agents + scripts]
276277
```
277278
279+
<!-- Text fallback for viewers that don't render mermaid -->
280+
<details>
281+
<summary>Workflow diagram (text version)</summary>
282+
283+
```
284+
Design Structure → Add Components → Integrate Services → Add Automation → Test & Validate
285+
↓ ↓ ↓ ↓ ↓
286+
plugin-structure command/agent/ mcp-integration hook-development validation
287+
skill skill skills skill skill agents + scripts
288+
```
289+
290+
</details>
291+
278292
| Phase | Skill/Tool | What You Do |
279293
|-------|------------|-------------|
280294
| **Design** | plugin-structure | Define manifest, directory layout |
@@ -317,6 +331,7 @@ graph TD
317331
- HTTPS/WSS for MCP servers
318332
- Environment variables for credentials
319333
- Principle of least privilege
334+
- Use `[BANG]` placeholder in skill documentation for shell patterns (see [SECURITY.md](SECURITY.md))
320335
321336
### Portability
322337
@@ -329,13 +344,46 @@ graph TD
329344
- Validate configurations before deployment
330345
- Test hooks with sample inputs
331346
- Use debug mode (`claude --debug`)
347+
- Create separate test repositories to avoid polluting development
332348
333349
### Documentation
334350
335351
- Clear README files for each plugin
336352
- Document all environment variables
337353
- Include usage examples
338354
355+
### What to Avoid
356+
357+
| Anti-Pattern | Why It's Bad | Better Approach |
358+
|--------------|--------------|-----------------|
359+
| Hardcoded absolute paths | Breaks portability | Use `${CLAUDE_PLUGIN_ROOT}` |
360+
| Overly broad hook matchers (`*`) | Unexpected triggers, performance impact | Use specific patterns like `Write\|Edit` |
361+
| Large SKILL.md files (>2,000 words) | Slow loading, context bloat | Use `references/` for detailed docs |
362+
| Storing secrets in manifests | Security risk | Use environment variables |
363+
| Testing in your main dev repo | File pollution, git noise | Use dedicated test repositories |
364+
365+
## FAQ
366+
367+
**Q: How do I test my plugin without affecting my development environment?**
368+
369+
Create a separate test repository and load the plugin from there. See [CONTRIBUTING.md](CONTRIBUTING.md#test-repository) for detailed instructions.
370+
371+
**Q: My skill isn't loading when I ask trigger questions. What's wrong?**
372+
373+
Check that your skill description includes the specific phrases users might say. The description should start with "This skill should be used when..." and include example queries like `"create a hook"`, `"add MCP server"`.
374+
375+
**Q: What's the `[BANG]` placeholder I see in documentation?**
376+
377+
Due to a Claude Code issue, inline bash patterns (`!` followed by backtick) can execute during skill loading. The `[BANG]` placeholder prevents this. See [SECURITY.md](SECURITY.md#shell-pattern-escaping-with-bang-placeholder) for details.
378+
379+
**Q: How do I structure a plugin with both commands and MCP integration?**
380+
381+
Start with `/plugin-dev:create-plugin` for a guided walkthrough, or ask: "What's the best directory structure for a plugin with commands and MCP integration?" The plugin-structure skill will guide you.
382+
383+
**Q: Can I restrict which tools my skill or agent can use?**
384+
385+
Yes, use the `allowed-tools` frontmatter field. For example: `allowed-tools: Read, Grep, Glob` creates a read-only skill.
386+
339387
## Contributing
340388
341389
To contribute improvements:

SECURITY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ We release patches for security vulnerabilities for the following versions:
66

77
| Version | Supported |
88
| ------- | ------------------ |
9+
| 0.2.x | :white_check_mark: |
910
| 0.1.x | :white_check_mark: |
1011

1112
## Reporting a Vulnerability
@@ -94,7 +95,7 @@ Current branch: [BANG]`git branch --show-current`
9495

9596
- Do NOT "fix" `[BANG]` back to `!` - this is intentional
9697
- When adding new documentation with bash patterns, use `[BANG]`
97-
- Audit command: `grep -rn '!`' plugins/plugin-dev/skills/ --include='*.md' | grep -v '\[BANG\]'`
98+
- Audit command: `rg '!\`' plugins/plugin-dev/skills/ --glob '*.md' | rg -v '\[BANG\]'`
9899
- See [CONTRIBUTING.md](CONTRIBUTING.md) for documentation guidelines
99100
- Reference: [command-development skill](plugins/plugin-dev/skills/command-development/SKILL.md) lines 340-378
100101

0 commit comments

Comments
 (0)