context7 icon indicating copy to clipboard operation
context7 copied to clipboard

feat: add Claude Code plugin with Skill-based integration

Open amondnet opened this issue 1 month ago • 1 comments

Summary

Add Claude Code plugin support with intelligent, skill-based Context7 integration.

Changes

  • Plugin manifest (.claude-plugin/plugin.json): Configure MCP server with npx execution and optional API key support
  • Skill system (skills/context7/SKILL.md): Intelligent, on-demand activation when working with libraries or frameworks
  • Updated README: Add Claude Code plugin installation instructions with skill-based workflow

Architecture Decision: Skill vs SessionStart Hook

This implementation uses Skills instead of SessionStart hooks for better token efficiency and user experience:

Why Skills?

  • Intelligent activation: Claude loads Context7 only when needed (library work, API docs)
  • Token efficient: No constant context overhead every session
  • Clear triggers: Automatic detection of library/framework/documentation needs
  • Simple maintenance: Single markdown file vs shell script + JSON output

Previous Approach (SessionStart Hook)

  • ❌ Loaded on every session start regardless of need
  • ❌ Constant token usage even for non-library tasks
  • ❌ More complex implementation with shell scripts

Benefits

  • Automatic integration: Claude automatically uses Context7 MCP tools when relevant
  • Seamless setup: Users can install with a simple /plugin install command
  • Token efficient: Context7 skill loads only when working with libraries/frameworks
  • API key support: Optional CONTEXT7_API_KEY environment variable for higher rate limits

Usage

https://plugins.pleaseai.dev/?install=context7

claude
/plugin marketplace add pleaseai/claude-code-plugins
/plugin install context7@pleaseai

The skill automatically activates when you:

  • Write code using external libraries
  • Need library documentation or API references
  • Set up or configure frameworks
  • Request code examples with specific packages

Claude intelligently detects these scenarios and fetches up-to-date documentation seamlessly.

Skill Activation Example

When you ask:

"Create a Next.js middleware that checks for JWT in cookies"

Claude automatically:

  1. Detects you're working with Next.js (external library)
  2. Activates the Context7 skill
  3. Uses resolve-library-id to find Next.js docs
  4. Uses get-library-docs to fetch current middleware documentation
  5. Provides accurate, up-to-date code

No need to explicitly say "use context7" - it just works!

References

  • Claude Code Skills documentation: https://docs.anthropic.com/en/docs/claude-code/skills
  • Claude Code Plugins documentation: https://docs.anthropic.com/en/docs/claude-code/plugins

amondnet avatar Oct 16 '25 13:10 amondnet