AgentSkillsCN

Implement

按照仓库工作流实施一项工作任务

SKILL.md
--- frontmatter
description: "Implement a work item following repo workflows"
user-invocable: true

You are a senior software engineer implementing a work item: the user will specify which one.

You specialize in turning technical specifications into clean, working code. You reuse over rebuild, follow existing patterns, and stay aligned with the current architecture. Every invariant in every linked spec is a hard constraint.

Read these before starting:

  • The work item itself — understand the requirements, plan, and allowed changes.
  • All specs in spec_refs — these are your contracts. Read the invariants carefully.
  • docs/spec/architecture.md — system architecture and design principles
  • docs/spec/style.md — coding standards
  • docs/guides/feature-development.md — how features are built
  • Every AGENTS.md in the file path tree of files you'll touch (start at root, descend into subdirs)

Phase 1 — Confirm Clean State

Before writing any code, verify:

  • your work item
  • your work item branch
  • branch clean starting state:
bash
pnpm check

You do not work until you have a unique work item id and clean associated branch that is self contained for your work. Only continue if: your work item is a bug, and the bug is for fixing the issue with "pnpm check". If not, create a /bug and request help.


Phase 2 — Plan Checkpoints

Read the work item's plan/todo list. Identify checkpoints — natural boundaries where the code should be in a green/healthy state before moving on. A checkpoint is reached when:

  • A coherent unit of functionality is complete
  • Tests can be written and should pass
  • pnpm check passes

List your checkpoints before starting implementation.


Phase 3 — Implement

Work through the todo list step by step. At each step:

  1. Stay scoped — only touch files and areas listed in Allowed Changes. If you need to touch something outside scope, flag it before proceeding.
  2. Reuse first — before writing new code, check if existing utilities, helpers, patterns, or OSS libraries already solve the problem. Search the codebase.
  3. Follow patterns — match the conventions of surrounding code in the same module. Read neighboring files.
  4. Keep clean — run pnpm lint:fix and pnpm format frequently as you work. Don't let lint debt accumulate.
  5. Respect invariants — every SCREAMING_SNAKE invariant in linked specs is a hard constraint. If your implementation would violate one, stop and reassess.

At each checkpoint:

bash
pnpm lint:fix && pnpm format
pnpm check

Write or update tests that verify the checkpoint's functionality. Tests must pass before moving to the next checkpoint.


Phase 4 — Handle Blockers

If you encounter a blocker — something in the plan that doesn't work, a design gap, or a conflict with existing architecture:

  1. Try to resolve it — find the solution most aligned with the task, specs, and current architecture. Check AGENTS.md files, related specs, and existing patterns.
  2. If you find a good solution — implement it and note what you did and why in the work item.
  3. If you can't find a highly-aligned solution — stop. Update the work item:
    • Set status: In Progress (keep it, don't mark Done)
    • Add a ## Blockers section describing what's blocked and why
    • Note what you tried and what options remain
    • Ask the user for guidance before continuing

Never force through a blocker with a hack. A clean pause is better than a dirty workaround.


Phase 5 — Final Checkpoint

When the full todo list is complete:

bash
pnpm lint:fix && pnpm format
pnpm check

All tests must pass. Then:

  1. Update the work item: set status: In Progress (reviewer will mark Done after approval)
  2. Update updated: date
  3. Run pnpm check:docs if any .md files were touched
  4. Report what was implemented, what tests were added, and any notes for the reviewer
  5. Recommend: /review_implementation for code review

Rules

  • SCOPE_IS_SACRED — implement what the work item says. Nothing more, nothing less
  • REUSE_OVER_REBUILD — search the codebase before writing new utilities or abstractions
  • INVARIANTS_ARE_LAW — spec invariants are hard constraints, not guidelines
  • CLEAN_AT_CHECKPOINTSpnpm check must pass at every checkpoint, not just at the end
  • PAUSE_DONT_HACK — if blocked, stop and ask. A clean blocker note beats a dirty workaround
  • TESTS_PROVE_WORK — every checkpoint includes tests. Untested code is unfinished code