Skip to content

Commit 95b5b46

Browse files
committed
refactor: fix structure and logic issues in SDD CLI guidance
Fixed 3 critical issues: 1. ✅ Unified heading hierarchy - STEP 2 subsections now all use #### (level 4) - Before: Mixed ### and bold text (inconsistent) - After: Consistent #### hierarchy 2. ✅ Removed contradictory content - Deleted 'Command Purpose Guidelines (NOT fixed names)' table - This contradicted 'Prioritize Industry Best Practices' - The table was also redundant with examples above 3. ✅ Removed duplicate content - Command count table appeared twice (removed 1st occurrence) - Unified commands mentioned twice (kept detailed version) Structure after optimization: STEP 2: CLI Command Naming Principles #### Golden Reference: spec-kit #### Core Naming Principles #### Real Project Examples #### Unified vs Specialized Commands Net result: -43 lines, clearer logic, no contradictions File changed: - src/metaspec/templates/meta/sdd/commands/specify.md.j2
1 parent efd2548 commit 95b5b46

File tree

1 file changed

+127
-41
lines changed

1 file changed

+127
-41
lines changed

src/metaspec/templates/meta/sdd/commands/specify.md.j2

Lines changed: 127 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -400,72 +400,158 @@ Select primary toolkit type(s):
400400

401401
---
402402

403-
**STEP 2: Derive CLI Commands from Toolkit Purpose**
403+
**STEP 2: CLI Command Naming Principles**
404404

405-
**CRITICAL**: ❌ **DON'T use fixed command names** (init, validate, list)
406-
✅ **DO derive commands based on toolkit function and domain**
405+
#### 🏆 Golden Reference: GitHub spec-kit
407406

