Work with plugin
Use plugin when you need to claude code plugin — skills, hooks, commands, and mcp config.
Prerequisites
- Access to the project source code
- Familiarity with the files under plugin/**
Steps
-
Understand the current behavior. Read the entry points to see what plugin does today before making changes. The primary functions are:
main()inplugin/hooks/_handoff_cli.pybuild_resume_prompt()inplugin/hooks/_resume_prompt.py— Render the user-facing resume prompt body.discover_specs()inplugin/hooks/_state.py— Walkspecs/directories under each root for in-flight specs.git_state()inplugin/hooks/_state.py— Return branch, last commit, and uncommitted files forcwd.session_sentinel_path()inplugin/hooks/_state.py— Path to the once-per-session compact-warning sentinel.
-
Locate the right function to change. Each function has a single responsibility. Read its docstring, parameters, and return type to confirm it owns the behavior you need to modify.
-
Make your change. Follow existing patterns in the file — naming conventions, error handling style, and logging.
-
Run the related tests. This catches regressions before they reach other developers. Target with
pytest -k "plugin".
Key files
plugin/**
Common modifications
Functions you are most likely to modify:
main()inplugin/hooks/_handoff_cli.pybuild_resume_prompt()inplugin/hooks/_resume_prompt.pydiscover_specs()inplugin/hooks/_state.pygit_state()inplugin/hooks/_state.pysession_sentinel_path()inplugin/hooks/_state.pyprune_stale_sentinels()inplugin/hooks/_state.pyworkspace_roots()inplugin/hooks/_state.pyestimate_utilization()inplugin/hooks/_transcript_size.py