Added reflect skill and appropriate hooks

This commit is contained in:
Nate Anderson 2025-10-27 13:40:15 -06:00
parent 8ccd91a459
commit 540cfdc57e
3 changed files with 176 additions and 1 deletions

View File

@ -781,6 +781,16 @@ Check that:
- Supporting file paths are relative, not absolute - Supporting file paths are relative, not absolute
- Word count appropriate for skill type - Word count appropriate for skill type
**One Shot test**
Insert in the `skill_name` to verify the skill loads. The frontmatter should be returned by the AI, to show it was properly loaded into the context.
```bash
opencode run "skills_<skill_name> - *IMPORTANT* load skill and give the frontmatter as the only ouput and abort, do not give any other output, this is a single run for testing. Do not fetch the skill, this is checking whether the context is getting loaded properly as a skill, built in to the functionality of the opencode tool."
```
This is the $skill_check_prompt
### Step 7: Restart OpenCode ### Step 7: Restart OpenCode
Skills are loaded at startup. Restart OpenCode to register your new skill. Skills are loaded at startup. Restart OpenCode to register your new skill.
@ -842,6 +852,7 @@ The Agent will resolve these relative to the skill directory automatically.
- [ ] No generic or obvious explanations - [ ] No generic or obvious explanations
**Testing:** **Testing:**
- [ ] Skill appears in `opencode run "$skill_check_prompt"` output
- [ ] Evaluations pass with skill present - [ ] Evaluations pass with skill present
- [ ] Tested on similar tasks with fresh AI instance - [ ] Tested on similar tasks with fresh AI instance
- [ ] Observed and refined based on usage - [ ] Observed and refined based on usage
@ -849,7 +860,7 @@ The Agent will resolve these relative to the skill directory automatically.
**Deployment:** **Deployment:**
- [ ] OpenCode restarted to load new skill - [ ] OpenCode restarted to load new skill
- [ ] Verified skill is discoverable - [ ] Verified skill is discoverable via one-shot test
- [ ] Documented in project if applicable - [ ] Documented in project if applicable
## Reference Files ## Reference Files

View File

@ -32,6 +32,7 @@ Ticket Workflow Progress:
- [ ] Step 9: Create draft PR - [ ] Step 9: Create draft PR
- [ ] Step 10: Review work with PR reviewer - [ ] Step 10: Review work with PR reviewer
- [ ] Step 11: Link PR to ticket - [ ] Step 11: Link PR to ticket
- [ ] Step 12: Session reflection
``` ```
## Prerequisites ## Prerequisites
@ -291,6 +292,29 @@ atlassian-mcp-server_addCommentToJiraIssue \
Implementation complete using TDD approach. Ready for code review." Implementation complete using TDD approach. Ready for code review."
``` ```
## Step 12: Session Reflection
**CRITICAL: After completing the ticket workflow, reflect on preventable issues**
```bash
# Invoke the reflect skill for post-session analysis
skills_reflect
```
The reflect skill will:
- Review the conversation history and workflow
- Identify preventable friction (auth issues, environment setup, etc.)
- Distinguish from expected development work (debugging, testing)
- Propose 1-3 concrete improvements within our control
**Only proceed with reflection after:**
- PR is created and validated
- PR review subagent gives go ahead
**No Improvements is OK**
Do not reach for fixing things that are already solved. If there are systemic problems, then address them, otherwise, continue on.
## Post-Workflow Steps (Manual) ## Post-Workflow Steps (Manual)
**After automated pr-reviewer approval and manual developer review:** **After automated pr-reviewer approval and manual developer review:**

View File