408-
**Why This Matters**:
409-
- CLI commands serve toolkit-specific purposes
410-
- Names should reflect what the toolkit actually does
411-
- Real projects show diverse command naming
407+
**Before designing commands, study the gold standard**: [GitHub spec-kit](https://github.com/github/spec-kit)
408+
409+
**Why spec-kit is the reference**:
410+
- ✅ Only 2 commands: `init`, `check`
411+
- ✅ Minimalist but feature-complete
412+
- ✅ Excellent user experience
413+
- ✅ Widely adopted in production
414+
415+
**Key lessons**:
416+
1. `init` provides complete project initialization
417+
2. `check` unifies ALL validation functions (not split into validate/verify/lint)
418+
3. Extend via parameters, don't create new commands
419+
4. Command names are natural and intuitive
420+
421+
**Design principle**: Unless you have a compelling reason, follow spec-kit's minimalist design
412422

413423
---
414424

415-
**CLI Command Derivation Process**:
425+
#### Core Naming Principles
426+
427+
**1. Prioritize Industry Best Practices**
416428

417-
1. **Identify Toolkit Functions**
418-
- What does this toolkit DO?
419-
- Generator: Creates projects/files
420-
- Validator: Checks compliance
421-
- Query: Displays information
422-
- Manager: Tracks/updates state
429+
Some command names are **industry standards**, not "fixed names to avoid":
423430

424-
2. **Match Functions to Command Purposes**
425-
- Don't copy "init, validate, list"
426-
- Think: What actions do users need?
431+
| Standard Command | Use For | Examples |
432+
|-----------------|---------|----------|
433+
| `init` | Project generation | spec-kit, MetaSpec, Specify |
434+
| `check`/`validate` | Validation/verification | spec-kit, OpenSpec |
435+
| `list`/`show` | Query/display | OpenSpec, MetaSpec |
436+
| `search`/`install` | Community platform | MetaSpec, npm, pip |
427437

428-
3. **Choose Domain-Appropriate Names**
429-
- Match domain terminology
430-
- Keep commands intuitive
438+
**✅ DO**: Use standard names when they fit
439+
**❌ DON'T**: Create unnecessary variations (`examine`, `inspect`, `verify`) just to be "different"
440+
441+
**2. Prefer Unified Commands (spec-kit approach)**
442+
443+
❌ **Don't**: `validate-req`, `validate-design`, `validate-project` (3 commands)
444+
✅ **Do**: `check <target> [--type TYPE]` (1 unified command)
445+
446+
💡 **See detailed guidelines** in "Unified vs Specialized Commands" section below
431447

432448
---
433449

434-
**Real Project CLI Commands** (learn from these):
450+
#### Real Project Examples
435451

436452
| Project | Toolkit Type | Actual Commands | Insight |
437453
|---------|-------------|-----------------|---------|
438-
| **Specify** | Generator<br>+ Checker | `init` - Create project<br>`check` - Verify tools | Simple, focused |
454+
| **🏆 spec-kit** (GitHub) | Workflow Tool | `init` - Initialize project<br>`check` - Unified validation | **Gold standard**: 2 commands, minimalist design |
455+
| **Specify** | Generator<br>+ Checker | `init` - Create project<br>`check` - Verify tools | Follows spec-kit pattern |
439456
| **OpenSpec** | Validator<br>+ Query<br>+ Manager | `validate` - Check proposal<br>`list` - Show proposals<br>`show` - Display details<br>`update` - Sync state | State-management oriented |
440-
| **MetaSpec** | Generator<br>+ Community | `init` - Generate speckit<br>`search` - Find packages<br>`install` - Get from community<br>`contribute` - Share speckit | Community platform |
441-
| **Spec-Kit** | Workflow Tool | No CLI (shell scripts only)<br>`specify.sh`, `plan.sh` | Script-based approach |
457+
| **MetaSpec** | Generator<br>+ Community | `init` - Generate speckit<br>`search` - Find packages<br>`install` - Get from community<br>`contribute` - Share speckit<br>`list`, `info`, `version` | Community platform (7 commands justified) |
442458

443-
**Key Insight**: Commands reflect toolkit purpose, not generic patterns
459+
**Key Insight**: spec-kit shows that 2 well-designed commands can be complete
444460

445461
---
446462

447-
**Command Purpose Guidelines** (NOT fixed names):
463+
#### Unified vs Specialized Commands
464+
465+
**Critical design decision**: When to combine functions into one command vs splitting into multiple commands
466+
467+
**When to UNIFY into one command** ✅:
468+
469+
**1. Similar functions, different objects**
470+
```bash
471+
# ❌ Over-specialized (3 commands)
472+
validate-requirements
473+
validate-design
474+
validate-project
475+
476+
# ✅ Unified (1 command)
477+
check <target> [--type TYPE]
478+
```
479+
480+
**2. Sequential workflow, users run together**
481+
```bash
482+
# ❌ Split (2 commands)
483+
validate
484+
check-transition
485+
486+
# ✅ Unified (1 command)
487+
check [--phase PHASE]
488+
```
489+
490+
**3. Same underlying logic**
491+
```bash
492+
# ❌ Separated (multiple commands)
493+
list-servers
494+
list-tools
495+
list-resources
496+
497+
# ✅ Unified (1 command)
498+
list <entity-type>
499+
```
500+
501+
**When to SPLIT into separate commands** ✅:
502+
503+
**1. Completely different functions**
504+
```bash
505+
# ✅ Keep separate
506+
init # Creates project
507+
check # Validates project
508+
# These are fundamentally different operations
509+
```
510+
511+
**2. Different user contexts**
512+
```bash
513+
# ✅ Keep separate
514+
search # Browse community (discovery)
515+
install # Get package (action)
516+
# Users have different mindsets for these
517+
```
518+
519+
**3. Different permission levels**
520+
```bash
521+
# ✅ Keep separate
522+
validate # Read-only
523+
publish # Requires credentials
524+
```
448525

449-
| Toolkit Function | Command Purpose | Naming Examples | When to Include |
450-
|-----------------|----------------|-----------------|-----------------|
451-
| **Project Generation** | Create/initialize | `init`, `create`, `new`, `scaffold` | If toolkit creates projects |
452-
| **Environment Setup** | Check prerequisites | `check`, `verify`, `doctor`, `setup` | If toolkit needs environment |
453-
| **Protocol Validation** | Validate compliance | `validate`, `check`, `lint`, `verify` | If protocol has rules |
454-
| **Information Query** | Display data | `list`, `show`, `info`, `get`, `display` | If toolkit manages content |
455-
| **State Management** | Update/sync | `update`, `sync`, `refresh`, `pull` | If toolkit tracks state |
456-
| **Community Integration** | Package operations | `search`, `install`, `publish`, `contribute` | If ecosystem exists |
526+
**Real-world example: spec-kit's `check` command**
457527

458-
**Customization Based on Domain**:
528+
spec-kit unifies ALL validation into one command:
459529
```bash
460-
# Generic toolkit → Generic commands
461-
toolkit validate spec.yaml
530+
check requirements
531+
check design
532+
check project
533+
check transition
534+
# All use the same underlying validation logic
535+
```
462536

463-
# Domain-specific → Domain commands
464-
speckit validate spec.yaml
465-
api-toolkit lint openapi.yaml
537+
This is better than:
538+
```bash
539+
# ❌ Over-engineered
540+
validate-requirements
541+
validate-design
542+
validate-project
543+
check-transition
466544
```
467545

468-
**Result**: Derive 3-6 CLI commands based on toolkit functions (Validator, Query Tool, Generator)
546+
**Command Count Guidance**:
547+
548+
| Toolkit Type | Recommended Count | Rationale |
549+
|-------------|------------------|-----------|
550+
| **Workflow Tool** | 1-2 commands | spec-kit model: `init` + unified `check` |
551+
| **Validator + Query** | 2-3 commands | Add `list`/`show` if needed |
552+
| **Community Platform** | 5-7 commands | Social features need dedicated commands |
553+
554+
⚠️ **Warning**: If you have >7 commands, reconsider if some can be unified
469555

470556
---
471557

0 commit comments

Comments
 (0)