[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C7HY84W1ZW81PZPCHFC81S":3,"skill-same:01M6C7HY84W1ZW81PZPCHFC81S":65},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":29,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":16,"ownerHtmlUrl":49,"ownerBlogUrl":16,"ownerDescription":16,"updatedAt":50,"install":51,"resources":64},"01M6C7HY84W1ZW81PZPCHFC81S","kspec-task-work","任务生命周期管理","Structured task lifecycle — start, work, note, submit, complete. AC annotations, fix cycle handling via review records, scope management, and quality checks.","结构化的任务生命周期——开始、执行、记录、提交、完成。包括 AC 标注、通过审查记录处理修复循环、范围管理和质量检查。","lepahc\u002Fkynetic-spec","lepahc","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F255431765?v=4","01M6C7E6Z0C8SE1X6PJ2F9Q1CX","01M6C7E744QKNYBVZ7KV7Z69GF",1,"MIT",null,"https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002F.factory\u002Fskills\u002Fkspec-task-work\u002FSKILL.md",[19,24],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":25,"categoryName":26,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8CCTD8AMJD7RBC6W260XV38","软件生命周期流程管理","SCENARIO","使用场景",[30,31,32,33,34,35,36,37,38],"work","kspec task work","review","start","lifecycle","quality","annotations","management","fix","2026-11-10 10:12:30",false,"---\nname: kspec-task-work\ndescription: Structured task lifecycle — start, work, note, submit, complete. AC\n  annotations, fix cycle handling via review records, scope management, and\n  quality checks.\n---\n\u003C!-- kspec-managed -->\n# Task Work\n\nStructured workflow for working on tasks. Full lifecycle from start through completion.\n\n## When to Use\n\n- Starting work on a ready task\n- Continuing in-progress or needs_work tasks\n- Ensuring consistent task lifecycle with notes and audit trail\n\n**Not for:** Spec creation (use `\u002Fkspec-writing-specs`), plan translation (use `\u002Fkspec-plan`), or triage (use `\u002Fkspec-triage`).\n\n## Inherit Existing Work First\n\nBefore starting new work, check for existing work:\n\n```bash\nkspec session start  # Shows active work at the top\n```\n\nPriority order:\n\n1. **needs_work** — Fix cycle: address review feedback (highest priority)\n2. **in_progress** — Continue work already started\n3. **ready (pending)** — New work to start\n\nAlways inherit existing work unless explicitly told otherwise. This prevents orphaned tasks.\n\n## Task Lifecycle\n\n```\npending → in_progress → pending_review → completed\n              ↓              ↓\n          blocked        needs_work\n                     (→ in_progress → pending_review)\n```\n\n| Command                                   | Transition       | When                        |\n| ----------------------------------------- | ---------------- | --------------------------- |\n| `kspec task start @ref`                   | → in_progress    | Beginning work              |\n| `kspec task submit @ref`                  | → pending_review | Work done, ready for review |\n| `kspec task complete @ref --reason \"...\"` | → completed      | Reviewed and merged         |\n| `kspec task block @ref --reason \"...\"`    | → blocked        | External blocker            |\n\n## CLI Lookups\n\nUse CLI commands to find information. **Do NOT search `.kspec\u002F` YAML files manually** — it wastes time and misses context that CLI commands provide (like inherited trait ACs).\n\n| Need                             | Command                                                                           |\n| -------------------------------- | --------------------------------------------------------------------------------- |\n| Task details                     | `kspec task get @ref`                                                             |\n| Spec + all ACs (own + inherited) | `kspec item get @ref`                                                             |\n| Trait definition + ACs           | `kspec item get @trait-slug`                                                      |\n| Search by keyword                | `kspec search \"keyword\"`                                                          |\n| List by type                     | `kspec item list --type feature`                                                  |\n| All traits                       | `kspec trait list`                                                                |\n| Task's linked spec               | `kspec task get @ref` → read `spec_ref` field                                     |\n| Task's linked plan               | `kspec task get @ref` → if `plan_ref` is non-null, run `kspec plan get @plan-ref` |\n| Reviews for a task               | `kspec review for-task @ref`                                                      |\n\n**Key pattern:** When `kspec item get` output shows \"Inherited from @trait-slug\", run `kspec item get @trait-slug` to see the trait's ACs. One command — do not grep YAML files.\n\n## Workflow Steps\n\n### 1. Choose Task\n\n```bash\nkspec tasks ready                # All ready tasks\nkspec tasks ready --eligible     # Automation-eligible only\n```\n\n### 2. Verify Work Is Needed\n\nBefore starting, check if work is already done:\n\n```bash\n# Check git history\ngit log --oneline --grep=\"feature-name\"\ngit log --oneline -- path\u002Fto\u002Frelevant\u002Ffiles\n\n# Check existing implementation\nkspec item get @spec-ref  # View spec and ACs\n```\n\nIf already implemented: verify tests pass, AC coverage exists, then `kspec task complete @ref --reason \"Already implemented\"`.\n\n**Notes are context, not proof.** If a task has notes saying \"already done\" — verify independently. Run tests, check code, validate against ACs. If a task is in the ready queue, there's a reason.\n\n### 3. Start Task\n\n```bash\n# Check task links first\nkspec task get @ref\n\n# If plan_ref is non-null, load implementation context from the plan\nkspec plan get @plan-ref\n\n# Then start work\nkspec task start @ref\n```\n\n### 4. Branch Isolation (Required Before Edits)\n\nImmediately after starting and before any file edits, create or switch to a dedicated branch.\n\n```bash\n# Preferred: deterministic dispatch-compatible branch\nkspec task branch @ref\n```\n\n`kspec task branch` creates or resumes a deterministic dispatch-compatible branch for the task. This ensures:\n\n- **Dispatch continuity** — reviewer and fix-cycle agents can find and resume the branch\n- **No naming collisions** — the branch name is derived from the task identity\n- **Remote rehydration** — if the branch exists only on the remote, the command fetches it\n\nIf you need a non-dispatch branch (e.g., for work not tied to a task), use the branch naming convention defined in your project's branching guidance.\n\n### 4a. Rebase on Target (Required Before Starting Work)\n\nBefore writing any code, rebase onto the project-defined integration target to stay current:\n\n```bash\ngit fetch origin\ngit rebase origin\u002F\u003Cintegration-branch>  # the project-defined integration branch\n```\n\nThe integration branch name comes from project configuration — in dispatch mode it is provided via the dispatch prompt context (the `Integration target:` line) and the `KSPEC_DISPATCH_MERGE_TARGET` environment variable; in manual mode, consult the project's branching guidance. The dispatch engine handles branch creation (step 4), so in dispatch mode only the rebase in this step is needed.\n\nThis keeps your branch fresh with the latest integrated work and lets you resolve conflicts early — while you have full context of your changes. If the rebase has conflicts:\n\n- **Simple textual conflicts** — resolve them inline. You have the best context for your own changes.\n- **Complex semantic conflicts** — resolve if you understand both sides. If genuinely uncertain about the correct resolution, block with a reason explaining the conflict.\n\nDo this every time you start or resume work on a task, not just the first time.\n\n### 5. Plan Before Code\n\n**Do not start writing code until you complete this step.** Read all ACs and plan your approach:\n\n```bash\nkspec item get @spec-ref  # Shows own ACs AND inherited trait ACs\n```\n\nFor each AC, identify:\n\n- **Existing code to reuse** — Search the codebase for related functions, utilities, and patterns before creating anything new. Reimplementing existing helpers is a common review blocker.\n- **Edge cases implied by the AC** — If an AC describes concurrent behavior, think beyond the simple 2-actor case. If it says \"atomic,\" consider partial failure. Read the AC literally and think about what would break it.\n- **Test cases that will prove each AC** — List them before writing production code. This surfaces gaps in your understanding early.\n\nRecord your planned approach as a task note:\n\n```bash\nkspec task note @ref \"Approach: reusing existing X for Y.\nEdge cases: A, B, C.\nTest plan: N ACs × 1+ test each, plus trait ACs.\"\n```\n\n### 6. Write Tests First\n\nWrite test skeletons from your AC analysis **before** implementing production code. For each AC, create an annotated test with the expected behavior described — then implement code to make the tests pass. This ensures coverage is driven by the spec, not retrofitted to the implementation.\n\n**Tests must exercise behavior, not inspect source code.** A test that reads implementation files and asserts on their textual content is never valid AC coverage — regardless of language, framework, or technique used to read the file. These tests fail when the implementation is refactored (even though behavior is preserved) and pass when behavior breaks (as long as the string is still there). They create false coverage and false regressions simultaneously.\n\nThe distinction: a behavioral test _runs_ the system and checks what it _does_. A source-scanning test _reads_ the code and checks what it _says_. Only behavioral tests count as AC coverage.\n\nValid approaches: call the function, run the command, make the request, render the component, execute the pipeline. Check outputs, side effects, exit codes, responses, and rendered results.\n\n### 7. Implement and Note\n\nAdd notes during work, not just at the end:\n\n```bash\n# Good: explains decisions and context\nkspec task note @ref \"Using retry with exponential backoff. Chose 3 max retries based on API rate limits.\"\n\n# Bad: no context\nkspec task note @ref \"Done\"\n```\n\nNote when you:\n\n- Discover something unexpected\n- Make a design decision\n- Encounter a blocker\n- Complete a significant piece\n\n### 8. AC Test Annotations\n\nEvery acceptance criterion should have at least one test annotated with a comment linking it to the AC. Use the comment syntax appropriate for the language:\n\n```javascript\n\u002F\u002F AC: @spec-ref ac-1\nit('should validate input when given invalid data', () => { ... });\n```\n\n```python\n# AC: @spec-ref ac-1\ndef test_validates_input():\n    ...\n```\n\n```sql\n-- AC: @spec-ref ac-1\n```\n\n```html\n\u003C!-- AC: @spec-ref ac-1 -->\n```\n\nThe pattern is always: language-appropriate comment + `AC: @spec-ref ac-N`.\n\nFor **inherited trait ACs**, use the trait's ref, not the spec's ref:\n\n```javascript\n\u002F\u002F AC: @trait-json-output ac-1\nit('should output valid JSON with --json flag', () => { ... });\n```\n\nIf a trait AC genuinely doesn't apply, annotate it with a reason:\n\n```javascript\n\u002F\u002F AC: @trait-json-output ac-3 — N\u002FA: this command has no tabular output to format\n```\n\nAnnotations must be standalone line comments, not embedded inside block comments or docstrings.\n\n### 9. Regenerate Derived Files\n\nIf your task modified skill sources, regenerate the rendered skill output with `kspec skill render` before committing.\n\nIf your task changed conventions, workflows, agents, or other meta inputs that feed `kspec-agents.md`, regenerate it with `kspec agents generate`.\n\nFor any project-specific source files that produce additional generated artifacts (package templates, plugin copies, platform-specific renders, etc.), follow the regeneration steps named in your project's maintenance guidance and commit the regenerated output alongside your source changes.\n\n### 10. Commit\n\nInclude task and spec trailers:\n\n```\nfeat: add user authentication\n\nImplemented JWT-based auth with refresh tokens.\n\nTask: @task-add-auth\nSpec: @auth-feature\n```\n\nTrailers enable `kspec log @ref` to find related commits.\n\n### 9. Quality Check\n\nBefore submitting, verify:\n\n- **Own AC coverage** — Each spec AC has an annotated test\n- **Trait AC coverage** — Each inherited trait AC has an annotated test (or N\u002FA annotation)\n- **Project-defined quality gates** — Run the project-defined format, lint, type, test, and any focused changed-file gates named in project context. Do not submit while any required gate is red, even for \"simple\" or formatting-only issues.\n- **Tests pass** — Task-specific tests pass; run the full suite or other broader test scopes named in project context for changes with broad or closure-risk impact, not just new tests.\n- **Code quality** — Matches existing patterns, no duplicated utilities.\n- **No regressions** — Existing tests still pass.\n- **kspec validation** — Reference, alignment, and completeness validation succeed.\n\n```bash\n# Run the project-defined format \u002F lint \u002F type \u002F test gates\n# (commands are named in your project's quality-gate guidance)\n\nkspec validate --refs --warnings-ok\nkspec validate --alignment --warnings-ok\nkspec validate --completeness --warnings-ok\n```\n\nTreat any red project-defined gate as in-scope task work. Fix it before `kspec task submit @ref`; do not leave hygiene cleanup for plan closure.\n\n### 10. Submit\n\nSubmit transitions the task to `pending_review`. This signals that work is complete and ready for review.\n\n```bash\nkspec task submit @ref\n```\n\nThe reviewer (human or agent) takes over from here. See `\u002Fkspec-review` for the review process and `\u002Fkspec-merge` for the merge process.\n\n## Fix Cycle\n\nWhen inheriting a `needs_work` task, the review feedback lives in kspec review records. Each fix cycle creates a new review record — the reviewer does not reopen the prior review.\n\n1. **Read the review** — Find and read ALL review threads, not just the first blocker\n\n   ```bash\n   kspec review for-task @ref              # Find all reviews (current + historical)\n   kspec review get @review-ref            # Read full review with threads\n   ```\n\n2. **Re-read all ACs** — Don't just fix the flagged issue. Re-read every AC on the spec and verify your full implementation against each one. Fixing one issue often introduces or reveals others. A narrow fix that ignores the broader spec is likely to produce another fix cycle.\n\n3. **Address all threads** — Blockers must be resolved before re-approval. Questions and nits are non-blocking but should be addressed. Fix everything the reviewer found in one pass — don't fix one blocker and resubmit hoping the rest will pass.\n\n4. **Reply and resolve threads** — For each thread you addressed, reply explaining what you did, then resolve the thread. This gives the next reviewer clear signal of what was addressed and lets them verify the resolution rather than re-discovering the original issue.\n\n   ```bash\n   kspec review reply @review-ref --thread \u003Culid> --body \"Fixed: \u003Cdescription of what was changed and why>\"\n   kspec review resolve @review-ref --thread \u003Culid>\n   ```\n\n5. **Push fixes** — Commit with descriptive message\n\n   ```bash\n   git add \u003Cfiles> && git commit -m \"fix: address review feedback\n\n   Task: @task-slug\"\n   ```\n\n6. **Note what changed** — Before resubmitting, add a task note summarizing what was fixed and why. This note becomes a key entry in the activity timeline and gives the next reviewer context on what changed since the prior review.\n\n   ```bash\n   kspec task note @ref \"Fix cycle N: addressed all review threads. Fixed X (blocker), Y (nit). Also re-verified ACs 1-5 against implementation.\"\n   ```\n\n7. **Re-submit** — `kspec task submit @ref` (back to pending_review, reviewer creates a new review record)\n\nYou do NOT merge in a fix cycle. The reviewer handles merge decisions.\n\n## Scope Management\n\n### What's In Scope\n\nTasks describe expected outcomes, not rigid boundaries:\n\n- **Tests need implementation?** Implementing missing functionality is in scope — the goal is verified behavior\n- **Implementation needs tests?** Proving it works is always in scope\n\n### When to Expand vs Escalate\n\n**Expand** (do it yourself):\n\n- Additional work is clearly implied by the goal\n- Proportional to the original task\n- You have the context\n\n**Escalate** (capture separately):\n\n- Scope expansion is major\n- Uncertain about the right approach\n- Outside your task's domain\n\n**When you notice something outside your task:** Capture it separately (`kspec inbox add` or `kspec task note`). Don't fix it inline — even small detours compound into drift.\n\n## Blocking Rules\n\n**Block only for genuine external blockers:**\n\n- Human architectural decision needed\n- Spec clarification required\n- External dependency unavailable\n- Formal `depends_on` blocker\n\n**Do NOT block for:**\n\n- Task seems complex (do the work)\n- Tests are failing (fix them)\n- Service needs running (start it)\n\nAfter blocking:\n\n```bash\nkspec task block @ref --reason \"Reason...\"\nkspec tasks ready --eligible  # Check for other work\n# If tasks exist: work on the next one\n# If empty: stop responding (agent dispatch exits automatically)\n```\n\n## Command Reference\n\n```bash\n# Task lifecycle\nkspec task start @ref\nkspec task branch @ref               # Create\u002Fresume dispatch-compatible branch\nkspec task note @ref \"...\"\nkspec task submit @ref\nkspec task complete @ref --reason \"...\"\nkspec task block @ref --reason \"...\"\n\n# Task discovery\nkspec tasks ready\nkspec tasks ready --eligible\nkspec task get @ref\n\n# Review integration\nkspec review for-task @ref           # Find linked reviews\nkspec review get @review-ref         # Read review details\n\n# Validation\nkspec validate\nkspec validate --alignment\n```\n\n## Integration\n\n- **`\u002Fkspec-review`** — Review process for submitted work\n- **`\u002Fkspec-merge`** — Merge approved work into integration branch\n- **`\u002Fkspec-writing-specs`** — Create specs before deriving tasks\n- **`\u002Fkspec-plan`** — Plans create specs that become tasks\n- **`\u002Fkspec-observe`** — Capture friction found during task work\n","\u003C!-- kspec-managed -->\n# Task Work\n\nStructured workflow for working on tasks. Full lifecycle from start through completion.\n\n## When to Use\n\n- Starting work on a ready task\n- Continuing in-progress or needs_work tasks\n- Ensuring consistent task lifecycle with notes and audit trail\n\n**Not for:** Spec creation (use `\u002Fkspec-writing-specs`), plan translation (use `\u002Fkspec-plan`), or triage (use `\u002Fkspec-triage`).\n\n## Inherit Existing Work First\n\nBefore starting new work, check for existing work:\n\n```bash\nkspec session start  # Shows active work at the top\n```\n\nPriority order:\n\n1. **needs_work** — Fix cycle: address review feedback (highest priority)\n2. **in_progress** — Continue work already started\n3. **ready (pending)** — New work to start\n\nAlways inherit existing work unless explicitly told otherwise. This prevents orphaned tasks.\n\n## Task Lifecycle\n\n```\npending → in_progress → pending_review → completed\n              ↓              ↓\n          blocked        needs_work\n                     (→ in_progress → pending_review)\n```\n\n| Command                                   | Transition       | When                        |\n| ----------------------------------------- | ---------------- | --------------------------- |\n| `kspec task start @ref`                   | → in_progress    | Beginning work              |\n| `kspec task submit @ref`                  | → pending_review | Work done, ready for review |\n| `kspec task complete @ref --reason \"...\"` | → completed      | Reviewed and merged         |\n| `kspec task block @ref --reason \"...\"`    | → blocked        | External blocker            |\n\n## CLI Lookups\n\nUse CLI commands to find information. **Do NOT search `.kspec\u002F` YAML files manually** — it wastes time and misses context that CLI commands provide (like inherited trait ACs).\n\n| Need                             | Command                                                                           |\n| -------------------------------- | --------------------------------------------------------------------------------- |\n| Task details                     | `kspec task get @ref`                                                             |\n| Spec + all ACs (own + inherited) | `kspec item get @ref`                                                             |\n| Trait definition + ACs           | `kspec item get @trait-slug`                                                      |\n| Search by keyword                | `kspec search \"keyword\"`                                                          |\n| List by type                     | `kspec item list --type feature`                                                  |\n| All traits                       | `kspec trait list`                                                                |\n| Task's linked spec               | `kspec task get @ref` → read `spec_ref` field                                     |\n| Task's linked plan               | `kspec task get @ref` → if `plan_ref` is non-null, run `kspec plan get @plan-ref` |\n| Reviews for a task               | `kspec review for-task @ref`                                                      |\n\n**Key pattern:** When `kspec item get` output shows \"Inherited from @trait-slug\", run `kspec item get @trait-slug` to see the trait's ACs. One command — do not grep YAML files.\n\n## Workflow Steps\n\n### 1. Choose Task\n\n```bash\nkspec tasks ready                # All ready tasks\nkspec tasks ready --eligible     # Automation-eligible only\n```\n\n### 2. Verify Work Is Needed\n\nBefore starting, check if work is already done:\n\n```bash\n# Check git history\ngit log --oneline --grep=\"feature-name\"\ngit log --oneline -- path\u002Fto\u002Frelevant\u002Ffiles\n\n# Check existing implementation\nkspec item get @spec-ref  # View spec and ACs\n```\n\nIf already implemented: verify tests pass, AC coverage exists, then `kspec task complete @ref --reason \"Already implemented\"`.\n\n**Notes are context, not proof.** If a task has notes saying \"already done\" — verify independently. Run tests, check code, validate against ACs. If a task is in the ready queue, there's a reason.\n\n### 3. Start Task\n\n```bash\n# Check task links first\nkspec task get @ref\n\n# If plan_ref is non-null, load implementation context from the plan\nkspec plan get @plan-ref\n\n# Then start work\nkspec task start @ref\n```\n\n### 4. Branch Isolation (Required Before Edits)\n\nImmediately after starting and before any file edits, create or switch to a dedicated branch.\n\n```bash\n# Preferred: deterministic dispatch-compatible branch\nkspec task branch @ref\n```\n\n`kspec task branch` creates or resumes a deterministic dispatch-compatible branch for the task. This ensures:\n\n- **Dispatch continuity** — reviewer and fix-cycle agents can find and resume the branch\n- **No naming collisions** — the branch name is derived from the task identity\n- **Remote rehydration** — if the branch exists only on the remote, the command fetches it\n\nIf you need a non-dispatch branch (e.g., for work not tied to a task), use the branch naming convention defined in your project's branching guidance.\n\n### 4a. Rebase on Target (Required Before Starting Work)\n\nBefore writing any code, rebase onto the project-defined integration target to stay current:\n\n```bash\ngit fetch origin\ngit rebase origin\u002F\u003Cintegration-branch>  # the project-defined integration branch\n```\n\nThe integration branch name comes from project configuration — in dispatch mode it is provided via the dispatch prompt context (the `Integration target:` line) and the `KSPEC_DISPATCH_MERGE_TARGET` environment variable; in manual mode, consult the project's branching guidance. The dispatch engine handles branch creation (step 4), so in dispatch mode only the rebase in this step is needed.\n\nThis keeps your branch fresh with the latest integrated work and lets you resolve conflicts early — while you have full context of your changes. If the rebase has conflicts:\n\n- **Simple textual conflicts** — resolve them inline. You have the best context for your own changes.\n- **Complex semantic conflicts** — resolve if you understand both sides. If genuinely uncertain about the correct resolution, block with a reason explaining the conflict.\n\nDo this every time you start or resume work on a task, not just the first time.\n\n### 5. Plan Before Code\n\n**Do not start writing code until you complete this step.** Read all ACs and plan your approach:\n\n```bash\nkspec item get @spec-ref  # Shows own ACs AND inherited trait ACs\n```\n\nFor each AC, identify:\n\n- **Existing code to reuse** — Search the codebase for related functions, utilities, and patterns before creating anything new. Reimplementing existing helpers is a common review blocker.\n- **Edge cases implied by the AC** — If an AC describes concurrent behavior, think beyond the simple 2-actor case. If it says \"atomic,\" consider partial failure. Read the AC literally and think about what would break it.\n- **Test cases that will prove each AC** — List them before writing production code. This surfaces gaps in your understanding early.\n\nRecord your planned approach as a task note:\n\n```bash\nkspec task note @ref \"Approach: reusing existing X for Y.\nEdge cases: A, B, C.\nTest plan: N ACs × 1+ test each, plus trait ACs.\"\n```\n\n### 6. Write Tests First\n\nWrite test skeletons from your AC analysis **before** implementing production code. For each AC, create an annotated test with the expected behavior described — then implement code to make the tests pass. This ensures coverage is driven by the spec, not retrofitted to the implementation.\n\n**Tests must exercise behavior, not inspect source code.** A test that reads implementation files and asserts on their textual content is never valid AC coverage — regardless of language, framework, or technique used to read the file. These tests fail when the implementation is refactored (even though behavior is preserved) and pass when behavior breaks (as long as the string is still there). They create false coverage and false regressions simultaneously.\n\nThe distinction: a behavioral test _runs_ the system and checks what it _does_. A source-scanning test _reads_ the code and checks what it _says_. Only behavioral tests count as AC coverage.\n\nValid approaches: call the function, run the command, make the request, render the component, execute the pipeline. Check outputs, side effects, exit codes, responses, and rendered results.\n\n### 7. Implement and Note\n\nAdd notes during work, not just at the end:\n\n```bash\n# Good: explains decisions and context\nkspec task note @ref \"Using retry with exponential backoff. Chose 3 max retries based on API rate limits.\"\n\n# Bad: no context\nkspec task note @ref \"Done\"\n```\n\nNote when you:\n\n- Discover something unexpected\n- Make a design decision\n- Encounter a blocker\n- Complete a significant piece\n\n### 8. AC Test Annotations\n\nEvery acceptance criterion should have at least one test annotated with a comment linking it to the AC. Use the comment syntax appropriate for the language:\n\n```javascript\n\u002F\u002F AC: @spec-ref ac-1\nit('should validate input when given invalid data', () => { ... });\n```\n\n```python\n# AC: @spec-ref ac-1\ndef test_validates_input():\n    ...\n```\n\n```sql\n-- AC: @spec-ref ac-1\n```\n\n```html\n\u003C!-- AC: @spec-ref ac-1 -->\n```\n\nThe pattern is always: language-appropriate comment + `AC: @spec-ref ac-N`.\n\nFor **inherited trait ACs**, use the trait's ref, not the spec's ref:\n\n```javascript\n\u002F\u002F AC: @trait-json-output ac-1\nit('should output valid JSON with --json flag', () => { ... });\n```\n\nIf a trait AC genuinely doesn't apply, annotate it with a reason:\n\n```javascript\n\u002F\u002F AC: @trait-json-output ac-3 — N\u002FA: this command has no tabular output to format\n```\n\nAnnotations must be standalone line comments, not embedded inside block comments or docstrings.\n\n### 9. Regenerate Derived Files\n\nIf your task modified skill sources, regenerate the rendered skill output with `kspec skill render` before committing.\n\nIf your task changed conventions, workflows, agents, or other meta inputs that feed `kspec-agents.md`, regenerate it with `kspec agents generate`.\n\nFor any project-specific source files that produce additional generated artifacts (package templates, plugin copies, platform-specific renders, etc.), follow the regeneration steps named in your project's maintenance guidance and commit the regenerated output alongside your source changes.\n\n### 10. Commit\n\nInclude task and spec trailers:\n\n```\nfeat: add user authentication\n\nImplemented JWT-based auth with refresh tokens.\n\nTask: @task-add-auth\nSpec: @auth-feature\n```\n\nTrailers enable `kspec log @ref` to find related commits.\n\n### 9. Quality Check\n\nBefore submitting, verify:\n\n- **Own AC coverage** — Each spec AC has an annotated test\n- **Trait AC coverage** — Each inherited trait AC has an annotated test (or N\u002FA annotation)\n- **Project-defined quality gates** — Run the project-defined format, lint, type, test, and any focused changed-file gates named in project context. Do not submit while any required gate is red, even for \"simple\" or formatting-only issues.\n- **Tests pass** — Task-specific tests pass; run the full suite or other broader test scopes named in project context for changes with broad or closure-risk impact, not just new tests.\n- **Code quality** — Matches existing patterns, no duplicated utilities.\n- **No regressions** — Existing tests still pass.\n- **kspec validation** — Reference, alignment, and completeness validation succeed.\n\n```bash\n# Run the project-defined format \u002F lint \u002F type \u002F test gates\n# (commands are named in your project's quality-gate guidance)\n\nkspec validate --refs --warnings-ok\nkspec validate --alignment --warnings-ok\nkspec validate --completeness --warnings-ok\n```\n\nTreat any red project-defined gate as in-scope task work. Fix it before `kspec task submit @ref`; do not leave hygiene cleanup for plan closure.\n\n### 10. Submit\n\nSubmit transitions the task to `pending_review`. This signals that work is complete and ready for review.\n\n```bash\nkspec task submit @ref\n```\n\nThe reviewer (human or agent) takes over from here. See `\u002Fkspec-review` for the review process and `\u002Fkspec-merge` for the merge process.\n\n## Fix Cycle\n\nWhen inheriting a `needs_work` task, the review feedback lives in kspec review records. Each fix cycle creates a new review record — the reviewer does not reopen the prior review.\n\n1. **Read the review** — Find and read ALL review threads, not just the first blocker\n\n   ```bash\n   kspec review for-task @ref              # Find all reviews (current + historical)\n   kspec review get @review-ref            # Read full review with threads\n   ```\n\n2. **Re-read all ACs** — Don't just fix the flagged issue. Re-read every AC on the spec and verify your full implementation against each one. Fixing one issue often introduces or reveals others. A narrow fix that ignores the broader spec is likely to produce another fix cycle.\n\n3. **Address all threads** — Blockers must be resolved before re-approval. Questions and nits are non-blocking but should be addressed. Fix everything the reviewer found in one pass — don't fix one blocker and resubmit hoping the rest will pass.\n\n4. **Reply and resolve threads** — For each thread you addressed, reply explaining what you did, then resolve the thread. This gives the next reviewer clear signal of what was addressed and lets them verify the resolution rather than re-discovering the original issue.\n\n   ```bash\n   kspec review reply @review-ref --thread \u003Culid> --body \"Fixed: \u003Cdescription of what was changed and why>\"\n   kspec review resolve @review-ref --thread \u003Culid>\n   ```\n\n5. **Push fixes** — Commit with descriptive message\n\n   ```bash\n   git add \u003Cfiles> && git commit -m \"fix: address review feedback\n\n   Task: @task-slug\"\n   ```\n\n6. **Note what changed** — Before resubmitting, add a task note summarizing what was fixed and why. This note becomes a key entry in the activity timeline and gives the next reviewer context on what changed since the prior review.\n\n   ```bash\n   kspec task note @ref \"Fix cycle N: addressed all review threads. Fixed X (blocker), Y (nit). Also re-verified ACs 1-5 against implementation.\"\n   ```\n\n7. **Re-submit** — `kspec task submit @ref` (back to pending_review, reviewer creates a new review record)\n\nYou do NOT merge in a fix cycle. The reviewer handles merge decisions.\n\n## Scope Management\n\n### What's In Scope\n\nTasks describe expected outcomes, not rigid boundaries:\n\n- **Tests need implementation?** Implementing missing functionality is in scope — the goal is verified behavior\n- **Implementation needs tests?** Proving it works is always in scope\n\n### When to Expand vs Escalate\n\n**Expand** (do it yourself):\n\n- Additional work is clearly implied by the goal\n- Proportional to the original task\n- You have the context\n\n**Escalate** (capture separately):\n\n- Scope expansion is major\n- Uncertain about the right approach\n- Outside your task's domain\n\n**When you notice something outside your task:** Capture it separately (`kspec inbox add` or `kspec task note`). Don't fix it inline — even small detours compound into drift.\n\n## Blocking Rules\n\n**Block only for genuine external blockers:**\n\n- Human architectural decision needed\n- Spec clarification required\n- External dependency unavailable\n- Formal `depends_on` blocker\n\n**Do NOT block for:**\n\n- Task seems complex (do the work)\n- Tests are failing (fix them)\n- Service needs running (start it)\n\nAfter blocking:\n\n```bash\nkspec task block @ref --reason \"Reason...\"\nkspec tasks ready --eligible  # Check for other work\n# If tasks exist: work on the next one\n# If empty: stop responding (agent dispatch exits automatically)\n```\n\n## Command Reference\n\n```bash\n# Task lifecycle\nkspec task start @ref\nkspec task branch @ref               # Create\u002Fresume dispatch-compatible branch\nkspec task note @ref \"...\"\nkspec task submit @ref\nkspec task complete @ref --reason \"...\"\nkspec task block @ref --reason \"...\"\n\n# Task discovery\nkspec tasks ready\nkspec tasks ready --eligible\nkspec task get @ref\n\n# Review integration\nkspec review for-task @ref           # Find linked reviews\nkspec review get @review-ref         # Read review details\n\n# Validation\nkspec validate\nkspec validate --alignment\n```\n\n## Integration\n\n- **`\u002Fkspec-review`** — Review process for submitted work\n- **`\u002Fkspec-merge`** — Merge approved work into integration branch\n- **`\u002Fkspec-writing-specs`** — Create specs before deriving tasks\n- **`\u002Fkspec-plan`** — Plans create specs that become tasks\n- **`\u002Fkspec-observe`** — Capture friction found during task work\n",{"name":5,"description":7},"main","c4b0de3035f8512bba7eb0a9b4e39ea2fbd3f08e",".factory\u002Fskills\u002Fkspec-task-work",2,"https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec","https:\u002F\u002Fgithub.com\u002Flepahc","2026-07-22 18:57:40",{"source":9,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add lepahc\u002Fkynetic-spec --skill kspec-task-work",{"tool":57,"command":58},"bunx","bunx skills add lepahc\u002Fkynetic-spec --skill kspec-task-work",{"tool":60,"command":61},"pnpm","pnpm dlx skills add lepahc\u002Fkynetic-spec --skill kspec-task-work","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002F.factory\u002Fskills\u002Fkspec-task-work\u002FSKILL.md",true,[],[66,82,95,108,121,133],{"skillNo":67,"name":68,"nameZh":69,"description":16,"descriptionZh":70,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":71,"categories":72,"keywords":79,"publishedAt":39},"01M6C7KCZE43MDZ74FV3A5TDCQ","writing-specs","技术规格文档撰写","","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Fwriting-specs\u002FSKILL.md",[73,76],{"categoryNo":74,"categoryName":75,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BVB0FJ0RR8KXYVFTKEA3XX","技术文档工程师",{"categoryNo":77,"categoryName":78,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8C5C7NGT4DWWBE15R6QGEX5","技术文档编写",[80,81],"writing","writing specs",{"skillNo":83,"name":84,"nameZh":85,"description":16,"descriptionZh":70,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":86,"categories":87,"keywords":94,"publishedAt":39},"01M6C7KAK9CBJ87PX3BCW7B7YG","triage","问题分诊分类","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Ftriage\u002FSKILL.md",[88,91],{"categoryNo":89,"categoryName":90,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BS5011KJDVSRXG1DC4P666","普通用户",{"categoryNo":92,"categoryName":93,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8C2MZSDTE56BDKER3VPW2JM","工单与问题跟踪管理",[84],{"skillNo":96,"name":97,"nameZh":98,"description":16,"descriptionZh":70,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":99,"categories":100,"keywords":105,"publishedAt":39},"01M6C7K89VN6FJCT8M86K56EE8","triage-inbox","收件箱分诊整理","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Ftriage-inbox\u002FSKILL.md",[101,102],{"categoryNo":89,"categoryName":90,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":103,"categoryName":104,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8CA5BYP6JTMPXCGK1Y0G4M3","邮件检索与管理",[84,106,107],"inbox","triage inbox",{"skillNo":109,"name":110,"nameZh":111,"description":16,"descriptionZh":70,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":112,"categories":113,"keywords":118,"publishedAt":39},"01M6C7K6F2342AC1TJCN9PM0ZB","triage-automation","任务分诊自动化","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Ftriage-automation\u002FSKILL.md",[114,117],{"categoryNo":115,"categoryName":116,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师",{"categoryNo":92,"categoryName":93,"taxonomyType":27,"taxonomyTypeDesc":28},[84,119,120],"automation","triage automation",{"skillNo":122,"name":123,"nameZh":124,"description":16,"descriptionZh":70,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":125,"categories":126,"keywords":131,"publishedAt":39},"01M6C7K3TFQ88QQBW3PXYDHQG2","task-work","任务执行","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Ftask-work\u002FSKILL.md",[127,128],{"categoryNo":115,"categoryName":116,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":129,"categoryName":130,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BSFHC0DJXKNN0QBZDDS4K9","定时任务与自动化编排",[30,132],"task work",{"skillNo":134,"name":32,"nameZh":135,"description":16,"descriptionZh":70,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":10,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":136,"categories":137,"keywords":142,"publishedAt":39},"01M6C7K168CH3XJCC3PDGA9H6C","成果审查","https:\u002F\u002Fgithub.com\u002Flepahc\u002Fkynetic-spec\u002Fblob\u002Fmain\u002Ftemplates\u002Fskills\u002Freview\u002FSKILL.md",[138,139],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":140,"categoryName":141,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8C48JNVH0P83Z0KVKAQ4819","成果验证与价值评估",[32]]