Files
Tabish Bidiwale cac54042ce feat: add Agent Skills for experimental artifact workflow (#424)
* feat: add Agent Skills for experimental artifact workflow

Implements Task #3 from the experimental release plan:
- Create skill templates for openspec-new-change and openspec-continue-change
- Add artifact-experimental-setup CLI command
- Generate Agent Skills in .claude/skills/ directory
- Support cross-editor compatibility (Claude Code, Cursor, Windsurf)

Skills follow the Agent Skills specification and provide:
- Natural language invocation by AI assistants
- Step-by-step artifact creation workflow
- Dependency-driven change management

* fix: update GitHub issues URL to correct repository

Replace placeholder `https://github.com/your-org/openspec/issues`
with correct URL `https://github.com/Fission-AI/OpenSpec/issues` in:
- docs/experimental-release-plan.md
- src/commands/artifact-workflow.ts

Verified against package.json repository.url field.

* feat: add openspec-apply-change skill for task implementation

Add the apply skill to guide agents through implementing tasks from an
OpenSpec change:

- Add `openspec instructions apply` CLI command that parses tasks.md and
  returns context files, progress tracking, and dynamic instructions
- Add `getApplyChangeSkillTemplate()` to skill-templates.ts with full
  workflow guidance for implementing tasks
- Update artifact-experimental-setup to generate all three skills:
  openspec-new-change, openspec-continue-change, openspec-apply-change

The apply skill supports the fluid "actions on a change" model:
- Can be invoked anytime (if tasks.md exists)
- Handles blocked/ready/all_done states
- Guides agents to pause on issues and suggest artifact updates
- Tracks progress via task checkboxes

* docs: mark apply skill implementation steps as complete

* feat: add Capabilities section to proposal template

Enrich the proposal template to explicitly capture capability discovery:

- Add "Capabilities" section with "New Capabilities" and "Modified
  Capabilities" subsections to proposal template
- Update proposal instruction in schema.yaml to guide agents on
  researching existing specs and listing capabilities
- Update skill instructions with detailed guidance for the Capabilities
  section

This creates a clear contract between proposal and specs phases - each
capability listed in the proposal will need a corresponding spec file.

* feat: remove redundant `openspec next` command

The `next` command was redundant with `status` - both show which artifacts
are ready to create. The status command provides more context (done/ready/blocked)
and is the single source of truth for artifact state.

Changes:
- Remove nextCommand function and CLI registration from artifact-workflow.ts
- Update skill templates to use status instead of next
- Update docs and specs to reflect removal
- Add REMOVED Requirements section to cli-artifact-workflow spec
- Remove 7 tests for the next command

Migration: Use `openspec status --change <id> --json` and filter artifacts
with `status: "ready"` to find artifacts that can be created next.

* docs: clarify kebab-case naming in proposal template

Update HTML comments in the Capabilities section to explicitly instruct
using kebab-case identifiers with examples (user-auth, data-export,
api-rate-limiting).

* feat: add change proposals for per-change schema metadata

Add two related change proposals for enabling schema selection in the
experimental artifact workflow:

1. add-per-change-schema-metadata: Store schema choice in .openspec.yaml
   per change, enabling auto-detection in workflow commands. Includes
   Zod schema design and delta specs for cli-artifact-workflow.

2. add-agent-schema-selection: Follow-up to update agent skills to
   support dynamic schema selection (depends on metadata change).

Also includes:
- Example .openspec.yaml in add-frontmatter-to-openspec-artifact-files
- Clarify "Modified Capabilities" guidance in proposal template

* remove test change

* feat: fix design.md as optional, update docs, add schema-aware apply proposal

Changes:
- Fix generateApplyInstructions to treat design.md as optional (not required)
- Update experimental-release-plan.md CLI output to match implementation
- Add openspec-apply-change skill to docs (was missing)
- Fix test flow numbering after adding apply skill verification step
- Add change proposal for making apply instructions schema-aware

The schema-aware proposal introduces an `implementation` block in schema.yaml
to define when a change becomes implementable and how to track progress.
2026-01-05 16:42:17 -08:00

4.4 KiB

Why

The generateApplyInstructions function is hardcoded to check for spec-driven artifacts (proposal.md, specs/, design.md, tasks.md). If a user selects a different schema like tdd, the apply instructions are meaningless - they check for files that don't exist in that schema.

This blocks the experimental workflow from supporting multiple schemas properly.

What Changes

Scope: Experimental artifact workflow (openspec instructions apply)

Depends on: add-per-change-schema-metadata (to know which schema a change uses)

  • Make generateApplyInstructions read artifact definitions from the schema
  • Dynamically determine which artifacts exist based on schema
  • Define when a change becomes "implementable" (see Design Decision below)
  • Generate schema-appropriate context files and instructions

Design Decision: When is a change implementable?

This is the key question. Different approaches:

Option A: Explicit apply artifact in schema

Add a field to mark which artifact is the "implementation gate":

artifacts:
  - id: tasks
    generates: tasks.md
    apply: true  # ← This artifact triggers apply mode

Pros: Explicit, flexible Cons: Another field to maintain, what if multiple artifacts are apply: true?

Option B: Leaf artifacts are implementable

The artifact(s) with no dependents (nothing depends on them) are the apply target.

  • spec-driven: tasks is a leaf → apply = execute tasks
  • tdd: docs is a leaf → but that doesn't make sense for TDD...

Pros: No extra schema field, derived from graph Cons: Doesn't match TDD semantics (implementation is the action, not docs)

Option C: Schema-level apply_phase definition

Add a top-level field to the schema:

name: spec-driven
apply_phase:
  requires: [tasks]  # Must exist before apply
  tracks: tasks.md   # File with checkboxes to track
  instruction: "Work through tasks, mark complete as you go"
name: tdd
apply_phase:
  requires: [tests]  # Must have tests before implementing
  tracks: null       # No checkbox tracking - just make tests pass
  instruction: "Run tests, implement until green, refactor"

Pros: Full flexibility, schema controls its own apply semantics Cons: More complex schema format

Option D: Convention-based (artifact ID matching)

If artifact ID is tasks or implementation, it's the apply target.

Pros: Simple, no schema changes Cons: Brittle, doesn't work for custom schemas

Option E: All artifacts complete → apply available

Apply becomes available when ALL schema artifacts exist. Implementation is whatever the user does after planning.

Pros: Simple, no schema changes Cons: Doesn't guide what "apply" means for different workflows


Decision: Add apply block to schema.yaml

Add a top-level apply field to schema definitions:

name: spec-driven
version: 1
description: Default OpenSpec workflow

artifacts:
  # ... existing artifacts ...

apply:
  requires: [tasks]           # Artifacts that must exist before apply
  tracks: tasks.md            # File with checkboxes for progress (optional)
  instruction: |              # Guidance shown to agent
    Read context files, work through pending tasks, mark complete as you go.
    Pause if you hit blockers or need clarification.
name: tdd
version: 1
description: Test-driven development workflow

artifacts:
  # ... existing artifacts ...

apply:
  requires: [tests]           # Must have tests before implementing
  tracks: null                # No checkbox tracking
  instruction: |
    Run tests to see failures. Implement minimal code to pass each test.
    Refactor while keeping tests green.

Key properties:

  • requires: Array of artifact IDs that must exist before apply is available
  • tracks: Path to file with checkboxes (relative to change dir), or null if no tracking
  • instruction: Custom guidance for the apply phase

Fallback behavior: Schemas without apply block default to "all artifacts must exist"

Capabilities

Modified Capabilities

  • cli-artifact-workflow: Apply instructions become schema-aware

Impact

  • Affected code: src/commands/artifact-workflow.ts (generateApplyInstructions)
  • Schema format: May need new apply_phase field
  • Existing schemas: Need to add apply_phase to spec-driven and tdd
  • Backward compatible: Schemas without apply_phase can use default behavior