AgentSkillsCN

docs-tests-sync

通过知识图谱实现语义化的代码发现与导航。当您需要按语义搜索代码、查找依赖关系、分析调用图,或在多个代码库中发掘符号引用时,可使用此工具。

SKILL.md
--- frontmatter
name: docs-tests-sync
description: Synchronizes documentation with tests across services. Use when updating documentation, adding features, or verifying test coverage matches documented behavior.

Docs-Tests Sync Skill

Document → Extract Features/Flows → Match Tests → Generate Reports → Update Tests.

Quick Reference

  • Flow: See flow.md for detailed sync workflow
  • Templates: See templates.md for output formats

Core Principle

Documentation drives tests. Every documented feature/flow MUST have corresponding tests.


Sync Process

  1. Discover - Find all services with docs (README.md, ARCHITECTURE.md)
  2. Extract - Parse features and flows from documentation
  3. Analyze - Find existing tests and match to features
  4. Report - Generate coverage report with gaps
  5. Update - Create/update tests for missing coverage

Feature Extraction Patterns

Extract from documentation:

PatternSource
### Core ResponsibilitiesNumbered features with **Name**:
## API EndpointsTable with Method/Path/Description
### {Service} FlowNumbered steps (GitHub, Jira, Slack, Sentry)
- \name` - description`Agent/skill definitions

Coverage Levels

LevelCriteriaBadge
TESTED2+ related tests[TESTED]
PARTIAL1 related test[PARTIAL]
NEEDS TESTS0 tests[NEEDS TESTS]

Service Discovery

Target directories:

  • api-gateway/ - Webhook handlers
  • agent-engine/ - Task execution
  • dashboard-api/ - Analytics
  • api-services/{github,jira,slack,sentry}-api/ - External APIs
  • mcp-servers/{name}/ - MCP integrations
  • oauth-service/, task-logger/, gkg-service/, llamaindex-service/, indexer-worker/

Test Matching Rules

Match test to feature when:

  • Test name contains 2+ keywords from feature name
  • Test docstring mentions feature
  • Test file name matches service area

Output Files

Generate per service in {service}/docs/:

  • ARCHITECTURE.md - Component diagrams, protocols, data flows (mermaid)
  • features.md - All features with coverage status
  • flows.md - All flows with step validation

Generate in root docs/:

  • SYNC_REPORT.md - Master coverage report

Sync Triggers

Run sync when:

  • README.md or ARCHITECTURE.md changes
  • New tests added
  • Feature behavior changes
  • Before major releases

Anti-Patterns

Don'tDo
Skip undocumented featuresAdd to README first
Write tests without docsDocument behavior first
Ignore coverage gapsCreate test suggestions
Manual trackingAuto-generate reports