ワンクリックで
continuous-learning-agent
Self-improvement patterns for AI agents to learn from feedback, errors, and successful patterns across sessions
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Self-improvement patterns for AI agents to learn from feedback, errors, and successful patterns across sessions
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Set up Cloudflare Turnstile end-to-end in a project: scan the codebase, create the widget via the Cloudflare API, deploy the managed siteverify Worker, write the frontend snippets, validate, and persist the skill. Load this when a user asks to add Turnstile, set up CAPTCHA, protect a form from bots, or fix a Turnstile integration. Mirrors developers.cloudflare.com/turnstile/spin.
Four-phase protocol for clearing accumulated drift between memory claims, CLAUDE.md citations, and on-disk reality. Detects stale citations, missing files, and orphan plans; classifies findings; emits proposed diffs; codifies prevention. Companion to closeout (closeout discovers orphans; this skill polishes them). Discovery ≠ remediation — Phase 3 emits proposed diffs only; constitutional doc edits require explicit conductor authorization.
Ingest a corpus of session logs (JSONL transcripts, chat exports) and extract a persona profile — vocabulary frequency, unique idioms and coinages, structural analogies — then synthesize an ideal_yearning and archetypal_pattern and append the result to a {persona_id}.lexicon.yaml. Triggers on "extract persona", "build a lexicon", "map the domain language", or any request to process conversation logs into a voice/vocabulary model.
Apply narratological scoring to a text, transcript, or recording transcript — rating contiguous spans for pathos, logos, ethos, kairos, and density — then extract the single highest-scoring contiguous block as the work's Natural Center, with a scoring table and justification. Triggers on "find the natural center", "extract the most dramatic moment", "what's the strongest passage", or pulling the peak block from a long artifact for a short, excerpt, or trailer.
Transform any data, document, deck, README, manifest, config, or report by (1) extracting every piece of dynamic information — names, links, statistics, costs, identifiers, dates, thresholds — into configurable variables instead of hard-coding, and (2) enforcing that every factual assertion carries at least two independent citations. Triggers on "remove branding," "make this reusable," "transmute this," "parametrize," "no hard-coded values," "configurable," "needs citations," "verify these claims," or any request to convert a one-off artifact into a parameterized template.
Scan rough markdown, session exports, or pasted prose and isolate each core intent into a structured prompt atom — classified as law, value, directive, constraint, question, or branch-vector — then rewrite it into machine-readable YAML frontmatter per the RAW → CLEANED/FORMALIZED → ELEVATED doctrine. Triggers on "prompt atom extraction pass", "atomize this", "formalize these prompts", or converting loose operator text into registry-grade atoms.
| name | continuous-learning-agent |
| description | Self-improvement patterns for AI agents to learn from feedback, errors, and successful patterns across sessions |
| license | MIT |
| metadata | {"source":"affaan-m/everything-claude-code","adapted-by":"ai-skills","category":"agent-improvement"} |
| governance_phases | ["prove"] |
| organ_affinity | ["organ-iv"] |
| triggers | ["user-asks-about-agent-learning","context:ai-agents"] |
A meta-skill that enables AI agents to learn from experience and improve over time by separating journaled memory from policy changes that alter future behavior.
Traditional agents reset completely between sessions. This skill treats memory and learning as related but distinct operations:
Do not call a session log, decision journal, or context note "learning" unless it produces a policy delta, threshold revision, banned move, or acquired pattern that changes future behavior.
Every learning loop has two layers:
The journal layer is optional when an existing memory system already covers it. The policy layer is mandatory for this skill.
After each error, first document the event if no existing memory system already captures it:
## Error Log Entry
**Date**: 2026-01-30
**Context**: Implementing user authentication
**Error**: TypeError: Cannot read property 'id' of undefined
**Root Cause**: Missing null check before accessing user object
**Fix**: Added optional chaining: user?.id
**Pattern**: Always validate object existence before property access
**Prevention**: Add TypeScript strict null checks
Then extract the policy delta:
## Policy Delta: [Short Title]
**Date**: 2026-01-30
**Event Class**: Accessing nested properties on possibly absent objects
**Prior Policy**: Read nested properties directly after optimistic object construction.
**Failure Mode**: Undefined objects caused runtime TypeErrors.
**Revised Policy**: Validate object existence or use typed optional access before nested reads.
**Trigger**: Any code path receiving user, API, database, or tool-returned objects.
**Propagation Target**: Project AGENTS.md, test helper, lint rule, or skill source.
**Verification**: Add or run a test that fails under the prior policy and passes under the revised policy.
After successful implementations, record both the reusable pattern and the policy form that lets future agents apply it without replaying the whole story:
## Success Pattern
**Task**: Add pagination to API endpoint
**Approach**: Cursor-based pagination with encoded tokens
**Why It Worked**: Handles large datasets efficiently, stateless
**Reusable Pattern**:
- Use cursor tokens instead of offset/limit
- Encode cursor with base64
- Include hasNext/hasPrevious flags
- Return next/previous cursor in response
**Code Template**:
\`\`\`typescript
interface PaginatedResponse<T> {
data: T[];
cursor: {
next: string | null;
previous: string | null;
};
}
\`\`\`
## Acquired Pattern
**Event Class**: API endpoints returning large ordered datasets
**Revised Policy**: Prefer cursor tokens over offset pagination unless the product explicitly needs random page access.
**Trigger**: New list endpoint over a growing table or external API collection.
**Verification**: Exercise first page, next page, empty page, and invalid cursor behavior.
Use the active project's policy surface when one exists. Examples:
AGENTS.md, CLAUDE.md, GEMINI.md, or other runtime instruction files for enduring operating rules..claude/policy/, .codex/policy/, .agents/policy/, or equivalent for local policy deltas.Only create a local journal directory when there is no stronger existing memory surface:
mkdir -p .claude/journal .claude/policy/deltas
Store journal records and policy deltas separately:
.claude/journal/
patterns/
authentication.md
database-queries.md
error-handling.md
mistakes/
common-bugs.md
performance-issues.md
preferences/
code-style.md
testing-approach.md
naming-conventions.md
.claude/policy/
deltas/
2026-01-30-null-check-before-property-access.md
banned-moves.md
thresholds.md
acquired-patterns.md
Before major decisions:
## Decision: [Title]
**Context**: Current situation requiring decision
**Options Considered**:
1. Option A - Pros: X, Cons: Y
2. Option B - Pros: X, Cons: Y
3. Option C - Pros: X, Cons: Y
**Decision**: Chose Option B
**Reasoning**: Detailed explanation
**Expected Outcome**: What we expect to happen
**Actual Outcome**: (Fill after implementation)
**Policy Delta**: What future behavior changes because of this decision
At end of coding session:
## Session Review - [Date]
**What Went Well**:
- Successfully implemented X
- Discovered pattern Y
- Improved performance of Z
**What Could Improve**:
- Spent too long debugging A
- Should have tested B earlier
- Missed edge case C
**Journal Notes**:
1. Notable event 1
2. Notable event 2
**Policy Deltas**:
1. Event class -> revised behavior
2. Event class -> revised threshold
**Action Items**:
- [ ] Apply policy delta to the correct instruction or policy file
- [ ] Verify the new behavior with a test, checklist, or next-session review
Every week, review and synthesize:
# Generate weekly summary
grep -h "^**Policy Deltas**" .claude/journal/daily/*.md -A 5 > weekly-policy-synthesis.md
## Weekly Synthesis - Week of [Date]
**Emerging Policy Changes**:
- Pattern 1: Description
- Pattern 2: Description
**Recurring Issues**:
- Issue 1: Root cause analysis
- Issue 2: Root cause analysis
**Rules to Promote**:
- Rule 1: Target file and reason
- Rule 2: Target file and reason
**Next Week Focus**:
- Focus area 1
- Focus area 2
Maintain context file:
# Project Context
**Type**: Web application / API / CLI tool / Library
**Tech Stack**: Next.js, TypeScript, Prisma, PostgreSQL
**Architecture**: Monorepo with packages: api, web, shared
**Key Patterns**:
- Feature-based folder structure
- Repository pattern for data access
- Service layer for business logic
**Team Preferences**:
- Test coverage: 80% minimum
- Code style: Prettier + ESLint
- Commit messages: Conventional commits
- PR process: Requires review + CI pass
Track understanding level:
## Understanding Map
**Well Understood** (★★★):
- Authentication flow
- Database schema
- API endpoints
**Partially Understood** (★★):
- Caching strategy
- Error handling patterns
**Need to Learn** (★):
- Deployment process
- Monitoring setup
- Feature flags system
After completing any task:
#!/bin/bash
# .claude/hooks/post-task.sh
echo "## Task Completed: $1" >> .claude/journal/daily/$(date +%Y-%m-%d).md
echo "" >> .claude/journal/daily/$(date +%Y-%m-%d).md
echo "**Approach**: $2" >> .claude/journal/daily/$(date +%Y-%m-%d).md
echo "**Outcome**: $3" >> .claude/journal/daily/$(date +%Y-%m-%d).md
echo "**Policy Delta**: $4" >> .claude/journal/daily/$(date +%Y-%m-%d).md
echo "" >> .claude/journal/daily/$(date +%Y-%m-%d).md
Before starting task:
#!/bin/bash
# .claude/hooks/pre-task.sh
# Check for similar past tasks
echo "Checking learnings for: $1"
grep -r "$1" .claude/policy .claude/journal 2>/dev/null | head -5
# Check for known pitfalls
grep -r "mistake.*$1" .claude/policy .claude/journal 2>/dev/null
.claude/
journal/
daily/
2026-01-30.md
2026-01-29.md
weekly/
2026-week-05.md
patterns/
successful/
authentication-patterns.md
api-design-patterns.md
antipatterns/
common-mistakes.md
performance-pitfalls.md
context/
project-overview.md
tech-stack.md
team-preferences.md
decisions/
architecture-decisions.md
technology-choices.md
policy/
deltas/
2026-01-30-null-check-before-property-access.md
acquired-patterns.md
banned-moves.md
thresholds.md
# Search for pattern
grep -r "pagination" .claude/policy .claude/journal/patterns/
# Find past mistakes
grep -r "TypeError" .claude/policy .claude/journal/mistakes/
# Check decisions
grep -r "decision.*database" .claude/journal/decisions/
# Get all successful patterns
grep -h "^## Success Pattern" .claude/journal/patterns/successful/*.md
# Get all lessons learned
grep -h "^**Policy Delta**" .claude/journal .claude/policy -R -A 3
Complements:
As agent improves:
Level 1: Basic journal logging Level 2: Policy delta extraction Level 3: Policy propagation into the right instruction surface Level 4: Verification that future behavior changed Level 5: Autonomous decision-making within approved constraints
Track current level and progression metrics.
Track improvement:
## Agent Performance Metrics
**Error Rate**: Errors per task over time
**Pattern Reuse**: How often policy deltas are applied
**Decision Quality**: Outcome vs. expected outcome alignment
**Context Accuracy**: How well agent understands project
**Adaptation Speed**: Time to learn new patterns
**Propagation Rate**: How often journaled lessons become active policy
**Trend**: Improving / Stable / Declining
First time setup:
# Create journal and policy infrastructure
mkdir -p .claude/journal/{daily,weekly,patterns,mistakes,context,decisions}
mkdir -p .claude/policy/deltas
# Initialize context file
cat > .claude/journal/context/project-overview.md << 'EOF'
# Project Overview
- Project type:
- Tech stack:
- Architecture:
- Key files:
EOF
# Create first session log
date +%Y-%m-%d > .claude/journal/daily/$(date +%Y-%m-%d).md
Start every session by reviewing active policy first, then journal records only when they are relevant to the task.