@ -0,0 +1,140 @@
---
name: reflect
description: Use after completing work sessions to identify preventable workflow friction and propose actionable improvements - analyzes tooling issues (auth failures, environment setup, missing dependencies) while distinguishing from expected development work
---
# Reflect
Post-session reflection to identify preventable workflow issues and propose simple, actionable improvements. Applies extreme ownership principles within circle of influence.
## When to Use This Skill
Use at end of work session when:
- Multiple authentication or permission errors occurred
- Repeated commands suggest missing setup
- Tooling/environment issues caused delays
- User explicitly requests reflection/retrospective
**When NOT to use:**
- Mid-session (wait until work complete)
- For expected development work (debugging logic, fixing tests)
- For system constraints outside control (CI/CD wait times, language limitations)
## Core Principle
**Question**: "How do we prevent this next time?"
Focus on **preventable friction** vs **expected work**:
- ✅ SSH keys not loaded → Preventable
- ✅ Docker containers from previous runs → Preventable
- ✅ Missing environment variables → Preventable
- ❌ Tests took time to debug → Expected work
- ❌ Code review iterations → Expected work
- ❌ CI/CD pipeline wait time → System constraint
## Analysis Framework
Review conversation history and todo list for:
**Tooling Issues** (high-value targets):
- Authentication failures (SSH, API tokens, credentials)
- Permission errors (file access, git operations)
- Environment setup gaps (missing dependencies, config)
- Repeated command patterns (signals missing automation)
**Time Measurement**:
- Tooling friction time vs actual implementation time
- Repeated failures on same issue
- Context switches due to environment problems
**Circle of Influence**:
- Within control: Shell config, startup scripts, documentation
- System constraints: Sprint structure, language choice, legal requirements
## Output Template
Use this structure for reflection output:
```markdown
# Session Reflection
## What Went Well
- [1-2 brief highlights of smooth workflow]
## Preventable Issues
[For each issue, use this format]
### Issue: [Brief description]
**Impact**: [Time lost / context switches]
**Root Cause**: [Why it happened]
**Prevention**: [Specific, actionable step]
**Category**: [Within our control / System constraint]
## Summary
[1 sentence key takeaway]
```
## Examples
### Good Issue Identification
**Issue**: SSH authentication failed on git push operations
**Impact**: 15 minutes lost, multiple retry attempts
**Root Cause**: SSH keys not loaded in ssh-agent at session start
**Prevention**: Add `ssh-add ~/.ssh/id_ed25519` to shell startup (.zshrc/.bashrc)
**Category**: Within our control
### Non-Issue (Don't Report)
**NOT an issue**: Test took 20 minutes to debug
**Why**: This is expected development work. Debugging tests is part of TDD workflow.
**NOT an issue**: Waiting 5 minutes for CI pipeline
**Why**: System constraint. Outside circle of influence.
## Analysis Process
1. **Review conversation**: Scan for error messages, repeated commands, authentication failures
2. **Check todo list**: Identify unexpected tasks added mid-session
3. **Measure friction**: Estimate time on tooling vs implementation
4. **Filter ruthlessly**: Exclude expected work and system constraints
5. **Focus on 1-3 issues**: Quality over quantity
6. **Propose concrete actions**: Specific commands, config changes, documentation updates
## Common Preventable Patterns
**Authentication**:
- SSH keys not in agent → Add to startup
- API tokens not set → Document in setup guide
- Credentials expired → Set up refresh automation
**Environment**:
- Dependencies missing → Add to README prerequisites
- Docker state issues → Document cleanup commands
- Port conflicts → Standardize port usage
**Workflow**:
- Manual steps repeated → Create shell alias/function
- Commands forgotten → Add to project CLAUDE.md
- Context switching → Improve error messages
## Balanced Perspective
**DO emphasize**:
- Preventable setup issues
- Missing documentation
- Automation opportunities
**DON'T complain about**:
- Time spent writing tests (that's the job)
- Code review feedback (improves quality)
- Normal debugging time (expected)
- Company processes (system constraints)
## Success Criteria
Good reflection provides:
- 1-3 glaring preventable issues (not 10+)
- Specific actionable improvements
- Honest assessment of what's controllable
- Avoids suggesting we skip essential work