add-plugin
Research and create a new plugin for the day/night cycle automation. Use when user asks to "add a plugin for [app name]" or "add support for [app name]".
When & Why to Use This Skill
This Claude skill automates the end-to-end process of extending a day/night cycle automation system by researching application-specific theme settings and generating functional Go plugins. It streamlines the technical discovery, implementation, and integration phases, allowing users to add dark mode support for any software through automated research and code synthesis.
Use Cases
- Adding dark mode automation support for new desktop applications by researching their specific configuration paths (JSON, YAML, or Plist) and APIs.
- Generating standardized Go plugin code that implements theme-switching logic using system-level commands, AppleScript, or direct file manipulation.
- Streamlining the integration of new tools into a centralized automation framework by automatically updating registry maps and providing configuration templates.
| name | add-plugin |
|---|---|
| description | Research and create a new plugin for the day/night cycle automation. Use when user asks to "add a plugin for [app name]" or "add support for [app name]". |
| allowed-tools | WebSearch, WebFetch, Read, Write, Edit, Glob, Grep, Bash |
Add Plugin
Automatically research and create a new plugin for the day/night cycle automation system.
Overview
This skill helps you add support for new applications to the day/night cycle automation. Given an app name, it will:
- Research how theme switching works for the application
- Identify configuration file locations or APIs
- Create a new plugin file in the plugins/ directory
- Register the plugin in plugins/plugin.go Registry map
- Provide configuration examples
Instructions
When adding a plugin, follow these steps:
1. Research Phase
First, understand how theme switching works for the target application:
- Search for official documentation on theme/appearance switching
- Look for configuration file locations (JSON, YAML, plist, etc.)
- Check for AppleScript support on macOS
- Investigate CLI commands or APIs
- Review GitHub issues or community discussions about automation
Key questions to answer:
- Where are theme settings stored?
- What file format is used?
- What are the exact theme/preset names?
- Does the app support live reloading of settings?
- Are there any special requirements or permissions needed?
2. Implementation Phase
Create a new plugin file in the plugins/ directory:
Read existing plugins first:
Read: plugins/iterm2.go # or any other plugin as example
Read: plugins/plugin.go # for helper functions
Create new file: plugins/[app_name].go
Plugin function signature:
package plugins
func [AppName](cfg map[string]interface{}, isLight bool) error {
// Implementation
}
Implementation patterns by type:
JSON Config Files:
- Use helper:
UpdateJSONTheme(path, key, value)from plugins/plugin.go - Or read current file into struct or map
- Update theme property
- Marshal and write back
- Verify write succeeded
- Use helper:
AppleScript (macOS apps):
- Use
exec.Command("osascript", "-e", script) - Set appropriate timeout
- Handle errors gracefully
- Use
CLI Commands:
- Use
exec.Command()with arguments - Check error return values
- Capture and handle stderr
- Use
Available helpers in plugins/plugin.go:
UpdateJSONTheme(path, key, value)- Update JSON config filesExpandPath(path)- Expand ~ in file paths
Error handling requirements:
- Return descriptive errors using
fmt.Errorf() - Handle file not found separately from other errors
- Print helpful messages to stderr when appropriate
3. Integration Phase
Register the plugin in the Registry:
Edit plugins/plugin.go:
var Registry = map[string]Func{
// ... existing plugins
"[app-name]": [AppName],
}
Test the plugin:
# Build first
make build
# Test light mode
./bin/day-night-cycle --config config.yaml light
# Test dark mode
./bin/day-night-cycle --config config.yaml dark
# Check status
./bin/day-night-cycle --config config.yaml status
4. Documentation Phase
Provide the user with:
- Configuration example for
config.yaml:
plugins:
- name: [app-name]
enabled: true
# Include any custom options discovered
- Setup instructions if needed:
- Where to find theme names
- Any prerequisites or permissions
- How to verify it's working
Checklist
Before completing the task, verify:
- New plugin file created in
plugins/directory (e.g.,plugins/vscode.go) - File has
package pluginsdeclaration - Function signature matches
func [AppName](cfg map[string]interface{}, isLight bool) error - Extracts config values with proper type assertions
- Handles both light and dark modes based on
isLightparameter - Returns descriptive errors
- Plugin registered in
plugins/plugin.goRegistry map - Configuration example provided
- Basic testing completed
Example Usage
User: "Add a plugin for Visual Studio Code"
Expected workflow:
- Research VS Code settings location and theme configuration
- Discover settings.json at
~/Library/Application Support/Code/User/settings.json - Find that theme is controlled by
workbench.colorThemeproperty - Create
plugins/vscode.gowithVSCodefunction - Register in
plugins/plugin.goRegistry map as "vscode" - Provide config example with popular theme names
- Test the implementation
Common Pitfalls
- Don't guess paths or APIs - Always research first
- Check for platform differences - macOS vs Linux vs Windows
- Verify theme names - Use exact names from the application
- Test error cases - What if app isn't installed?
- Consider permissions - Some apps may need accessibility permissions
Resources
- Existing plugins: See files in
plugins/directory for implementation patterns - Plugin helpers: See
plugins/plugin.gofor available helper functions - Plugin patterns: See plugin-patterns.md in this skill directory
Notes
- Always read existing plugin files in plugins/ directory before implementing
- Each plugin gets its own file (e.g.,
plugins/iterm2.go) - Use helper functions from
plugins/plugin.gowhen appropriate - Follow the patterns from existing plugins
- Research thoroughly before implementing
- Return descriptive errors
- Test both light and dark mode transitions