| 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
Read: plugins/plugin.go
Create new file: plugins/[app_name].go
Plugin function signature:
package plugins
func [AppName](cfg map[string]interface{}, isLight bool) error {
}
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
-
AppleScript (macOS apps):
- Use
exec.Command("osascript", "-e", script)
- Set appropriate timeout
- Handle errors gracefully
-
CLI Commands:
- Use
exec.Command() with arguments
- Check error return values
- Capture and handle stderr
Available helpers in plugins/plugin.go:
UpdateJSONTheme(path, key, value) - Update JSON config files
ExpandPath(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{
"[app-name]": [AppName],
}
Test the plugin:
make build
./bin/day-night-cycle --config config.yaml light
./bin/day-night-cycle --config config.yaml dark
./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
- 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:
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.colorTheme property
- Create
plugins/vscode.go with VSCode function
- Register in
plugins/plugin.go Registry 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.go for 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.go when appropriate
- Follow the patterns from existing plugins
- Research thoroughly before implementing
- Return descriptive errors
- Test both light and dark mode transitions