ワンクリックで
reflexion
Implement reflexion loops for self-critique, learning from failures, and continuous agent improvement
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Implement reflexion loops for self-critique, learning from failures, and continuous agent improvement
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Design system architecture, select technology stacks, create database schemas, and define API contracts
Implement server-side business logic, REST/GraphQL APIs, database models, authentication, and background jobs
Review code for quality, style, SOLID principles, complexity, and suggest refactoring opportunities
Design optimal database schemas, write efficient queries, create indexes, and manage migrations
Set up CI/CD pipelines, configure Docker/Kubernetes, write infrastructure as code, and implement monitoring
Generate API documentation, write README files, create runbooks, and maintain architecture records
| name | reflexion |
| description | Implement reflexion loops for self-critique, learning from failures, and continuous agent improvement |
| license | MIT |
| compatibility | opencode |
| metadata | {"audience":"ai-researchers","workflow":"learning"} |
I am the Reflexion System - self-improvement mechanism inspired by the Reflexion paper (Shinn et al.). I enable agents to learn from failures.
Failure Capture
Reflection Generation
Memory Storage
Retry with Knowledge
Use me when:
1. Capture Failure:
information_gathered:
- Original task description
- Agent's approach
- Code/output produced
- Test results
- Error messages
- Stack traces
- Performance metrics
2. Generate Reflection:
LLM Prompt:
You attempted to complete this task:
{task_description}
Your approach was:
{approach_taken}
The code you wrote:
{code}
Test results:
{test_results}
Errors encountered:
{errors}
Performance metrics:
{metrics}
This was attempt #{attempt_number}.
Provide a detailed reflection:
1. ROOT CAUSE ANALYSIS
- What exactly went wrong?
- Why did it happen?
- What was fundamental error in reasoning?
2. INCORRECT ASSUMPTIONS
- What did you assume that was wrong?
- What did you overlook?
- What edge cases did you miss?
3. ALTERNATIVE APPROACHES
- What should you try differently?
- What patterns or techniques would work better?
- What additional validation is needed?
4. GENERALIZABLE LEARNINGS
- What lesson applies to similar tasks?
- What pattern should you remember?
- What should you check for next time?
Be specific and actionable. Focus on what to change, not just what went wrong.
Output Structure:
root_cause:
technical: str
reasoning: str
incorrect_assumptions:
- assumption: str
why_wrong: str
correct_approach: str
improved_strategy:
approach: str
implementation_steps: [str]
validation_plan: str
lessons_learned:
- lesson: str
applicability: str
pattern_name: str
3. Store Reflection:
Episodic Memory:
Pattern Library:
4. Retry with Knowledge:
Enhanced Context:
Retry with Improvements:
Task: Implement user authentication
Attempt 1:
Reflexion:
root_cause:
technical: Passwords stored without hashing
reasoning: Didn't consider security best practices
incorrect_assumptions:
- "Simple storage is acceptable" → Wrong
- "Application-level security sufficient" → Wrong
improved_strategy:
approach: Use bcrypt for password hashing
implementation:
- Hash password before storing
- Use high cost factor (12+)
- Add salt automatically
- Never retrieve or log passwords
validation:
- Security audit
- Penetration testing
- Check against OWASP guidelines
lessons_learned:
- Always hash passwords (bcrypt, Argon2)
- Never store sensitive data in plain text
- Security audit before deployment
- Follow OWASP authentication guidelines
Attempt 2:
Pattern Stored:
name: secure_password_storage
description: Hash passwords with bcrypt
implementation: |
import bcrypt
def hash_password(password: str) -> str:
salt = bcrypt.gensalt(rounds=12)
return bcrypt.hashpw(password.encode(), salt).decode()
def verify_password(password: str, hash: str) -> bool:
return bcrypt.checkpw(password.encode(), hash.encode())
applies_to:
- User authentication
- Password reset
- Any credential storage
When working with me:
I store in memory:
This enables continuous improvement across all agents.