agentleFS
Rafaelrr5Rafaelrr5/agent-cortex/skills/delegate-coding-task/SKILL.md

delegate-coding-task

Skill1 starsChanged 37 days agoMITView on GitHub

Use when handing a coding task to another agent. Fence the scope, verify the result.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Don't use for: research, writing, analysis, or config of the orchestrator itself.

    line 26
  2. Distinctive:

    Put it in a file, not on the command line: a multi-paragraph prompt does not survive shell quoting, and a file is the artifact you cite …

    line 45
  3. Distinctive:

    Do not restate what the repo's own AGENTS.md / CLAUDE.md already says.

    line 59
  4. Distinctive:

    Prefer print/headless mode with the prompt on stdin.

    line 64
  5. Distinctive:

    Strip inherited credentials from the child's environment: when the project exports them for a different purpose.

    line 72
  6. Distinctive:

    Run all of these. Each one catches a different class of lie:

    line 85
  7. Distinctive:

    One repo, two agents: only with disjoint file lists: Put the other agent's paths in each prompt's MUST NOT list.

    line 105
  8. Distinctive:

    "Tested" without a command is not tested: Ask for the command and its output in the report, then re-run it yourself.

    line 115
  9. Distinctive:

    The prompt file is the audit trail: Keep it. When the result is wrong, the first question is always whether the contract was wrong.

    line 127

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Delegate a coding task

Hand a bounded coding task to a second agent (Claude Code, Codex, OpenCode, any CLI that takes a prompt and edits a repo), then verify what came back before you believe any part of it.

The hard part is not launching the agent. It is that an agent's closing message is a self-report, not evidence. "Implemented and tested" routinely means one file written and nothing run. This skill is the fence you put around the work and the checks you run after.

When to Use

  • A task involves writing, editing, refactoring, debugging or testing code in a repository, and you are not the one typing.
  • You are running several independent workstreams and want them in parallel.
  • Don't use for: research, writing, analysis, or config of the orchestrator itself. Those have no repo to fence and no diff to verify.

Step 1 — Decide if the task is delegable at all

A delegable task has all four:

PropertyTest
Boundedyou can name the files it may touch
Verifiablethere is a command whose output proves it worked
Reversibleworst case is a bad diff on a branch, not a deploy
Self-containedit does not need a decision only the user can make

Missing any one of these, do it yourself or go back to the user. A task delegated without a verification command is not delegated, it is abandoned.

Step 2 — Write the prompt as a contract

Put it in a file, not on the command line: a multi-paragraph prompt does not survive shell quoting, and a file is the artifact you cite later. The contract has six parts, in this order:

  1. Goal in one sentence, stated as an outcome, not an activity.
  2. Files it MAY touch, explicit paths.
  3. Files it MUST NOT touch — name the ones another agent or the user is working in right now. Without this line, concurrent work gets clobbered.
  4. Definition of done, as a command plus the expected output.
  5. Stop condition: "if the fix requires changing a file outside the allowed list, stop and report instead of widening the scope."
  6. Forbidden operations: no git add -A, no commit, no push, no dependency install, unless explicitly asked.

Do not restate what the repo's own AGENTS.md / CLAUDE.md already says. The agent loads it; repeating it wastes context and creates two sources of truth.

Step 3 — Launch non-interactively

Prefer print/headless mode with the prompt on stdin. An interactive window is for when the user actually wants the keyboard.

# prompt via stdin survives any length and any quoting
cat task.md | claude -p --permission-mode acceptEdits

Strip inherited credentials from the child's environment when the project exports them for a different purpose. A subprocess that inherits ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN or ANTHROPIC_BASE_URL from a repo .env will silently talk to the wrong endpoint, bill the wrong account, or fail with an auth error that looks like a bug in your prompt.

env = {k: v for k, v in os.environ.items()
       if k not in ("ANTHROPIC_API_KEY", "ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_BASE_URL")}

Step 4 — Verify against the tree, never against the report

Run all of these. Each one catches a different class of lie:

git -C <repo> status --porcelain      # did it touch what it said, and only that?
git -C <repo> diff --stat             # is the size plausible for the claim?
git -C <repo> log --oneline -5        # did it commit when told not to?
<the repo's own test command>         # does the claimed test actually pass?

Then read the diff of at least the file carrying the core claim. A green test suite that never exercised the new path is the most common false positive: check that the test names in the output actually mention the behaviour.

Divergence between the report and the tree is a finding, not a formality. The tree wins, and the divergence goes in what you tell the user.

Parallelism

Independent tasks run concurrently. The constraints:

  • One repo, two agents: only with disjoint file lists. Put the other agent's paths in each prompt's MUST NOT list.
  • One verification process per repo. Fanning out several heavy test/build runs in the same checkout causes resource contention that reports itself as a timeout, and you will debug the wrong thing.
  • Never let two agents share a branch. One branch each, or one worktree each.

Pitfalls

  • "Tested" without a command is not tested. Ask for the command and its output in the report, then re-run it yourself.
  • A silent success is usually a blocked start. A launcher that needs an approval prompt, a trust dialog, or an executable bit will hang, not fail. Confirm from real output that the process actually started before reporting that you delegated anything.
  • An agent developing against a dirty tree writes code that compiles only there. Its work depends on someone else's uncommitted changes, which is invisible in the diff. Build it from a clean checkout before shipping.
  • Widening scope mid-task is the default failure mode. Without an explicit stop condition, an agent asked to fix one function will refactor the module and you will review the wrong diff.
  • The prompt file is the audit trail. Keep it. When the result is wrong, the first question is always whether the contract was wrong.

Verification

The run succeeded when: the diff touches only allowed paths; the definition-of- done command was run by you and passed; nothing was committed or pushed that you did not ask for; and every claim you repeat to the user is one you saw in real output.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.