Skip to content

Commit b5b7248

Browse files
authored
feat(skills): implement /opsx:verify skill for validating change implementations (Fission-AI#501)
Add comprehensive verification skill that checks implementation completeness, correctness, and coherence against change artifacts. The skill validates task completion, spec coverage, requirement implementation, and design adherence.
1 parent 322bfd4 commit b5b7248

5 files changed

Lines changed: 463 additions & 30 deletions

File tree

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Design: Add /opsx:verify Skill
2+
3+
## Architecture Decision: Dynamic Generation via Setup Command
4+
5+
### Context
6+
7+
All existing opsx experimental skills (explore, new, continue, apply, ff, sync, archive) are dynamically generated when users run `openspec artifact-experimental-setup`. They are not manually created files checked into the repository.
8+
9+
### Decision
10+
11+
**Integrate verify into the existing artifact-experimental-setup system rather than creating static skill files.**
12+
13+
### Rationale
14+
15+
1. **Consistency**: All 7 existing opsx skills follow this pattern. Adding verify as the 8th skill should follow the same architecture.
16+
17+
2. **Maintainability**: Template functions in `skill-templates.ts` are the single source of truth. Changes to skill definitions automatically propagate to all users when they re-run setup.
18+
19+
3. **Distribution**: Users get the verify skill automatically when running `openspec artifact-experimental-setup`, just like all other opsx skills. No special installation steps needed.
20+
21+
4. **Versioning**: Skills are generated from the installed npm package version, ensuring consistency between CLI version and skill behavior.
22+
23+
### Implementation Approach
24+
25+
#### 1. Template Functions
26+
27+
Add two template functions to `src/core/templates/skill-templates.ts`:
28+
29+
```typescript
30+
export function getVerifyChangeSkillTemplate(): SkillTemplate
31+
export function getOpsxVerifyCommandTemplate(): CommandTemplate
32+
```
33+
34+
These return the skill definition (for Agent Skills) and slash command definition (for explicit invocation).
35+
36+
#### 2. Setup Integration
37+
38+
Update `artifactExperimentalSetupCommand()` in `src/commands/artifact-workflow.ts`:
39+
40+
- Import both template functions
41+
- Add verify to the `skills` array (position 8)
42+
- Add verify to the `commands` array (position 8)
43+
- Update help text to list `/opsx:verify`
44+
45+
#### 3. Generated Artifacts
46+
47+
When users run `openspec artifact-experimental-setup`, the command creates:
48+
49+
- `.claude/skills/openspec-verify-change/SKILL.md` - Agent Skills format
50+
- `.claude/commands/opsx/verify.md` - Slash command format
51+
52+
Both are generated from the template functions, with YAML frontmatter automatically added.
53+
54+
### Alternatives Considered
55+
56+
**Alternative 1: Static skill files in repository**
57+
58+
Create `.claude/skills/openspec-verify-change/SKILL.md` as a static file in the OpenSpec repository.
59+
60+
**Rejected because:**
61+
- Inconsistent with all other opsx skills
62+
- Requires users to manually copy/update files
63+
- Versioning becomes complicated (repo version vs installed package version)
64+
- Breaks the established pattern
65+
66+
**Alternative 2: Separate verify setup command**
67+
68+
Add `openspec setup-verify` as a separate command.
69+
70+
**Rejected because:**
71+
- Fragments the setup experience
72+
- Users would need to run multiple commands
73+
- Doesn't scale if we add more skills in the future
74+
- Goes against the "setup once, get everything" philosophy
75+
76+
### Trade-offs
77+
78+
**Advantages:**
79+
- Consistent with existing architecture
80+
- Zero additional setup burden for users
81+
- Easy to update and maintain
82+
- Automatic version compatibility
83+
84+
**Disadvantages:**
85+
- Slightly more complex initial implementation (template functions + integration)
86+
- Requires understanding the setup system (but that's already documented)
87+
88+
### Verification
89+
90+
The implementation correctly follows this design if:
91+
92+
1. Both template functions exist in `skill-templates.ts`
93+
2. Verify appears in both skills and commands arrays in `artifact-workflow.ts`
94+
3. Help text mentions `/opsx:verify`
95+
4. Running `openspec artifact-experimental-setup` generates both skill and command files
96+
5. Build succeeds with no TypeScript errors

openspec/changes/add-verify-skill/proposal.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ A user requested: "Can we get a :verify that will ensure that the implementation
1212

1313
## What Changes
1414

15-
- Add new `/opsx:verify` slash command skill
15+
- Add `getVerifyChangeSkillTemplate()` function to `skill-templates.ts`
16+
- Add `getOpsxVerifyCommandTemplate()` function to `skill-templates.ts`
17+
- Integrate verify skill into `artifactExperimentalSetupCommand` in `artifact-workflow.ts`
18+
- Add verify to the skills and commands arrays in the setup command
19+
- Update help text to include `/opsx:verify` in the list of available commands
1620
- Create `opsx-verify-skill` capability spec
17-
- Create `SKILL.md` file at `.claude/skills/openspec-verify-change/`
1821

1922
## Verification Dimensions
2023

@@ -36,5 +39,10 @@ Produces a prioritized report with:
3639
## Impact
3740

3841
- Affected specs: New `opsx-verify-skill` spec
39-
- Affected code: New skill file at `.claude/skills/openspec-verify-change/SKILL.md`
42+
- Affected code:
43+
- `src/core/templates/skill-templates.ts` - Added 2 new template functions
44+
- `src/commands/artifact-workflow.ts` - Integrated verify into experimental setup
45+
- Generated artifacts: When users run `openspec artifact-experimental-setup`:
46+
- Creates `.claude/skills/openspec-verify-change/SKILL.md`
47+
- Creates `.claude/commands/opsx/verify.md`
4048
- Related skills: Works alongside `/opsx:apply` and before `/opsx:archive`
Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
11
# Tasks: Add /opsx:verify Skill
22

3-
## 1. Skill Implementation
4-
- [ ] 1.1 Create `.claude/skills/openspec-verify-change/SKILL.md` with skill definition
5-
6-
## 2. Completeness Verification Logic
7-
- [ ] 2.1 Implement task completion parsing (read tasks.md, count checkboxes)
8-
- [ ] 2.2 Implement spec coverage detection (extract requirements, search codebase)
9-
10-
## 3. Correctness Verification Logic
11-
- [ ] 3.1 Implement requirement-to-code mapping logic
12-
- [ ] 3.2 Implement scenario coverage assessment
13-
- [ ] 3.3 Implement divergence detection heuristics
14-
15-
## 4. Coherence Verification Logic
16-
- [ ] 4.1 Implement design.md decision extraction
17-
- [ ] 4.2 Implement design adherence checking
18-
- [ ] 4.3 Implement project pattern consistency checking
19-
20-
## 5. Report Generation
21-
- [ ] 5.1 Implement summary scorecard generation
22-
- [ ] 5.2 Implement issue prioritization (CRITICAL/WARNING/SUGGESTION)
23-
- [ ] 5.3 Implement actionable recommendation generation
24-
25-
## 6. Integration
26-
- [ ] 6.1 Add opsx:verify alias registration
27-
- [ ] 6.2 Test skill invocation end-to-end
28-
- [ ] 6.3 Update documentation/help text if applicable
3+
## 1. Skill Template Functions
4+
- [x] 1.1 Add `getVerifyChangeSkillTemplate()` to skill-templates.ts
5+
- [x] 1.2 Add `getOpsxVerifyCommandTemplate()` to skill-templates.ts
6+
7+
## 2. Integration with artifact-experimental-setup
8+
- [x] 2.1 Import verify template functions in artifact-workflow.ts
9+
- [x] 2.2 Add verify to skills array in artifactExperimentalSetupCommand
10+
- [x] 2.3 Add verify to commands array in artifactExperimentalSetupCommand
11+
- [x] 2.4 Add verify to help text output
12+
13+
## 3. Verification (Build & Test)
14+
- [x] 3.1 Verify TypeScript compilation succeeds
15+
- [x] 3.2 Verify all 8 skills are now included (was 7, now 8)

src/commands/artifact-workflow.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
type SchemaInfo,
2929
} from '../core/artifact-graph/index.js';
3030
import { createChange, validateChangeName } from '../utils/change-utils.js';
31-
import { getExploreSkillTemplate, getNewChangeSkillTemplate, getContinueChangeSkillTemplate, getApplyChangeSkillTemplate, getFfChangeSkillTemplate, getSyncSpecsSkillTemplate, getArchiveChangeSkillTemplate, getOpsxExploreCommandTemplate, getOpsxNewCommandTemplate, getOpsxContinueCommandTemplate, getOpsxApplyCommandTemplate, getOpsxFfCommandTemplate, getOpsxSyncCommandTemplate, getOpsxArchiveCommandTemplate } from '../core/templates/skill-templates.js';
31+
import { getExploreSkillTemplate, getNewChangeSkillTemplate, getContinueChangeSkillTemplate, getApplyChangeSkillTemplate, getFfChangeSkillTemplate, getSyncSpecsSkillTemplate, getArchiveChangeSkillTemplate, getVerifyChangeSkillTemplate, getOpsxExploreCommandTemplate, getOpsxNewCommandTemplate, getOpsxContinueCommandTemplate, getOpsxApplyCommandTemplate, getOpsxFfCommandTemplate, getOpsxSyncCommandTemplate, getOpsxArchiveCommandTemplate, getOpsxVerifyCommandTemplate } from '../core/templates/skill-templates.js';
3232
import { FileSystemUtils } from '../utils/file-system.js';
3333

3434
// -----------------------------------------------------------------------------
@@ -800,6 +800,7 @@ async function artifactExperimentalSetupCommand(): Promise<void> {
800800
const ffChangeSkill = getFfChangeSkillTemplate();
801801
const syncSpecsSkill = getSyncSpecsSkillTemplate();
802802
const archiveChangeSkill = getArchiveChangeSkillTemplate();
803+
const verifyChangeSkill = getVerifyChangeSkillTemplate();
803804

804805
// Get command templates
805806
const exploreCommand = getOpsxExploreCommandTemplate();
@@ -809,6 +810,7 @@ async function artifactExperimentalSetupCommand(): Promise<void> {
809810
const ffCommand = getOpsxFfCommandTemplate();
810811
const syncCommand = getOpsxSyncCommandTemplate();
811812
const archiveCommand = getOpsxArchiveCommandTemplate();
813+
const verifyCommand = getOpsxVerifyCommandTemplate();
812814

813815
// Create skill directories and SKILL.md files
814816
const skills = [
@@ -819,6 +821,7 @@ async function artifactExperimentalSetupCommand(): Promise<void> {
819821
{ template: ffChangeSkill, dirName: 'openspec-ff-change' },
820822
{ template: syncSpecsSkill, dirName: 'openspec-sync-specs' },
821823
{ template: archiveChangeSkill, dirName: 'openspec-archive-change' },
824+
{ template: verifyChangeSkill, dirName: 'openspec-verify-change' },
822825
];
823826

824827
const createdSkillFiles: string[] = [];
@@ -850,6 +853,7 @@ ${template.instructions}
850853
{ template: ffCommand, fileName: 'ff.md' },
851854
{ template: syncCommand, fileName: 'sync.md' },
852855
{ template: archiveCommand, fileName: 'archive.md' },
856+
{ template: verifyCommand, fileName: 'verify.md' },
853857
];
854858

855859
const createdCommandFiles: string[] = [];
@@ -908,6 +912,7 @@ ${template.content}
908912
console.log(' • /opsx:apply - Implement tasks');
909913
console.log(' • /opsx:ff - Fast-forward: create all artifacts at once');
910914
console.log(' • /opsx:sync - Sync delta specs to main specs');
915+
console.log(' • /opsx:verify - Verify implementation matches artifacts');
911916
console.log(' • /opsx:archive - Archive a completed change');
912917
console.log();
913918
console.log(chalk.yellow('💡 This is an experimental feature.'));

0 commit comments

Comments
 (0)