원클릭으로
linear-iterate-on-implementation
Iteratively refine a feature implementation by identifying and fixing bugs, edge cases, and improvements
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Iteratively refine a feature implementation by identifying and fixing bugs, edge cases, and improvements
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-iterate-on-implementation |
| description | Iteratively refine a feature implementation by identifying and fixing bugs, edge cases, and improvements |
| category | Git Workflow |
| tags | ["openspec","refinement","iteration","quality","linear"] |
| triggers | ["iterate on implementation","refine implementation","improve implementation","improve and iterate","linear iterate on implementation"] |
Iteratively refine a feature implementation after /implement-feature completes. Each iteration reviews the code, identifies improvements, implements fixes, and commits — repeating until only low-criticality findings remain or max iterations are reached.
$ARGUMENTS - OpenSpec change-id (required), optionally followed by --max <N> (default: 5) and --threshold <level> (default: "medium"; values: "critical", "high", "medium", "low")
openspec/<change-id> exists with implementation commitsopenspec/changes/<change-id>//implement-feature first if no implementation 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:
read_handoff"<skill-base-dir>/../coordination-bridge/scripts/coordination_bridge.py" try_handoff_read(...)If CAN_MEMORY=true, recall relevant implementation-iteration memories:
recall"<skill-base-dir>/../coordination-bridge/scripts/coordination_bridge.py" try_recall(...)On recall/handoff failure, continue with standalone iteration and log informationally.
# Parse change-id from argument or current branch
BRANCH=$(git branch --show-current)
CHANGE_ID=${ARGUMENTS%% *} # First arg, or detect from branch
CHANGE_ID=${CHANGE_ID:-$(echo $BRANCH | sed 's/^openspec\///')}
# Defaults
MAX_ITERATIONS=5
THRESHOLD="medium" # critical > high > medium > low
# Detect worktree context and resolve OpenSpec path
# Note: detect auto-discovers context from the working directory;
# agent-id information is available via the worktree registry if needed.
eval "$(python3 "<skill-base-dir>/../worktree/scripts/worktree.py" detect)"
if [[ "$IN_WORKTREE" == "true" ]]; then
echo "Running in worktree. OpenSpec path: $OPENSPEC_PATH"
fi
Parse optional flags from $ARGUMENTS:
--max <N> overrides MAX_ITERATIONS--threshold <level> overrides THRESHOLD# Verify on feature branch
git branch --show-current # Should be openspec/<change-id>
# Verify proposal exists
openspec show $CHANGE_ID
# Verify implementation commits exist
git log --oneline main..HEAD
If not on the feature branch, check out openspec/<change-id>. If no implementation commits exist, abort and recommend running /implement-feature first.
Preferred path:
opsx:continue equivalent) to create or extend impl-findings.CLI fallback path:
openspec instructions impl-findings --change "$CHANGE_ID"
openspec status --change "$CHANGE_ID"
Ensure openspec/changes/<change-id>/impl-findings.md exists and append each iteration's findings there.
ITERATION=1
Read the following files to understand intent and current state:
$OPENSPEC_PATH/changes/<change-id>/proposal.md$OPENSPEC_PATH/changes/<change-id>/design.md$OPENSPEC_PATH/changes/<change-id>/tasks.mdgit diff --name-only main..HEAD)Note: In worktree mode, OpenSpec files are in the main repository, not the worktree.
Produce a structured improvement analysis with findings in this format:
| # | Type | Criticality | Description | Proposed Fix |
|---|---|---|---|---|
| 1 | bug/edge-case/workflow/performance/UX | critical/high/medium/low | What the issue is | How to fix it |
Type categories:
Criticality levels:
Stop iterating if:
If stopping, skip to the After Loop section below.
Otherwise, continue to step 6.
When multiple findings target different files, fix them concurrently:
# Spawn parallel agents for independent fixes
Task(
subagent_type="general-purpose",
description="Fix finding 1: <type> in <file>",
prompt="Fix this issue in OpenSpec <change-id> implementation:
## Finding
Type: <type>
Criticality: <criticality>
Description: <description>
Proposed Fix: <fix>
## File Scope
You MAY modify: <specific file(s)>
You must NOT modify any other files.
## Process
1. Read the file and understand the issue
2. Implement the fix
3. Run relevant tests
4. Report changes made
Do NOT commit - the orchestrator handles commits.",
run_in_background=true
)
Rules:
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)
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
Failures to address this iteration:
- mypy: src/auth.py:15 - Missing return type annotation
Fix any failures before proceeding. If fixes introduce new issues, address them within this iteration.
Review whether genuinely new patterns, lessons, or gotchas were discovered in this iteration. If so, update:
Follow the existing convention:
Do NOT add redundant documentation for findings that are variations of already-documented patterns.
Review whether the current OpenSpec documents accurately reflect the refined implementation. When this iteration's findings reveal spec drift, incorrect assumptions, or missing requirements, update:
openspec/changes/<change-id>/proposal.md — if the proposal's described behavior no longer matches realityopenspec/changes/<change-id>/design.md — if design decisions or trade-offs changed during refinementopenspec/changes/<change-id>/specs/ — if requirements or scenarios need correctionopenspec/changes/<change-id>/change-context.md — if this iteration added new files, tests, or changed requirement mappings, update the Requirement Traceability Matrix rows (Files Changed, Test(s) columns). Update Coverage Summary if new tests were added or requirements were discovered. If a finding reveals a missing spec requirement, add a new row to the matrix and write the corresponding test before fixing.Do NOT make unnecessary changes if the OpenSpec documents are still accurate after this iteration's fixes.
# Review all changes
git status
git diff
# Stage all changes
git add .
# Commit with structured message
git commit -m "$(cat <<'EOF'
refine(<scope>): iteration <N> - <summary of key changes>
Iterate-on-implementation: <change-id>, iteration <N>/<max>
Findings addressed:
- [<criticality>] <type>: <description>
- [<criticality>] <type>: <description>
Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
# Increment and loop
ITERATION=$((ITERATION + 1))
Loop back to Step 4.
Present a summary of all iterations:
If `CAN_MEMORY=true`, remember implementation iteration outcomes:
- MCP path: `remember`
- HTTP path: `"<skill-base-dir>/../coordination-bridge/scripts/coordination_bridge.py"` `try_remember(...)`
If `CAN_HANDOFF=true`, write a completion handoff containing:
- Fixes applied and critical findings resolved
- Remaining risks or manual follow-ups
- Validation status and recommended next command
## Iteration Summary
### Iteration 1
- Findings: <count> (<count by criticality>)
- Fixed: <list>
### Iteration 2
- Findings: <count> (<count by criticality>)
- Fixed: <list>
...
### Final State
- Total iterations: <N>
- Total findings addressed: <count>
- Remaining findings (below threshold): <list or "none">
- Termination reason: <threshold met | max iterations reached>
openspec/<change-id>Validate the deployed feature (recommended):
/validate-feature <change-id>
Or skip validation and proceed to cleanup:
/cleanup-feature <change-id>