スキル一覧に戻る
koedame

sync-spec

by koedame

0🍴 0📅 2026年1月24日
GitHubで見るManusで実行

SKILL.md


name: sync-spec description: Check and synchronize specification documents (docs-spec/) with implementation (src/, src-tauri/, tests/). Detect discrepancies and auto-fix when possible. allowed-tools: Read, Glob, Grep, Edit, Write, Bash(cargo:*), AskUserQuestion

Specification Synchronizer

Instructions

Phase 1: Scan Specifications

  1. Read all API specs from docs-spec/api/*.md
  2. Read architecture from docs-spec/architecture.md
  3. Read BDD scenarios from docs-spec/behavior/*.feature

For each spec file, extract:

  • Rust code blocks containing struct, enum, trait, fn definitions
  • Thread constraints (スレッド: リアルタイム/非リアルタイム/任意)
  • Module structure diagrams

Phase 2: Scan Implementation

  1. Find all Rust files: src/**/*.rs, src-tauri/**/*.rs

  2. For each file, search for:

    • pub struct definitions
    • pub enum definitions
    • pub trait definitions
    • pub fn definitions
    • impl blocks
  3. Find existing tests: tests/**/*.rs

Phase 3: Match and Compare

Use this mapping table:

Spec FileImplementation Files
docs-spec/api/audio_engine.mdsrc/audio/engine.rs, src/audio/device.rs, src/audio/effects.rs, src/audio/recording.rs, src/audio/metronome.rs
docs-spec/api/network.mdsrc/network/connection.rs, src/network/session.rs, src/network/fec.rs, src/network/transport.rs
docs-spec/api/signaling.mdsrc/network/signaling.rs
docs-spec/api/plugin.mdsrc/audio/plugin.rs
docs-spec/api/i18n.mdui/locales/*.json
docs-spec/behavior/*.featuretests/*.rs

Compare:

  • Struct names and fields (name, type)
  • Enum variants
  • Trait methods (signature)
  • Function signatures (name, parameters, return type)

Phase 4: Auto-fix or Ask

Auto-fix (high confidence):

  • Missing struct/enum/fn in impl → Add stub to implementation
  • Missing pub item in spec → Add to spec documentation
  • Missing doc comments → Add based on spec description
  • Missing test file → Create test skeleton

Ask user (low confidence):

  • Signature differs (design choice needed)
  • Implementation more complex than spec (generics, extra params)
  • Conflicts with ADR decisions

Use AskUserQuestion when unsure (with recommendation):

  • Always provide a recommended option based on project requirements
  • Explain why the recommendation is best

Example:

  • Question: "Signature mismatch for fn start_capture. Which to fix?"
  • Options:
    1. "Update implementation (Recommended): Spec is source of truth per CLAUDE.md"
    2. "Update spec: If implementation has better design rationale"
    3. "Skip: Defer decision"

Phase 5: Ensure Tests

  1. For each Scenario: in docs-spec/behavior/*.feature:

    • Map to test file: connection.featuretests/connection_test.rs
    • If test file missing → Create with test skeleton
    • If scenario not covered → Add test function
  2. Test function structure:

    • Parse Given → setup code
    • Parse When → action code
    • Parse Then → assertion
  3. Run cargo test to verify


Check Rules

Type Definition Checks

CheckAction if Failed
Struct in spec, missing in implAdd struct stub to impl
Struct field type mismatchASK: Which is correct?
Enum variant missingAdd variant to impl
Trait method missingAdd method stub to impl

Function Signature Checks

CheckAction if Failed
Function missing in implAdd function stub
Parameter count differsASK: Design decision
Return type differsASK: Design decision
Thread constraint undocumentedAdd doc comment

Module Structure Checks

CheckAction if Failed
Module file missingASK: Create or update spec?
File exists but not in specAdd to spec module diagram

Test Coverage Checks

CheckAction if Failed
No test for scenarioCreate test file and function
Test exists but incompleteAdd missing assertions

Output Format

## Sync Report: [spec_file] <-> [impl_files]

### Auto-fixed
- [FIXED] description (file:line)

### Needs Confirmation
- [QUESTION] description
  - Spec: X
  - Impl: Y

### Tests Created
- [TEST] tests/xxx_test.rs - N scenarios covered

### Summary
- Matched: N items
- Auto-fixed: N items
- User decisions: N items
- Tests created: N files

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です