Use when a change's tasks are ready to implement, or when resuming one left half-done — works through the task list, marking each checkbox as it lands.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Speclink Apply?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/momochenisme-speclink-apply-speclink)
---
name: speclink-apply
description: "Use when a change's tasks are ready to implement, or when resuming one left half-done — works through the task list, marking each checkbox as it lands."
license: MIT
compatibility: Requires speclink CLI.
metadata:
author: speclink
version: "v1.59.0"
generatedBy: "Speclink"
---
**Conversation language**: write to the user in the language they use with you — progress updates, questions, and summaries. This skill is written in English, and its example messages show structure, not language: translate their prose, and keep commands, file paths, code, and fixed tokens (severity labels, status words) as they are. When a step sets the language of its own output — a document, a report, or the way it presents results and asks about them (for example through `locale`) — that step decides for that output. When you edit a document that already exists and no step sets its language, keep the language it is written in. When you run in a forked context that cannot see the conversation, use the language of the request you were given.
Implement tasks from a Speclink change.
**Input**: Optionally specify a change name (e.g., `/speclink-apply add-auth`). If omitted, check if it can be inferred from conversation context — inference only decides whether a name is given; the selection itself always goes through `speclink plan` in step 1.
**Task tracking lives in the tasks artifact only.** Its markdown checkboxes (`- [ ]` / `- [x]`) are the single source of truth for progress. Do not use any external task management system, built-in task tracker, or todo tool. When a task is done, `speclink task done` (step 7) checks its box — that is the only way to record progress.
**Prerequisites**: This skill requires the `speclink` CLI. If any `speclink` command fails with "command not found" or similar, report the error and STOP.
**Asking the user**: ask with the **AskUserQuestion tool**; when that tool is not available, ask the same question with the same options as plain text and wait for the user's response.
**Write-back: changing an artifact that already exists.** Every fix and update this skill makes to an artifact that already exists is a write-back. Read the artifact's full text with `speclink artifact cat <artifact-id> --change "<name>"` — a delta spec is `specs/<capability>`, which the `deltaSpecs` field of `speclink show <name> --json` lists as `<capability>/spec.md` — make the change on that full text, and write the whole result back with `--stdin --force`:
```bash
speclink new artifact <artifact-id> --change "<name>" --stdin --force <<'ARTIFACT_EOF'
<full updated content>
ARTIFACT_EOF
```
A delta spec is written back with `speclink new artifact spec <capability> --change "<name>" --stdin --force`. The same verbs work when the documents live in a remote store. When `new artifact` refuses a write-back with an error (for example, a task list whose tasks are all checked), stop and tell the user the message — do not edit the file instead.
**Steps**
1. **Select the change with plan**
Always run the execution-order query first:
```bash
speclink plan --json
```
It returns `waves` (changes that may run in parallel), `changes` (one entry per active change with `stage`, `blockedBy` and `ready`), `next` (the first proposed change with nothing blocking it, or `null`) and `skipped` (changes whose metadata could not be parsed). If the command fails (a dependency cycle, a project that is not initialized), show the error and STOP.
- **No name given** → take `next`. If `next` is `null`, there is nothing ready to start: list every change with its `blockedBy` and STOP — do not pick one anyway.
- **A name given** (from the argument or from conversation context) → find it in `changes`. If its `blockedBy` is non-empty, print the prerequisite list (`blockedBy`) and STOP: do not run `speclink review prepare`, do not run `speclink in-progress add`. The way out is the user's: land (archive) the blockers first; drop a declared prerequisite that is wrong with `speclink change depends <name> --on <prerequisite> --remove`. Then run apply again.
- **A named change that is not in `changes`** (archived, misspelled, or listed under `skipped`) → keep going; step 2's status check reports it.
Never auto-select a change just because only one exists, and never bypass the plan because the user mentioned a change in conversation — the plan decides whether it may start.
Always announce: "Using change: <name>" and how to override (e.g., `/speclink-apply <other>`).
2. **Check status to understand the schema**
```bash
speclink status --change "<name>" --json
```
- **The command fails** → show the error and STOP.
- **The command succeeds** → read the change's entry in `speclink list --json` and keep its `created` and `modifiedAt` for step 3d: the two commands below write to the change, which moves `modifiedAt` to now. Then capture the review baseline, and mark the change as in-progress:
```bash
speclink review prepare "<name>"
speclink in-progress add "<name>"
```
`review prepare` records the host-local Apply baseline (HEAD, dirty files at start) that the review station later resolves its frozen change scope against. Both are silent operations — do not show their output to the user. A stderr warning from `review prepare` (late or unavailable baseline) is fine — continue. If `speclink review prepare` fails, report the error and STOP — do NOT run `speclink in-progress add`.
Parse the JSON to understand:
- `schemaName`: The workflow being used (e.g., "spec-driven")
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
3. **Get apply instructions**
```bash
speclink instructions apply --change "<name>" --json
```
This returns:
- Context file paths (varies by schema)
- Progress (total, complete, remaining)
- Task list with status
- Dynamic instruction based on current state
**Handle states:**
- `state: "blocked"` (missing artifacts) → show the message, suggest using `/speclink-propose` to create the change artifacts first
- `state: "all_done"` → congratulate, suggest archive
- Otherwise → proceed to implementation
3b. **Preflight check**
If the apply instructions JSON includes a `preflight` field, act on its `status`:
- **`"clean"`** → silently continue — no output needed.
- **`"warnings"`** → display a brief summary, then continue automatically:
```
⚠ Preflight warnings:
- Drifted files (modified after change was created): <list paths>
- Change is <N> days old
Continuing...
```
Only show the lines that are relevant (skip drifted if none, skip staleness if not stale).
- **`"critical"`** → display missing files with their source artifact, then use the **AskUserQuestion tool** to ask the user:
```
⚠ Preflight: missing files detected
- <path> (referenced in <source artifact>)
- ...
These files are referenced in the change artifacts but no longer exist on disk.
```
Options: "Continue anyway" / "Stop". If the user chooses "Stop", end the workflow.
If the `preflight` field is absent (blocked or all_done states), skip this step.
3c. **Artifact quality check**
Run `speclink analyze <change-name> --json` to check cross-artifact consistency (Coverage, Consistency, Ambiguity, Gaps).
- **Zero findings** → silently continue.
- **Warning/Suggestion only** → display a one-line summary (e.g., "⚠ Artifact analysis: 2 warnings found") and continue automatically.
- **Critical findings** → display each Critical finding (summary + location + recommendation), then use the **AskUserQuestion tool**:
- **Fix and continue** — fix the artifact issues with a write-back (see **Write-back** above the steps), then proceed
- **Continue anyway** — skip fixes and start implementation
- **Stop** — end the workflow
3d. **Drift dormancy check** (passive trigger for stale changes)
When the change is dormant, surface a drift report before tasks begin — the change is likely out-of-sync with the current codebase.
A change is dormant when the `created` of its entry in `speclink list --json` is more than 5 days ago and its `modifiedAt` is more than 3 days ago. An entry with no `modifiedAt` is judged on `created` alone — say then that the last activity cannot be read. An entry with no `created` is not dormant.
Judge on the entry step 2 kept, not on a fresh one.
- **The change is dormant** → run `speclink drift <change-name>`, display the report, then use the **AskUserQuestion tool**:
- **Continue with apply** — proceed to tasks (recommended for Light drift)
- **Refresh first** — pause apply, run `/speclink-ingest <change-name>` to update artifacts, then resume
- **Stop** — end the workflow
- **It is not dormant** → silently continue, no output.
The trigger is guidance only — it does not block apply from proceeding when the user chooses to continue. Hard-blocking on dormancy would punish legitimate "I came back after a long weekend" cases.
(Threshold reasoning: AI-assisted work is daily-cadence. ≥5 days since creation + ≥3 days with no change to the change's documents ≈ genuine stagnation, not normal pacing. `modifiedAt` is when the documents last changed, not a commit time — read the verdict as a hint.)
4. **Read context files**
Read the files listed in `contextFiles` from the apply instructions output — never assume specific file names.
The files depend on the schema being used:
- **spec-driven**: proposal, specs, design, tasks
- Other schemas: follow the contextFiles from CLI output
**Remote mode**: when the workspace is connected to a remote store, `contextFiles` points into the read-only Context Projection (`.speclink/context/`) — a local snapshot of the remote canon. Read, search, and grep it freely, but never edit projection files: a direct edit is not a remote write and the next command will reject the projection as modified. Any spec or artifact change goes through speclink verbs. If a `STALE` marker file exists at the projection root or a command reports the projection as modified, re-run `speclink instructions apply` to refresh it.
5. **Check project preferences**
The apply instructions payload carries the effective policy toggles as the `tdd` and `audit` boolean fields — read them from the payload; do not read any config file for these.
- **`tdd` is true** → apply TDD discipline throughout implementation:
- For each task, write a failing test FIRST, then implement to make it pass
- Fetch TDD instructions by running `speclink instructions --skill tdd`, then follow the Red-Green-Refactor cycle
- For bug fixes, reproduce the bug with a failing test before fixing
- **`audit` is true** → apply sharp-edges discipline throughout implementation:
- When designing APIs or interfaces, evaluate through 3 adversary lenses (Scoundrel, Lazy Developer, Confused Developer)
- When adding configuration options, verify defaults are secure and zero/empty values are safe
- When accepting parameters, check for type confusion and silent failures
- Fetch audit instructions by running `speclink instructions --skill audit`, follow the discipline checklist (not the standalone 3-agent workflow)
6. **Show current progress**
Display:
- Schema being used
- Progress: "N/M tasks complete"
- Remaining tasks overview
- Dynamic instruction from CLI
7. **Implement tasks (loop until done or blocked)**
Keep going through the pending tasks until every non-`[M]` task is done or something stops you. The stops below — an `[M]` task that blocks a code task, an unclear task, a design issue, an error — take priority over finishing the list.
For each pending task:
- Show which task is being worked on
- Re-read the sections of the design and the specs that are relevant to this task's scope with `speclink artifact cat <artifact-id> --change "<name>"` (a delta spec is `specs/<capability>`) — do not rely on memory from earlier in the conversation, as context may have been compressed
- **Read the Implementation Contract for this task before editing any source file.** If `design.md` exists and contains an `## Implementation Contract` section (or contract content under another heading the design uses), read the part of it that covers this task's scope. The contract names the observable behavior, interface or data shape, failure modes, acceptance criteria, and scope boundaries you must satisfy. Treat the contract as the durable handoff — it is what the task will be measured against, regardless of who started the change.
- **Detect unclear or path-only tasks before writing code.** A task is unclear if it:
- only names files to edit ("edit `foo.rs`", "update `bar.svelte`") with no behavior, contract, or verification target;
- is vague ("handle edge cases", "wire it up", "make it work");
- conflicts with the implementation contract (asks for behavior the contract excludes, or omits behavior the contract requires).
When this happens, pause. Either update the artifact (design or tasks) with a write-back (see **Write-back** above the steps) so the task names a concrete behavior and verification target, or report the blocker and wait for guidance. Do not silently guess against unclear requirements.
- Before writing code, check:
1. **Reuse** — search adjacent modules and shared utilities for existing implementations before writing new code
2. **Quality** — derive values from existing state instead of duplicating; use existing types and constants over new literals
3. **Efficiency** — parallelize independent async operations; avoid unnecessary awaits; match operation scope to actual need
4. **No Placeholders in artifacts** — if the design or spec for this task contains placeholder language (TBD, TODO, "add appropriate handling"), pause and fix the artifact first (a write-back) or flag to the user. Do not implement against vague requirements.
5. **Examples as verification** — if the spec for this task's scope includes `##### Example:` blocks, use them as concrete test cases:
- When TDD is enabled: derive the first failing test directly from the example's GIVEN/WHEN/THEN values
- When TDD is not enabled: after implementing, verify the code handles the example's input→output correctly
- Example tables map to parameterized tests — one test per row
Do not invent additional test values beyond what the spec examples provide without reason. The examples ARE the agreed specification.
- Make the code changes required
- Keep changes minimal and focused
- **Verify before marking done** — re-read the task description (`speclink artifact cat tasks --change "<name>"`) AND the relevant Implementation Contract content of the design (`speclink artifact cat design --change "<name>"`). For each requirement stated in the task description and each contract item that covers this task's scope, confirm it is addressed by your changes. Confirm the verification target named by the task (test name, CLI invocation, analyzer check, or manual assertion) actually passes. If any contract item, task requirement, or verification target is missing or failing, implement/fix it now. Do not mark the task complete until every part of the description is covered and the contract for this task is satisfied.
- Mark task complete right away by running: `speclink task done --change "<name>" <task-id>`
This command marks the checkbox in tasks.md AND records which files were modified for this task.
- **NEVER check off an `[M]` task.** A task whose description carries the `[M]` prefix is manual work the user performs by hand — not only manual testing, but anything you cannot do yourself: accepting a result by operating the product, creating an account on an external service, placing a key. You cannot observe the outcome, so you cannot attest to it. Skip it and move on — unless a code task depends on it, which is the next point's blocked case. Once every non-`[M]` task is checked, apply is finished: report completion, name the `[M]` tasks left for the user, and say that the quality stations (`/speclink-review`, `/speclink-verify`, or `/speclink-quality` for both) can run now while archive waits for the manual runs.
- **A code task blocked by an open `[M]` task stops you.** Some manual tasks come first, not last — the external account has to exist before the code that calls it can be written. When implementing a code task requires an unchecked `[M]` task to be done, stop and ask the user to complete that manual task. Never check it off on their behalf, and never work around it.
- If a task was checked by mistake or its implementation is rolled back, run: `speclink task undone --change "<name>" <task-id>`
Do not edit tasks.md directly to uncheck a task.
- Continue to next task
**Pause and wait for guidance when:**
- The task is unclear → ask for clarification
- Implementation reveals a design issue → suggest updating artifacts
- An error or blocker comes up → report it
- The user interrupts
**Started the wrong change?**
If apply was run against the wrong change (or a change was marked
in-progress by mistake), revert it to proposed:
```bash
speclink in-progress remove "<name>"
```
The verb succeeds only when the change carries zero work traces; with
traces present it refuses and lists the evidence. Two ways out:
- Checked tasks: uncheck them with `speclink task undone`, then retry
- Touched records: the listed files may mix content from other changes —
judge and clean them up case by case (there is no force flag and no
mechanical cleanup), then ask the user how to proceed
Unlike `in-progress add`, an unknown change name errors loudly — check the
name with `speclink list` if it reports not found.
8. **Final check**
After completing all tasks, re-run:
```bash
speclink instructions apply --change "<name>" --json
```
Confirm `state: "all_done"`. If not, review remaining tasks and complete them.
9. **On completion or pause, show status**
Display:
- Tasks completed this session
- Overall progress: "N/M tasks complete"
- All done → suggest archive
- Paused → explain why and wait for guidance
**Output During Implementation**
```
## Implementing: <change-name> (schema: <schema-name>)
Working on task 3/7: <task description>
[...implementation happening...]
✓ Task complete
Working on task 4/7: <task description>
[...implementation happening...]
✓ Task complete
```
**Output On Completion**
```
## Implementation Complete
**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 7/7 tasks complete ✓
### Completed This Session
- [x] Task 1
- [x] Task 2
...
All tasks complete! Quality stations are optional: `/speclink-review` ∥ `/speclink-verify`, or `/speclink-quality`.
Skipping them is fine — archive directly with `/speclink-archive`, or do archive + commit
in one step via `/speclink-commit` ("Archive first, then commit together").
(Inside a linked worktree: do not archive — commit there and hand off to `/speclink-worktree-merge`.)
```
**Output On Pause (Issue Encountered)**
```
## Implementation Paused
**Change:** <change-name>
**Schema:** <schema-name>
**Progress:** 4/7 tasks complete
### Issue Encountered
<description of the issue>
**Options:**
1. <option 1>
2. <option 2>
3. Other approach
What would you like to do?
```
---
## Rationalization Table
| What You're Thinking | What You Should Do |
| ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| "This task looks done, I'll mark it complete" | Re-read the task description first. Check whether your diff covers every part of it. Incomplete tasks marked done are the #1 source of rework |
| "This task is trivial, I don't need to re-read the design" | Re-read. Context compression loses details. 30s of reading saves 30min of rework |
| "I already know how this works, skip the code search" | Search anyway. Someone may have added a utility since you last looked |
| "The test is obvious, I'll add it after implementation" | If TDD is enabled, test first. If not, still write it before marking done |
| "This is just a small refactor, no test needed" | Small refactors are how regressions sneak in. Write the test |
| "The artifact says X but Y makes more sense" | Pause and suggest updating the artifact. Don't silently deviate |
| "I'll fix this other thing I noticed while I'm here" | Finish current task first. Address the other thing separately |
| "The example values are just illustrations, I'll pick better ones" | Use the spec example values exactly. They were chosen deliberately |
**Guardrails**
Check these before you show the final status:
- [ ] The context files came from the apply instructions output and were read before the first task (step 4).
- [ ] Every finished task was checked with `speclink task done` right away; no external task tracker was used.
- [ ] No `[M]` task was checked, and a code task blocked by an open `[M]` task stopped the run (step 7).
- [ ] Code changes stayed minimal and scoped to each task; ambiguity, design issues and errors paused the run instead of a guess (step 7).
**Fluid Workflow Integration**
This skill supports the "actions on a change" model:
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
## Next steps
Suggestions only. This skill NEVER invokes any of them — report where things stand and stop; the user decides what runs next.
- Every non-`[M]` task is checked → the quality stations are optional and the user's call: `/speclink-review` (craft quality) ∥ `/speclink-verify` (spec compliance), or `/speclink-quality` to run both in order; each station hands off to archive when its stamp lands
- Skipping the quality stations is equally valid → go straight to `/speclink-archive <change-name>`, or take the one-step path: `/speclink-commit <change-name>` and pick its "Archive first, then commit together" option
- Only `[M]` tasks remain → the quality stations can still run now, but archiving waits until the user has done the manual work by hand
- Requirements changed mid-work → `/speclink-ingest <change-name>`, then come back to apply