69 lines
1.9 KiB
Markdown
69 lines
1.9 KiB
Markdown
|
|
---
|
||
|
|
name: adapter-dev
|
||
|
|
description: Help develop and debug messaging platform adapters for ajarbot
|
||
|
|
user-invocable: true
|
||
|
|
disable-model-invocation: true
|
||
|
|
allowed-tools: Read, Grep, Glob, Edit, Bash
|
||
|
|
context: fork
|
||
|
|
agent: Plan
|
||
|
|
---
|
||
|
|
|
||
|
|
# Adapter Development Skill
|
||
|
|
|
||
|
|
You are helping develop messaging platform adapters for ajarbot using the OpenClaw-inspired architecture.
|
||
|
|
|
||
|
|
## When invoked
|
||
|
|
|
||
|
|
1. **Analyze the request**: Understand what adapter work is needed
|
||
|
|
2. **Check existing patterns**: Review `adapters/slack/` and `adapters/telegram/` for patterns
|
||
|
|
3. **Follow the base contract**: All adapters must implement `BaseAdapter` from `adapters/base.py`
|
||
|
|
4. **Test the implementation**: Suggest tests and validation steps
|
||
|
|
|
||
|
|
## Key files to reference
|
||
|
|
|
||
|
|
- `adapters/base.py` - Base adapter interface
|
||
|
|
- `adapters/runtime.py` - Runtime integration
|
||
|
|
- `adapters/slack/adapter.py` - Slack Socket Mode example
|
||
|
|
- `adapters/telegram/adapter.py` - Telegram example
|
||
|
|
- `README_ADAPTERS.md` - Architecture documentation
|
||
|
|
|
||
|
|
## Common tasks
|
||
|
|
|
||
|
|
### Create new adapter
|
||
|
|
1. Create `adapters/<platform>/adapter.py`
|
||
|
|
2. Implement required methods from `BaseAdapter`
|
||
|
|
3. Define capabilities (threads, reactions, max length, etc.)
|
||
|
|
4. Add to `bot_runner.py`
|
||
|
|
5. Update config template
|
||
|
|
|
||
|
|
### Debug adapter issues
|
||
|
|
1. Check `validate_config()` returns true
|
||
|
|
2. Verify credentials format
|
||
|
|
3. Test `health_check()` method
|
||
|
|
4. Review async event handler registration
|
||
|
|
5. Check message chunking logic
|
||
|
|
|
||
|
|
### Update existing adapter
|
||
|
|
1. Read current implementation
|
||
|
|
2. Understand the change request
|
||
|
|
3. Follow existing patterns
|
||
|
|
4. Preserve backward compatibility
|
||
|
|
5. Update documentation
|
||
|
|
|
||
|
|
## Security considerations
|
||
|
|
|
||
|
|
- Never log credentials or tokens
|
||
|
|
- Validate all user input before processing
|
||
|
|
- Use platform-specific rate limits
|
||
|
|
- Handle errors gracefully
|
||
|
|
- Respect user allowlists
|
||
|
|
|
||
|
|
## Output format
|
||
|
|
|
||
|
|
Provide:
|
||
|
|
1. Clear explanation of changes
|
||
|
|
2. Code implementation
|
||
|
|
3. Configuration updates needed
|
||
|
|
4. Testing steps
|
||
|
|
5. Documentation updates
|