Skill站外收录 @skilllib/skill-2117939930272417468
canonical-format-checker
确保教学内容与平台各模式的权威格式严格一致,涵盖技能、子智能体、决策记录、提示历史及规范文档等结构,通过比对源文件路径、目录层级、元数据字段和内容组织方式,及时发现并修正格式偏移,保障知识体系的一致性与可维护性。
文档处理 AI 技能
Skills.MD
# Canonical Format Checker
## Overview
Prevent format drift by verifying content follows authoritative canonical sources. When teaching a pattern that exists elsewhere in the platform (skills, subagents, ADRs, etc.), this skill ensures the taught format matches the canonical source.
**Why this matters**: The Chapter 14 format drift failure occurred because the lesson taught skill format differently from Chapter 5 (canonical source). Students learned incorrect patterns that contradicted earlier chapters.
## When to Use This Skill
**Automatic Triggers** (check before implementation):
- Lesson teaches how to create skills → Check `.claude/skills/` structure
- Lesson teaches how to write subagents → Check `.claude/agents/` structure
- Lesson teaches ADR format → Check `specs/*/adrs/` structure
- Lesson teaches PHR format → Check `history/prompts/` structure
- Lesson teaches specification format → Check `specs/*/spec.md` structure
**Manual Triggers** (user requests):
- "Check canonical format for skills"
- "Verify format consistency"
- "Does this match the canonical source?"
## Canonical Source Lookup Table
| Pattern Being Taught | Canonical Source Location | Key Format Elements |
|---------------------|--------------------------|---------------------|
| **Skills** | `.claude/skills/<name>/SKILL.md` | Directory structure, YAML frontmatter with `name`, `description` |
| **Subagents** | `.claude/agents/<name>.md` | YAML frontmatter with `name`, `description`, `model`, `skills` |
| **ADRs** | `specs/<feature>/adrs/adr-*.md` | Numbered files, standard ADR structure |
| **PHRs** | `history/prompts/<stage>/` | Template from `.specify/templates/phr-template.prompt.md` |
| **Specifications** | `specs/<feature>/spec.md` | Sections: Overview, User Stories, FRs, SCs, Evals |
| **Commands** | `.claude/commands/*.md` | YAML frontmatter, step-by-step phases |
## Workflow
### Step 1: Identify What Pattern Is Being Taught
Ask yourself:
- Does this lesson teach how to CREATE any platform pattern?
- Is there an existing canonical source for this pattern?
```
Trigger Examples:
- "Lesson teaches students to write their own skills" → Skills pattern
- "Chapter covers custom commands" → Commands pattern
- "Module explains agent creation" → Subagents pattern
```
### Step 2: Locate and Read Canonical Source
**MANDATORY**: Read the canonical source BEFORE writing or reviewing content.
```bash
# For Skills - read actual skill structure
ls .claude/skills/*/
cat .claude/skills/session-intelligence-harvester/SKILL.md
# For Agents - read actual agent structure
ls .claude/agents/
cat .claude/agents/content-implementer.md
# For Commands - read actual command structure
ls .claude/commands/
head -50 .claude/commands/sp.specify.md
```
### Step 3: Extract Format Requirements
Document the required format elements from canonical source:
```markdown
## Canonical Format: Skills
**Directory Structure**:
```
.claude/skills/
└── <skill-name>/ # Directory, NOT flat file
└── SKILL.md # SKILL.md file (uppercase)
```
**YAML Frontmatter** (REQUIRED):
```yaml
---
name: "<skill-name>"
description: "This skill should be used when... Use when..."
---
```
**Content Structure**:
1. H1 title matching skill name
2. Overview section explaining purpose
3. When to Use section with triggers
4. Workflow section with steps
```
### Step 4: Compare Content Against Canonical
Check the lesson/content for format consistency:
```markdown
## Format Comparison Checklist
**Skill Format Check**:
- [ ] Shows directory structure (not flat file)
- [ ] Uses SKILL.md filename (not skill.md or index.md)
- [ ] Includes YAML frontmatter with `name` and `description`
- [ ] `description` starts with "This skill should be used when..."
**Agent Format Check**:
- [ ] Shows single .md file in agents directory
- [ ] Includes YAML frontmatter with `name`, `description`, `model`
- [ ] Includes `skills` array (can be empty)
- [ ] Description explains when to invoke
**Command Format Check**:
- [ ] Shows .md file in commands directory
- [ ] Has numbered phases with clear gates
- [ ] Includes enforcement checks
```
### Step 5: Report Drift or Confirm Compliance
**If Format Drift Detected**:
```markdown
## Format Drift Detected
**Pattern**: Skills
**Location**: Lesson 7, Section "Creating Your First Skill"
**Issue**: Shows flat file `.claude/skills/my-skill.md`
**Canonical**: Directory structure `.claude/skills/my-skill/SKILL.md`
**Specific Fixes Required**:
1. Line 45: Change `.claude/skills/my-skill.md` to `.claude/skills/my-skill/SKILL.md`
2. Line 52: Update example to show directory creation with `mkdir`
3. Line 60: Add YAML frontmatter example with required fields
**Cross-Reference**: Chapter 5, Lesson 7 (agent-skills.md) is canonical source
```
**If Format Compliant**:
```markdown
## Format Verified
**Pattern**: Skills
**Canonical Source**: `.claude/skills/session-intelligence-harvester/SKILL.md`
**Content Location**: Chapter 14, Lesson 5
**Verification**:
- [x] Directory structure matches canonical
- [x] YAML frontmatter format correct
- [x] Required fields present (name, description)
- [x] Description follows "This skill should be used when..." pattern
**Status**: COMPLIANT - No drift detected
```
## Common Format Drift Patterns
### Drift Pattern 1: Flat Files vs Directories
**Wrong**: `.claude/skills/my-skill.md`
**Right**: `.claude/skills/my-skill/SKILL.md`
### Drift Pattern 2: Missing YAML Frontmatter
**Wrong**: Markdown file with no frontmatter
**Right**: YAML frontmatter with required fields
### Drift Pattern 3: Wrong Filename
**Wrong**: `skill.md`, `index.md`, `README.md`
**Right**: `SKILL.md` (uppercase)
### Drift Pattern 4: Missing Required Fields
**Wrong**: Only `name` in frontmatter
**Right**: Both `name` and `description` (description starts with "This skill should be used when...")
### Drift Pattern 5: Inventing New Format
**Wrong**: Creating custom format not matching canonical
**Right**: Following exact structure from canonical source
## Integration Points
**Use With**:
- `chapter-planner` - Check during lesson planning phase
- `content-implementer` - Verify before implementation
- `validation-auditor` - Include in validation checklist
**Invoke When**:
- Planning lessons that teach platform patterns
- Reviewing content that describes file structures
- Validating documentation about Claude Code features
## Self-Monitoring
Before approving content that teaches patterns:
- [ ] Identified what pattern is being taught
- [ ] Located and READ the canonical source
- [ ] Extracted format requirements from canonical
- [ ] Compared content against canonical requirements
- [ ] Detected drift OR confirmed compliance
- [ ] Provided specific fix instructions if drift found
## Success Criteria
**You succeed when**:
- Format drift detected BEFORE publication
- Specific canonical source identified and referenced
- Exact format requirements documented
- Content matches canonical source exactly
**You fail when**:
- Content teaches incorrect format that contradicts canonical
- Canonical source not checked before implementation
- Vague feedback ("fix the format") instead of specific corrections
- New patterns invented instead of following canonical
评论 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
举报「canonical-format-checker」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次