AgentSkillsCN

spec-methodology

采用渐进式方法(意图、范围、行为、细化)编写并改进规范。适用于创建新规范、优化现有规范,或应对不确定性与内容拆分时使用。

SKILL.md
--- frontmatter
name: spec-methodology
description: Write and improve specifications using progressive approach (Intent, Scope, Behavior, Refinement). Use when creating new specs, improving existing ones, or handling uncertainty and content splitting.

Specification Methodology

Operational methods for creating, reviewing, and maintaining specifications.

Applicability Rubric

ConditionPassFail
Writing new specCreating spec from scratchSpec already written
Improving existing specGaps identified in current specSpec passes all quality checks
Reviewing specAssessing spec for implementation readinessNo review needed
Splitting contentSpec growing beyond manageable sizeSpec is concise and focused

Apply when: Any condition passes

Core Principles

Progressive Approach

Apply to both writing new specifications and improving existing ones. When improving, identify current phase and proceed from there.

PhaseFocusOutputConfirm
1. IntentWhy and for whomPurpose, Users, ImpactsPurpose + Users stated
2. ScopeWhat's includedFeature list, User journeys (Context → Action → Outcome)List complete
3. BehaviorHow it worksFeature behaviors, Error scenariosBehaviors + Errors defined, implementable
4. RefinementQualityPatterns, Contracts, TerminologyContracts, Terms, Patterns as needed

Rules:

  • Do not write Phase 3 details until Phase 2 is confirmed
  • Phase 2 defines user-facing flows; Phase 3 defines feature behaviors and error scenarios
  • Return to earlier phases when new understanding emerges
  • Specification reaches Minimal quality level after Phase 3 (all Required Y)

Phase Transition Guide

TransitionAdvance WhenStay/Return When
Intent → ScopePurpose and Users stated; stakeholders agree on bothPurpose unclear; users not validated
Scope → BehaviorFeature list confirmed; user journeys cover all impactsNew features discovered; flows incomplete
Behavior → RefinementBehaviors and Errors defined, implementable; all features coveredUndefined scenarios found; implementer has questions
Refinement → DoneTarget quality level met; Balance Check passesConsistency gaps; terminology conflicts

When Reviewing

Assess against three layers:

  1. Intent: Can I explain why this system exists and for whom?
  2. Design: Can I predict behavior for any user action?
  3. Consistency: Will similar situations be handled similarly?

Key questions:

  • Is this complete enough to implement without guessing?
  • Are all design decisions explicit?
  • Will two implementers produce compatible results?

Flag: missing layers, vague language, implementation details that should be open, design decisions that should be specified.

Splitting Content

Default: Keep everything in SPEC.md.

Use this decision table to determine when to extract content:

DecidesExpandsExternal→ Action
Y--Keep in SPEC.md
NN-Keep in SPEC.md
NYNMay extract (summary + link)
NYYExtract (link only)

Conditions:

  • Decides: Cannot understand what to build without reading this
  • Expands: Complete definition of a decision (all fields, all cases)
  • External: Maintained by different role/tool

Examples:

ContentDecidesExpandsExternal→ Action
Feature behaviorY--Keep
Decision tableY--Keep
Error handling rulesY--Keep
API endpoints (3-5)NN-Keep
Full DB schema (50+ fields)NYNMay extract
Complete test casesNYNMay extract
Figma designNYYExtract

When extracting:

  • SPEC.md keeps the decision/summary
  • Link: See [Schema](docs/schema.md) for field definitions
  • Detail documents follow same principles
TypeLocation
Data structuresdocs/schema.md
Visual designdocs/design.md or external
Test casesdocs/tests.md

When updating specifications:

  • First determine: decision or detail?
  • Decisions go in SPEC.md, details may go in referenced documents
  • If adding to external document, verify SPEC.md has the governing decision

Writing tip: Use tables (like this decision table) to define boundaries and rules. Tables make conditions explicit and reduce ambiguity.

Handling Uncertainty

Undecided design choices

Do not leave gaps. Instead:

  1. Present options with tradeoffs
  2. Request a decision
  3. Document the choice

Incomplete information

Mark explicitly what is decided vs pending:

code
## Technical Stack

Decided:
- Runtime: Node.js >= 20

To be decided:
- Database: PostgreSQL or SQLite
  (depends on deployment target)

Resolve all "To be decided" items within the target scope before implementation readiness—an implementer should be able to build without clarifying questions. Items outside the current scope may remain deferred with explicit owners.

Conflicting requirements

Surface the conflict explicitly and request resolution rather than making assumptions.

Completion Rubric

Before Applying Methodology

CriterionPassFail
Starting phase identifiedKnow which phase to begin fromPhase not determined
Existing content assessedEvaluated current spec against rubricNo assessment of current state
Target quality level knownMinimal/Usable/Complete selectedNo target level

During Application

CriterionPassFail
Phase disciplineCompleting current phase before advancingSkipping phases
Gate confirmationPhase transition criteria checkedAdvancing without verification
Uncertainty surfacedUndecided items explicitly markedGaps left silently
Content placement correctDecisions in SPEC.md, details in referenced docsContent misplaced

After Application

CriterionPassFail
All phases completedReached target phase with gates passedPhases incomplete
Quality rubric passedTarget quality level criteria metQuality level not reached
Pending items resolved or deferred"To be decided" items within target scope resolved; out-of-scope items explicitly deferredUndecided items within scope remain