Skip to content
Back to skills

Code

ASecurity

Write the code for a locked subtask, then record the progress so the session can resume later. Run it after the spec is settled and before the subtask is tested.

  • 2 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added May 28, 2026
ai-agentsrustgobash

Works with

  • claude code
  • mcp

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 10, 2026

npx -y skills add easyinplay/harnessed --skill code --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/easyinplay-code/badge)](https://www.skillsdirectory.com/skills/easyinplay-code)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: task-code
description: |
  Write the code for a locked subtask, then record the progress so the session can resume later. Run it after the spec is settled and before the subtask is tested.
trigger_phrases:
  - "code this subtask"
  - "task-code workflow"
  - "Stage 3 code"
  - "跑 task-code"
---

# task-code workflow (v3)

## Overview

2-phase sub-workflow mapping the user's CLAUDE.md Stage ③.b 子任务编码 discipline
onto the harnessed runtime, fully `harnessed.workflow.v3` schema (Phase v3.0-3.4 W0
T3.4.W0.7 — D-09 L0 Discipline Substrate + D-05 conditional `invokes_tools` + D-15
planning-with-files plugin).

| phase | id | upstream | model | capability / invokes_tools |
| ----- | -- | -------- | ----- | -------------------------- |
| 1 | `01-code` | karpathy | sonnet | `invokes_tools: [{if: phase.architecture_health_audit, tool: improve-codebase-architecture}, {if: subtask.bug_root_cause_unknown, tool: diagnose}]` |
| 2 | `02-progress` | planning-with-files | haiku | `{{ capabilities.planning-with-files.cmd }}` / `invokes: /plan` / `artifacts_expected: [progress.md]` |

Per-phase config loads from `workflows/task/code/workflow.yaml`; engine.runRouting
spawns each phase as a sub-agent via `@anthropic-ai/claude-agent-sdk` 0.3.142+.

## Karpathy 4 心法 (L0 Discipline Substrate always-on)

Phase 01-code 的 upstream 是 `karpathy` — runtime engine 加载 `workflows/disciplines/
karpathy.yaml` discipline rules 应用 cross-cutting (Think Before Coding / Simplicity
First / Surgical Changes / Goal-Driven Execution + ≤200L hard limit + no-feature-creep
+ trust-internal-code + no-comments-default). 不 invoke slash cmd, 通过 hook 强制
behavioral rule per D-09 L0 Discipline Substrate.

## mattpocock conditional route (D-05 invokes_tools)

Phase 01-code 按 phase fact context 条件性 fire 2 mattpocock 招式:
- `improve-codebase-architecture` — 周期架构健康审查 (when `phase.architecture_health_audit == true`)
- `diagnose` — bug 系统化排错 (when `subtask.bug_root_cause_unknown == true`)

2 触发条件 OR-chain, 任 1 fire 即 invoke 对应招式 — 不互斥 (sister CLAUDE.md
"mattpocock 招式按需召唤" pattern, NOT exclusive). 无触发 = pure karpathy 心法 only.

## CodeGraph navigation (opt-in, v4.17.0)

If the project has a `.codegraph/` index (opt-in CodeGraph semantic index — sister
`capabilities.yaml` `codegraph` entry), prefer the codegraph MCP tools
(`codegraph_explore`) for symbol lookup / call paths / impact analysis instead of
grep/glob/file-by-file Read crawling. No `.codegraph/` → skip this (no install nag).

## Phase 02-progress planning-with-files plugin 真接 (Q-AUDIT-5a LOCKED Option A)

02-progress invokes the **Claude Code plugin** slash command `/plan` to update
`progress.md` in `.planning/phases/<NN>-<slug>/` — 跟踪 subtask 完成 / blocked / next step
per bundled "跨 session 恢复" 模式 + R20.6 Manus-style 持久化. Requires the
`planning-with-files` Claude Code plugin (install via Claude Code plugin
marketplace).

## How to invoke

!`harnessed checkpoint intent task-code`

> The banner above (when present) means this invocation is REGISTERED with the engine (an intent marker) — not yet compliant: the steps below (prompt → spawn → checkpoint complete) resolve it, and a per-turn `<workflow-intent>` reminder persists until they run.

The numbered sequence below **is** the state machine — execute it with Bash. Do NOT improvise
an equivalent flow from the Overview above: freelancing bypasses the engine (no ledger, no
evidence guard). harnessed gives you the spawn-ready prompt; YOU spawn the subagent with a
{{ host.native }} {{ host.spawn_subagent }} (keeps the session responsive + lets clarification round-trips reach the user).

Do NOT pipe to `harnessed run task-code` — that is the CI/headless path ({{ host.harnessed_run_warning_note.execution_tail }}

1. Bash: `harnessed prompt task-code --task "$ARGUMENTS" --json` → parse `{prompt, max_iterations, model, result_file}`.
2. Spawn a {{ host.native }} subagent ({{ host.spawn_subagent }}) with that `prompt` and `model`. The sub writes its own final result into `result_file` — the path that prompt names — so the FILE is the completion signal: do NOT wait for the sub's chat message, because a background or re-parented agent's message may never arrive. Then drive delivery with harnessed's own completion gate:
   - the gate is `harnessed checkpoint complete task-code --result-file <result_file> --wait 60` — one call waits at most 60 seconds, so run the SAME command again when the sub needs longer; it is fail-closed on the declared artifacts, the TDD boundary, and the verbatim `<promise>COMPLETE</promise>`.
   - if it blocks, run `harnessed checkpoint fail task-code --failing-tests <n>` to record the attempt; it prints BUDGET-EXHAUSTED / NO-PROGRESS / BREAK-LOOP when a stop condition is reached.
   - respawn ONLY while none of those three has fired. Any one of them means stop: re-scope the subtask, fix the blocker, or escalate to the user. Never respawn past a stop directive.
3. If the sub’s output contains `STATUS: NEEDS_CLARIFICATION` + a question list (read it from `result_file` — the chat message may never arrive): STOP, relay them verbatim via {{ host.ask_user }}, append the answers to the spec, then re-spawn the same sub.
4. When `result_file` carries the completion marker: Bash `harnessed checkpoint complete task-code --result-file <result_file> --wait 60 --summary "<one-line>"`. Fail-CLOSED — it blocks unless every declared `artifacts_expected` file exists, the TDD boundary passes (non-empty evidence / both the red and green sides present / the test file was not deleted), and the result file carries a verbatim `<promise>COMPLETE</promise>` (or a structured COMPLETE status). `--wait 60` bounds ONE call to 60 seconds — run the SAME command again when the sub needs longer, never an unbounded wait. `--result <text>` is the inline variant; `--result-file` wins and is quoting-safe on Windows. A `result-wait-timeout` exit means the sub has not signalled YET — repeat the same command; `--force` records an audited override (`evidence_status=overridden`) — it does not silently pass.
5. If the complete gate blocked: Bash `harnessed checkpoint fail task-code --failing-tests <n>` to record the attempt. It prints `BUDGET-EXHAUSTED` / `NO-PROGRESS` / `BREAK-LOOP` once a stop condition is reached. Respawn ONLY while none of those three has fired; any one of them means STOP — re-scope the subtask, fix the blocker, or escalate to the user.

<!-- harnessed-generated:v4.13.0 -->

## References

- D-09 — L0 Discipline Substrate always-on (karpathy 心法 4 条 cross-cutting)
- D-05 — phase-level `invokes_tools` conditional tool fire
- D-15 + Q-AUDIT-5a — planning-with-files = Claude Code plugin slash cmd `/plan`
- D-02 — SKILL.md `name:` bare slash cmd (`task-code` NOT `task/code`) per ADR 0030
- `workflows/disciplines/karpathy.yaml` — 4 心法 + ≤200L hard limit 等 rules (L0 substrate)
- `workflows/capabilities.yaml` — improve-codebase-architecture / diagnose / planning-with-files entries
- `workflows/defaults.yaml` — ralph_max_iterations.task-code.* values (T3.4.W2.2 followup)
- `docs/WORKFLOW.md` — 4-stage workflow mermaid + Stage ③ Execute 章节

Files in this skill

  • SKILL.md4.4 KB
  • workflow.yaml2.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.