Use when documentation is stale, incomplete, or needs synchronization with codebase changes - automatically generates and updates plugin documentation including CLAUDE.md, README.md, and component docs. Scans agents, skills, commands, and hooks to produce accurate counts and descriptions. Do NOT use for user-facing application docs or when you just need to write a single README - handle those directly.
/plugin marketplace add jrc1883/popkit-claude/plugin install popkit@popkit-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Automatically generate and synchronize plugin documentation by analyzing the codebase structure. Scans agents, skills, commands, hooks, and configuration files to produce accurate, up-to-date documentation.
Announce at start: "I'm using the auto-docs skill to generate documentation."
PopKit uses a monorepo structure:
popkit/
├── CLAUDE.md # Root project instructions (streamlined)
├── CHANGELOG.md # Version history (separate file)
├── README.md # User-facing documentation
├── packages/
│ ├── plugin/ # Main Claude Code plugin
│ │ ├── .claude-plugin/
│ │ ├── agents/
│ │ ├── skills/
│ │ ├── commands/
│ │ └── hooks/
│ └── cloud/ # PopKit Cloud API (optional)
from pathlib import Path
plugin_path = Path("packages/plugin")
# Count and categorize
agents_dir = plugin_path / "agents"
skills_dir = plugin_path / "skills"
commands_dir = plugin_path / "commands"
hooks_dir = plugin_path / "hooks"
# Agent tiers from config.json
with open(agents_dir / "config.json") as f:
config = json.load(f)
tier1 = config["tiers"]["tier-1-always-active"]["agents"]
tier2 = config["tiers"]["tier-2-on-demand"]["agents"]
feature = config["tiers"]["feature-workflow"]["agents"]
# Skills (directories with SKILL.md)
skills = list(skills_dir.glob("*/SKILL.md"))
# Commands (active vs deprecated)
commands = list(commands_dir.glob("*.md"))
active = [c for c in commands if "DEPRECATED" not in c.read_text()]
deprecated = [c for c in commands if "DEPRECATED" in c.read_text()]
# Hooks from hooks.json
with open(hooks_dir / "hooks.json") as f:
hooks = json.load(f)["hooks"]
# Utils
utils = list((hooks_dir / "utils").glob("*.py"))
For each component:
CLAUDE.md should be concise. Only update AUTO-GEN sections:
## Version History
**Current Version:** 0.9.10 (User Feedback & Vote-Based Prioritization)
See [CHANGELOG.md](CHANGELOG.md) for full version history.
AUTO-GEN Sections to Update:
| Section | Content |
|---|---|
AUTO-GEN:TIER-COUNTS | Agent counts per tier |
AUTO-GEN:REPO-STRUCTURE | Directory tree with counts |
AUTO-GEN:KEY-FILES | Important files table |
All version history goes in CHANGELOG.md:
# Changelog
All notable changes to PopKit are documented in this file.
## [0.9.10] - Current
### User Feedback & Vote-Based Prioritization
- **Feature Name** (#issue): Description
Update these sections in README.md:
Compare:
Report discrepancies for manual review.
| File | Content |
|---|---|
| CLAUDE.md | Updated auto-gen sections only |
| CHANGELOG.md | Version history (new entries at top) |
| README.md | Updated feature counts |
| docs/drift-report.md | Documentation drift analysis |
/popkit:plugin docs # Full documentation sync
/popkit:plugin docs --check # Check for drift only
/popkit:plugin docs --claude # Update CLAUDE.md sections only
/popkit:plugin docs --readme # Update README.md only
/popkit:plugin docs --changelog # Add new CHANGELOG entry
def add_changelog_entry(version: str, title: str, changes: list):
"""Add new version entry to CHANGELOG.md."""
changelog_path = "CHANGELOG.md"
with open(changelog_path, 'r') as f:
content = f.read()
# Find the first ## [version] line
import re
match = re.search(r'^## \[', content, re.MULTILINE)
if match:
# Insert new entry before first version
new_entry = f"""## [{version}] - Current
### {title}
"""
for change in changes:
new_entry += f"- {change}\n"
new_entry += "\n"
# Update previous "Current" to remove that label
content = re.sub(r'^(## \[\d+\.\d+\.\d+\]) - Current',
r'\1', content, count=1, flags=re.MULTILINE)
content = content[:match.start()] + new_entry + content[match.start():]
with open(changelog_path, 'w') as f:
f.write(content)
def update_claude_version(version: str, title: str):
"""Update version reference in CLAUDE.md."""
claude_path = "CLAUDE.md"
with open(claude_path, 'r') as f:
content = f.read()
# Update the version line
import re
pattern = r'\*\*Current Version:\*\* \d+\.\d+\.\d+ \([^)]+\)'
replacement = f'**Current Version:** {version} ({title})'
content = re.sub(pattern, replacement, content)
with open(claude_path, 'w') as f:
f.write(content)
def update_auto_gen_section(file_path: str, section_name: str, new_content: str):
"""Update a specific AUTO-GEN section."""
with open(file_path, 'r') as f:
content = f.read()
start_marker = f"<!-- AUTO-GEN:{section_name} START -->"
end_marker = f"<!-- AUTO-GEN:{section_name} END -->"
import re
pattern = f"{re.escape(start_marker)}.*?{re.escape(end_marker)}"
replacement = f"{start_marker}\n{new_content}\n{end_marker}"
if start_marker in content:
content = re.sub(pattern, replacement, content, flags=re.DOTALL)
with open(file_path, 'w') as f:
f.write(content)
return True
return False
Called by:
Outputs to:
| Skill | Relationship |
|---|---|
pop-doc-sync | Focused sync checking (this skill does full generation) |
pop-plugin-test | Validates plugin integrity after doc updates |
pop-project-init | Creates initial documentation structure |
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.