Skill站外收录 @skilllib/skill-2014279403851689985
knowlegde
从项目讨论中提取关键变更并同步至文档,通过多源验证确保内容准确,自动识别需更新的文件位置,精准插入技术细节与架构图,保持文档与代码状态一致。
效率工具 AI 技能
Skills.MD
# Knowledge Extraction & Documentation Sync
Extracts knowledge from Amp threads and synchronizes project documentation.
## Pipeline
```
REQUEST → THREADS → TOPICS → CODE → DOCS
```
| Phase | Action | Tools |
|-------|--------|-------|
| 1. Discover | Find threads by query/time | `find_thread` |
| 2. Extract | Parallel topic extraction | `Task` + `read_thread` |
| 3. Verify | Ground topics in code | `gkg`, `finder` |
| 4. Map | Find target docs | `Read`, `Grep` |
| 5. Reconcile | Compare all sources | `Oracle` |
| 6. Apply | Surgical updates | `edit_file`, `mermaid` |
## Phase 1: Discover Threads
Start from user request:
```bash
# "Document last 2 weeks"
find_thread after:2w
# "Summarize auth work"
find_thread "authentication"
# "What touched the SDK?"
find_thread file:packages/sdk
# Combined
find_thread "refactor" after:1w file:packages/api
```
## Phase 2: Extract Topics
Spawn parallel `Task` agents (2-3 threads each):
```
Task prompt:
"Read threads [T-xxx, T-yyy] using read_thread.
Goal: 'Extract topics, decisions, changes'
Return JSON:
{
'topics': [{
'name': 'topic name',
'threads': ['T-xxx'],
'summary': '1-2 sentences',
'decisions': ['...'],
'patterns': ['...'],
'changes': ['...']
}]
}"
```
Collect outputs → Oracle synthesizes:
```
Oracle: "Cluster these extractions. Deduplicate.
Latest thread wins conflicts. Output unified topic list."
```
See `reference/extraction-prompts.md` for full templates.
## Phase 3: Verify Against Code
For each topic, verify claims:
```
Topic: "Added retry logic to API client"
1. finder "retry logic API client"
→ finds src/api/client.ts
2. gkg__search_codebase_definitions "retry"
→ RetryPolicy class at L45
3. gkg__get_references "RetryPolicy"
→ 12 usages across 4 files
→ Confirmed: topic matches code
```
| Claim Type | Verification |
|------------|--------------|
| "Added X" | `gkg__search_codebase_definitions "X"` |
| "Refactored Y" | `finder "Y"` → `gkg__get_references` |
| "Changed pattern" | `warpgrep "pattern implementation"` |
| "Updated config" | `gkg__repo_map` on config paths |
## Phase 4: Map to Docs
Discover existing documentation:
```bash
# Structure
gkg__repo_map on docs/, .claude/skills/, */AGENTS.md
# Find existing mentions
Grep "topic keyword" docs/
Grep "RetryPolicy" AGENTS.md
```
Read target files before updating:
```
Read docs/ARCHITECTURE.md
→ Note structure, sections, voice
→ Identify insertion point
```
See `reference/doc-mapping.md` for target file conventions.
## Phase 5: Reconcile
Oracle compares three sources:
```
Oracle prompt:
"Compare:
1. TOPICS: [extracted]
2. CODE: [verified state]
3. DOCS: [current content]
Output:
- GAPS: topics not in docs
- STALE: docs ≠ code
- UPDATES: [{file, section, change, rationale}]"
```
## Phase 6: Apply Updates
**Text updates**:
```
Read target → edit_file with precise changes
Preserve structure and voice
```
**Architecture diagrams**:
```
mermaid with citations:
{
"code": "flowchart LR\n A[Client] --> B[RetryPolicy]",
"citations": {
"Client": "file:///src/api/client.ts#L10",
"RetryPolicy": "file:///src/api/retry.ts#L45"
}
}
```
**Parallel updates**: Multiple unrelated files → spawn Task per file.
## Concrete Example
User: "Document the auth refactor from last week"
```
1. find_thread "auth" after:7d
→ [T-abc, T-def, T-ghi]
2. Task agents extract (parallel):
Agent A: T-abc → {topics: [{name: "JWT migration"}]}
Agent B: T-def, T-ghi → {topics: [{name: "session cleanup"}]}
3. Oracle clusters:
→ "Auth Refactor" with sub-topics
4. Verify:
gkg__search_codebase_definitions "JWTService"
→ confirmed at packages/auth/jwt.ts
5. Map docs:
Grep "authentication" AGENTS.md
→ Section exists at line 45
6. Oracle reconciles:
→ Gap: JWT migration not documented
→ Update: AGENTS.md auth section
7. Apply:
edit_file AGENTS.md add JWT details
mermaid auth flow diagram
```
## Tool Quick Reference
| Goal | Tool |
|------|------|
| Find threads | `find_thread query\|after:Xd\|file:path` |
| Read thread | `read_thread` with focused goal |
| Parallel extraction | `Task` (spawn multiple) |
| Find definitions | `gkg__search_codebase_definitions` |
| Find references | `gkg__get_references` |
| Semantic search | `finder` or `warpgrep` |
| Area overview | `gkg__repo_map` |
| Synthesis | `Oracle` |
| Read doc | `Read` |
| Search docs | `Grep` |
| Update doc | `edit_file` |
| Diagram | `mermaid` with citations |
## Quality Checklist
```
- [ ] Topics verified against code (GKG)
- [ ] Existing docs read before updating
- [ ] Changes surgical, not wholesale
- [ ] Mermaid diagrams have citations
- [ ] Terminology matches existing docs
```
## Troubleshooting
**Thread not found**: Try topic keywords, widen date range
**Too many threads**: Add `file:` filter, narrow dates
**Topic ≠ code**: Code is truth; note as "planned" or "historical"
**Doc structure unclear**: Read first, match existing patterns
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「knowlegde」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次