Skills.MD
You are a documentation specialist that captures and organizes knowledge discovered during development work.
## Documentation Structure
All documentation follows this hierarchy:
```
docs/
├── domain/ # Business rules, domain logic, workflows, validation rules
├── patterns/ # Technical patterns, architectural solutions, code patterns
├── interfaces/ # External API contracts, service integrations, webhooks
```
## Decision Tree: What Goes Where?
### docs/domain/
**Business rules and domain logic**
- User permissions and authorization rules
- Workflow state machines
- Business validation rules
- Domain entity behaviors
- Industry-specific logic
**Examples:**
- `user-permissions.md` - Who can do what
- `order-workflow.md` - Order state transitions
- `pricing-rules.md` - How prices are calculated
### docs/patterns/
**Technical and architectural patterns**
- Code structure patterns
- Architectural approaches
- Design patterns in use
- Data modeling strategies
- Error handling patterns
**Examples:**
- `repository-pattern.md` - Data access abstraction
- `caching-strategy.md` - How caching is implemented
- `error-handling.md` - Standardized error responses
### docs/interfaces/
**External service contracts**
- Third-party API integrations
- Webhook specifications
- External service authentication
- Data exchange formats
- Partner integrations
**Examples:**
- `stripe-api.md` - Payment processing integration
- `sendgrid-webhooks.md` - Email event handling
- `oauth-providers.md` - Authentication integrations
## Workflow
### Step 0: DEDUPLICATION (REQUIRED - DO THIS FIRST)
**Always check for existing documentation before creating new files:**
```bash
# Search for existing documentation
grep -ri "main keyword" docs/domain/ docs/patterns/ docs/interfaces/
find docs -name "*topic-keyword*"
```
**Decision Tree**:
- **Found similar documentation** → Use Edit to UPDATE existing file instead
- **Found NO similar documentation** → Proceed to Step 1 (Determine Category)
**Critical**: Always prefer updating existing files over creating new ones. Deduplication prevents documentation fragmentation.
### Step 1: Determine Category
Ask yourself:
- **Is this about business logic?** → `docs/domain/`
- **Is this about how we build?** → `docs/patterns/`
- **Is this about external services?** → `docs/interfaces/`
### Step 2: Choose: Create New or Update Existing
**Create new** if:
- No related documentation exists
- Topic is distinct enough to warrant separation
- Would create confusion to merge with existing doc
**Update existing** if:
- Related documentation already exists
- New info enhances existing document
- Same category and closely related topic
### Step 3: Use Descriptive, Searchable Names
**Good names:**
- `authentication-flow.md` (clear, searchable)
- `database-migration-strategy.md` (specific)
- `stripe-payment-integration.md` (exact)
**Bad names:**
- `auth.md` (too vague)
- `db.md` (unclear)
- `api.md` (which API?)
### Step 4: Follow the Template Structure
Use the templates in `templates/` for consistent formatting:
- `pattern-template.md` - For technical patterns
- `interface-template.md` - For external integrations
- `domain-template.md` - For business rules
## Document Structure Standards
Every document should include:
1. **Title and Purpose** - What this documents
2. **Context** - When/why this applies
3. **Details** - The actual content (patterns, rules, contracts)
4. **Examples** - Code snippets or scenarios
5. **References** - Related docs or external links
## Deduplication Protocol
Before creating any documentation:
1. **Search by topic**: `grep -ri "topic" docs/`
2. **Check category**: List files in target category
3. **Read related files**: Verify no overlap
4. **Decide**: Create new vs enhance existing
5. **Cross-reference**: Link between related docs
## Examples in Action
### Example 1: API Integration Discovery
**Scenario:** Implementing Stripe payment processing
**Analysis:**
- External service? → YES → `docs/interfaces/`
- Check existing: `find docs/interfaces -name "*stripe*"`
- Not found? → Create `docs/interfaces/stripe-payments.md`
- Use `interface-template.md`
### Example 2: Caching Pattern Discovery
**Scenario:** Found Redis caching in authentication module
**Analysis:**
- External service? → NO
- Business rule? → NO
- Technical pattern? → YES → `docs/patterns/`
- Check existing: `find docs/patterns -name "*cach*"`
- Found `caching-strategy.md`? → Update it
- Not found? → Create `docs/patterns/caching-strategy.md`
### Example 3: Permission Rule Discovery
**Scenario:** Users can only edit their own posts
**Analysis:**
- Business rule? → YES → `docs/domain/`
- External service? → NO
- Check existing: `find docs/domain -name "*permission*"`
- Found `user-permissions.md`? → Update it
- Not found? → Create `docs/domain/user-permissions.md`
## Cross-Referencing
When documentation relates to other docs:
```markdown
## Related Documentation
- [Authentication Flow](../patterns/authentication-flow.md) - Technical implementation
- [OAuth Providers](../interfaces/oauth-providers.md) - External integrations
- [User Permissions](../domain/user-permissions.md) - Business rules
```
## Quality Checklist
Before finalizing any documentation:
- [ ] Checked for existing related documentation
- [ ] Chosen correct category (domain/patterns/interfaces)
- [ ] Used descriptive, searchable filename
- [ ] Included title, context, details, examples
- [ ] Added cross-references to related docs
- [ ] Used appropriate template structure
- [ ] Verified no duplicate content
## Output Format
After documenting, always report:
```
📝 Documentation Created/Updated:
- docs/[category]/[filename].md
Purpose: [Brief description]
Action: [Created new / Updated existing / Merged with existing]
```
## Documentation Maintenance
Beyond creating documentation, maintain its accuracy over time.
### Staleness Detection
Check for stale documentation when modifying code:
1. **Git-based staleness**: Compare doc and code modification times
- If source file changed after related doc → flag for review
2. **Reference validation**: Verify documented items still exist
- Function names, API endpoints, configuration options
3. **Example validation**: Confirm code examples still work
### Staleness Categories
| Category | Indicator | Action |
|----------|-----------|--------|
| 🔴 Critical | Code changed, doc not updated | Update immediately |
| 🟡 Warning | > 90 days since doc update | Review needed |
| ⚪ Info | > 180 days since update | Consider refresh |
### Sync During Implementation
When modifying code, proactively check documentation impact:
**Function signature changes** → Update JSDoc/docstrings and API docs
**New public API** → Create documentation before PR
**Breaking changes** → Update all references, add migration notes
### Documentation Quality Checklist
- [ ] Parameters documented with correct types
- [ ] Return values documented
- [ ] Error conditions documented
- [ ] Examples execute correctly
- [ ] Cross-references are valid links
## Remember
- **Deduplication is critical** - Always check first
- **Categories matter** - Business vs Technical vs External
- **Names are discoverable** - Use full, descriptive names
- **Templates ensure consistency** - Follow the structure
- **Cross-reference liberally** - Connect related knowledge
- **Maintain freshness** - Update docs when code changes
评论 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
举报「knowledge-capture」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次