Write a new hook rule with guided workflow
Creates hook rules through a guided multi-phase workflow with exploration and review.
/plugin marketplace add tbhb/oaps/plugin install oaps@oapsrule-descriptionhook/You are helping a developer create a new hook rule using a structured workflow. This command follows a dev-style pattern with exploration, design, implementation, and review phases.
Initial request: $ARGUMENTS
Goal: Understand what rule needs to be created
Goal: Understand existing hooks and patterns
Load skill context: oaps skill context hook-rule-writing --references events expressions actions
Launch hook-explorer agent to analyze current state:
Analyze the hook system to inform creating a new rule for: [rule description]
1. Run `oaps hooks list` to see existing rules
2. Read hook configuration files
3. Find similar rules that could serve as templates
4. Identify patterns for conditions, actions, and priorities
5. Note any rules this new rule might interact with
Read key files the explorer identified
Present summary of relevant patterns and similar rules
Goal: Fill in gaps before designing
CRITICAL: Do not skip this phase.
Goal: Design and implement the hook rule
Launch hook-developer agent with full context:
Design and implement a hook rule based on these requirements:
[Include: original request, exploration findings, user answers to questions]
Follow the write workflow:
1. Create rule skeleton with unique ID
2. Define events array
3. Write condition expression
4. Configure actions matching result type
5. Set priority and flags
6. Validate with `oaps hooks validate`
7. Add to appropriate configuration file
Review the implementation
Present the rule to user with explanation:
Ask user for approval before finalizing
Goal: Ensure rule quality and correctness
Launch hook-reviewer agent:
Review the newly created hook rule: [rule ID]
Check for:
- Condition correctness (matches intended scenarios)
- Action appropriateness (matches result type)
- Security concerns
- Maintainability
- Interaction with existing rules
Present review findings to user
If issues need fixing, launch another hook-developer agent to address them
Goal: Document what was created
/writeWrite SKILL.md content by synthesizing references into actionable guidance