بنقرة واحدة
linear-implement-feature
Implement approved OpenSpec proposal through to PR creation
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Implement approved OpenSpec proposal through to PR creation
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Execute roadmap items iteratively with policy-aware vendor routing and learning feedback
Orchestrate the full plan-review-implement-validate-PR lifecycle with multi-vendor review convergence
OpenBao/Vault credential seeding and management scripts
Comprehensive project health diagnostic — collects signals from CI tools, existing reports, deferred issues, and code markers into a prioritized finding report
Generate changelog entries and suggest semantic version bumps from git history
HTTP fallback bridge for coordinator when MCP transport is unavailable
| name | linear-implement-feature |
| description | Implement approved OpenSpec proposal through to PR creation |
| category | Git Workflow |
| tags | ["openspec","implementation","pr","linear"] |
| triggers | ["implement feature","build feature","start implementation","begin implementation","code feature","linear implement feature"] |
Implement an approved OpenSpec proposal. Ends when PR is created and awaiting review.
$ARGUMENTS - OpenSpec change-id (required)
openspec/changes/<change-id>//plan-feature first if no proposal existsUse OpenSpec-generated runtime assets first, then CLI fallback:
.claude/commands/opsx/*.md or .claude/skills/openspec-*/SKILL.md.codex/skills/openspec-*/SKILL.md.gemini/commands/opsx/*.toml or .gemini/skills/openspec-*/SKILL.mdopenspec CLI commandsUse docs/coordination-detection-template.md as the shared detection preamble.
CAN_* flag is trueAt skill start, run the coordination detection preamble and set:
COORDINATOR_AVAILABLECOORDINATION_TRANSPORT (mcp|http|none)CAN_LOCK, CAN_QUEUE_WORK, CAN_HANDOFF, CAN_MEMORY, CAN_GUARDRAILSIf CAN_HANDOFF=true, read recent handoff context before implementation:
read_handoff"<skill-base-dir>/../coordination-bridge/scripts/coordination_bridge.py" try_handoff_read(...)On handoff failure/unavailability, continue with standalone implementation and log informationally.
# Verify the proposal
openspec show <change-id>
# Check tasks
cat openspec/changes/<change-id>/tasks.md
Confirm the proposal is approved before proceeding.
Create an isolated worktree for this feature to avoid conflicts with other CLI sessions:
# Pass --agent-id if AGENT_ID env var is set
AGENT_FLAG=""
if [[ -n "${AGENT_ID:-}" ]]; then
AGENT_FLAG="--agent-id ${AGENT_ID}"
fi
# Setup worktree for feature isolation (creates .git-worktrees/<change-id>/)
eval "$(python3 "<skill-base-dir>/../worktree/scripts/worktree.py" setup "<change-id>" ${AGENT_FLAG})"
cd "$WORKTREE_PATH"
echo "Working directory: $(pwd)"
After this step, you are working in an isolated directory at .git-worktrees/<change-id>/. Other terminal sessions can work on different features without conflict.
# Should already be on feature branch from worktree setup
git branch --show-current # Should show openspec/<change-id>
# If not (e.g., resumed session), checkout the branch
git checkout openspec/<change-id>
Before implementing any tasks, create the traceability skeleton and write failing tests:
Read spec delta files from openspec/changes/<change-id>/specs/. For each SHALL/MUST clause, create a row in the Requirement Traceability Matrix:
<capability>.<N> — sequential number per capabilityspecs/session-continuity/spec.md)test_worktree_isolation from scenario "Worktree provides isolation")--- (not yet implemented)--- (not yet validated)Design Decision Trace: If design.md exists, populate with each decision. Rationale column filled from design.md, Implementation column = ---.
Review Findings Summary: Omit for linear workflow.
Coverage Summary: Set preliminary counts — requirements traced = N, tests mapped = N, evidence = 0/N.
Write failing tests (RED): For each row in the matrix, create the test function listed in the Test(s) column. Tests should encode the spec scenario's WHEN/THEN/AND clauses as assertions. Tests MUST fail at this point (no implementation yet).
@pytest.mark.integration or @pytest.mark.e2e markers as test stubs.Use template from openspec/schemas/feature-workflow/templates/change-context.md. Write the file to openspec/changes/<change-id>/change-context.md.
Tests from step 3a define expected behavior. Implement code to make them pass.
Preferred path:
opsx:apply equivalent for the active agent) to execute tasks.CLI fallback path:
openspec instructions apply --change "<change-id>" --json
openspec status --change "<change-id>"
Execution expectations:
tasks.md (- [ ] -> - [x])After task completion, update change-context.md:
git diff --name-only main..HEAD cross-referenced with task file scopes)Capability-gated coordinator hooks:
CAN_GUARDRAILS=true): before running high-risk operations, run a guardrail pre-check and report violations informationally (phase 1 does not hard-block)CAN_LOCK=true): acquire locks before editing files and keep a local list of acquired locks for cleanupCAN_QUEUE_WORK=true): for independent tasks, optionally submit/claim/complete via coordinator queue APIs; if unavailable or unclaimed, fall back to local Task() executionHeartbeat: During long-running implementation, periodically call python3 "<skill-base-dir>/../worktree/scripts/worktree.py" heartbeat "<change-id>" ${AGENT_FLAG} to signal liveness to the worktree registry. This prevents stale-agent garbage collection from reclaiming the worktree.
When tasks.md contains multiple independent tasks (no shared files), implement them concurrently:
# Spawn parallel agents (single message, multiple Task calls)
Task(
subagent_type="general-purpose",
description="Implement task 1: <brief>",
prompt="You are implementing OpenSpec <change-id>, Task 1.
## Your Task
<TASK_DESCRIPTION from tasks.md>
## File Scope (CRITICAL)
You MAY modify: <list specific files>
You must NOT modify any other files.
## Context
- Read openspec/changes/<change-id>/proposal.md for full context
- Read openspec/changes/<change-id>/design.md for architectural decisions
## Process
1. Read the proposal and design docs
2. Write failing tests first (TDD)
3. Implement minimal code to pass tests
4. Run tests to verify
5. Report completion with summary of changes
Do NOT commit - the orchestrator will handle commits.",
run_in_background=true
)
Rules for parallel implementation:
Task(resume=<agent_id>) to retryLocking behavior details (CAN_LOCK=true):
When to parallelize:
When NOT to parallelize:
Use TodoWrite to track implementation:
openspec show <change-id> for context when needed# Check all tasks are marked done
grep -E "^\s*- \[ \]" openspec/changes/<change-id>/tasks.md
# Should return nothing (all boxes checked)
Run all quality checks concurrently using Task() with run_in_background=true:
# Launch all checks in parallel (single message, multiple Task calls)
Task(subagent_type="Bash", prompt="Run pytest and report pass/fail with summary", run_in_background=true)
Task(subagent_type="Bash", prompt="Run mypy src/ and report any type errors", run_in_background=true)
Task(subagent_type="Bash", prompt="Run ruff check . and report any linting issues", run_in_background=true)
Task(subagent_type="Bash", prompt="Run openspec validate <change-id> --strict", run_in_background=true)
Task(subagent_type="Bash", prompt="Run 'python3 \"<skill-base-dir>/../validate-flows/scripts/validate_flows.py\" --diff main...HEAD' from the project root and report any architecture diagnostics (broken flows, missing tests, orphaned code). If the script is not available or docs/architecture-analysis/architecture.graph.json doesn't exist, report that architecture validation was skipped.", run_in_background=true)
Result Aggregation:
Example output format:
Quality Check Results:
✓ pytest: 42 tests passed
✗ mypy: 3 type errors in src/auth.py
✓ ruff: No issues
✓ openspec validate: Valid
✓ architecture: No broken flows (2 warnings: orphaned functions)
Fix all failures before proceeding. Address issues in order of severity (type errors before style).
Document any lessons learned during implementation, such as repeatable patterns, gotchas in the code that are noteworthy, and any changes in design that came up during the implementation and test phases in documents in the CLAUDE.md and AGENTS.md files.
If the CLAUDE.md and AGENTS.md files are getting beyond 300 lines each, then refactor the documentation into documents focused on certain aspects of the project or the development process in the docs/ folder such as DEVELOPMENT.md for development guidelines, SETUP.md for set up instructions, UX_DESIGN.md for front end design considerations, etc. and reference them in CLAUDE.md and AGENTS.md
# Review changes
git status
git diff
# Stage all changes
git add .
# Commit with OpenSpec reference
git commit -m "$(cat <<'EOF'
feat(<scope>): <description>
Implements OpenSpec: <change-id>
- <key change 1>
- <key change 2>
- <key change 3>
Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
# Push branch
git push -u origin openspec/<change-id>
# Create PR
gh pr create --title "feat(<scope>): <title from proposal>" --body "$(cat <<'EOF'
## Summary
Implements OpenSpec proposal: `<change-id>`
**Proposal**: `openspec/changes/<change-id>/proposal.md`
**Change Context**: `openspec/changes/<change-id>/change-context.md`
### Changes
- <bullet points summarizing changes>
## Test Plan
- [ ] All tests pass (`pytest`)
- [ ] Type checks pass (`mypy src/`)
- [ ] Linting passes (`ruff check .`)
- [ ] OpenSpec validates (`openspec validate <change-id> --strict`)
- [ ] All tasks complete in `tasks.md`
## OpenSpec Tasks
<paste tasks.md checklist>
---
🤖 Generated with Claude Code
EOF
)"
If CAN_HANDOFF=true, write a completion handoff after PR creation containing:
/iterate-on-implementation, /validate-feature, or /cleanup-feature)STOP HERE - Wait for PR approval before proceeding to cleanup.
openspec/<change-id>After PR is approved:
/cleanup-feature <change-id>