Skip to content
Back to skills

Session

ASecurity

Session lifecycle management. Parent skill for session-related skills: learning (pattern extraction) and compact (context compression).

  • 50 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added February 7, 2026
development

Works with

  • claude code

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add xiaobei930/claude-code-best-practices --skill session --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Session?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Session
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/xiaobei930-session/badge)](https://www.skillsdirectory.com/skills/xiaobei930-session)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: session
description: "Session lifecycle management. Parent skill for session-related skills: learning (pattern extraction) and compact (context compression)."
allowed-tools: Read, Grep, Glob
---

# 会话生命周期管理

本技能提供 Claude Code 会话的生命周期管理策略,整合持续学习和上下文压缩。

## 会话生命周期

```
会话开始 ──→ 工作阶段 ──→ 检查点 ──→ 会话结束
    │           │           │           │
    │           │           │           └─→ 提取模式 (/learning)
    │           │           └─→ 上下文压缩 (/cc-best:compact)
    │           └─→ 持续工作
    └─→ 加载上次上下文
```

## 策略选择

| 场景             | 推荐策略       | 子技能      |
| ---------------- | -------------- | ----------- |
| 上下文接近限制   | 策略性压缩     | `/cc-best:compact`  |
| 完成重要任务节点 | 主动压缩       | `/cc-best:compact`  |
| 会话结束时       | 提取可复用模式 | `/learning` |
| 解决了复杂问题   | 记录解决方案   | `/learning` |
| 发现项目特定知识 | 记录到知识库   | `/learning` |

## 子技能

### 1. learning(持续学习)

**适用场景**:

- 会话结束时提取模式
- 记录调试技巧
- 保存项目特定知识
- 积累可复用解决方案

**使用方式**:`/learning` 或参阅 `skills/learning/SKILL.md`

### 2. compact(上下文压缩)

**适用场景**:

- 上下文接近限制时
- 完成阶段性任务后
- 切换工作主题前
- 需要释放上下文空间

**使用方式**:`/cc-best:compact` 或参阅 `skills/compact/SKILL.md`

## 最佳实践

### 何时压缩

1. **主动压缩** - 完成一个功能模块后
2. **被动压缩** - 系统提示上下文接近限制
3. **切换压缩** - 准备切换到不同任务前

### 何时记录

1. **立即记录** - 解决问题后立即记录
2. **定期回顾** - 会话结束前检查值得记录的内容
3. **增量更新** - 发现新知识时更新已有记录

## 会话健康指标

| 指标         | 健康状态 | 行动         |
| ------------ | -------- | ------------ |
| 上下文使用   | < 70%    | 继续工作     |
| 上下文使用   | 70-90%   | 考虑压缩     |
| 上下文使用   | > 90%    | 立即压缩     |
| 有价值的发现 | 有       | 记录到知识库 |

---

**记住**:良好的会话管理让每次对话都能高效利用上下文,同时积累可复用的知识。

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…