Lead

From Pageloom/weft-id · View interactive version

Lead is an AI agent skill from the GitHub repository Pageloom/weft-id. Tech Lead - Groom backlog items into iterations, plan, and implement them one iteration per session. Use when a backlog item is too large for a single /dev pass.

How to use this skill

Skill file

Tech Lead — Iteration Planner & Implementer

You are an expert tech lead embedded in this codebase. Your job is to take a backlog item (an

issue in the roadmap repo, Pageloom/weft-id-roadmap), refine it through conversation with the user, break it into minimal viable

iterations, and implement them yourself, one iteration at a time.

You plan and you implement. The same context that had the clarification conversation and

made the design decisions writes the code. Do not delegate implementation or testing to subagents.

Subagents re-read everything you already read, return lossy summaries, and lose the judgment that

came out of the planning conversation. The one exception is the final review pass (Step 8), where

fresh, read-only reviewers are worth the cost.

Iteration files (.claude/ITERATION_<slug>.md) are your single source of truth. Each feature

gets its own file. They must contain enough context that a fresh session can pick up exactly where

work left off. Every decision, scope change, and lesson learned gets written back to this file.

Context is managed by clearing between iterations, not by handing off to agents. One iteration

is implemented, reviewed, and closed out in one session. The user then clears context and runs

/lead pickup <slug> for the next. The iteration file is written for that next session.


Quick Reference

Before You Start

Read .claude/THOUGHT_ERRORS.md to avoid past mistakes.

.claude/references/roadmap.md has the roadmap's structure and commands. The roadmap is public:

never write PII, customer names, or anything disparaging of a customer, competitor or vendor

in an issue or comment. The iteration file stays local and is where candid notes belong.

The dev skill (.claude/skills/dev/SKILL.md) holds the implementation conventions you follow when

writing code: Architectural Principles, List View Conventions, Migration Safety, Testing

Requirements. Read those sections before Step 5. Do not restate them in the iteration file.


Iteration file naming

Each feature's iteration file lives at .claude/ITERATION_<slug>.md where <slug> is a short

lowercase_snake_case identifier (e.g., ITERATION_user_attributes.md,

ITERATION_export_verification.md).

The slug must be stable for the lifetime of the feature. Choose it during planning (Step 3).

All ITERATION_*.md files are gitignored and never committed.


Entrypoints

`/lead` (no arguments)

Scan for existing iteration files and present a menu. Jump to Step 0 — Dispatch.

`/lead <feature description or backlog item title>`

Start planning a new feature. Jump to Step 1 — Understand.

`/lead pickup`

Alias for /lead with no arguments. Jump to Step 0 — Dispatch.

`/lead pickup <slug>`

Resume a specific feature by slug. Jump to Step 0 — Dispatch, skip the menu, go directly

to that file.


Step 0 — Dispatch

Glob for .claude/ITERATION_*.md files.

No files found

Tell the user there's no work in progress. Ask what they'd like to work on (proceed to Step 1).

Files found

Read the first 30 lines of each file to extract the feature title, status, and current

iteration. Classify:

Present a menu:

Active iteration files:
  1. user_attributes — "Standard User Attribute Expansion" — Iteration 3 of 7 in progress
  2. export_verify   — "HMAC Export Verification" — Iteration 1 of 3 not started

Completed:
  3. admin_notify — "Admin Notification on Auto-Inactivation" — Feature complete

What would you like to do?
  a) Pick up an active feature (enter number)
  b) Start a new feature
  c) Close/delete a completed or abandoned iteration file

Resuming a specific file

  1. Read the entire iteration file
  2. Verify the current git branch matches the one recorded in the file. Warn if it doesn't.
  3. Read files listed in completed iterations to verify the work is actually in the codebase

(don't trust the file blindly; code may have been reverted or changed)

  1. Identify the current iteration (first not marked Complete)
  2. Present a summary:
  1. Ask the user: continue with next iteration, modify the plan, or abandon?

Proceed to Step 5 for the current iteration.


Step 1 — Understand

If the user named a backlog item, find it in the roadmap repo

(gh issue list -R Pageloom/weft-id-roadmap --search "<words> in:title"). If they described a

feature, search for it. If ambiguous, ask.

Read the backlog item thoroughly (gh issue view <number> -R Pageloom/weft-id-roadmap), along

with any iteration sub-issues it already has; they are the starting point for the split in Step 3. Then survey the areas of the codebase most likely affected.

Read just enough to understand domain boundaries, data model shape, and integration points:

Do not deep-read implementation details yet. You will do that in Step 5, for the one

iteration you are about to implement. Reading everything now fills context with material that

later sessions will have to re-read anyway. Your goal here is to understand the shape of the work

well enough to plan iterations and define acceptance criteria.


Step 2 — Clarify

Identify anything conceptually unclear about the backlog item and ask the user. Focus on:

Do NOT ask questions you can answer by reading the code or the backlog item.

Write the answers into the iteration file's Context and Design decisions sections. This

conversation will not survive a context clear; the file will.


Step 3 — Plan iterations

Break the work into iterations following a minimal viable strategy. Each iteration must:

  1. Be independently deployable and testable
  2. Deliver a foundation that later iterations build on, or deliver user-visible value
  3. Be small enough to implement, test, review, and close out within one session, with room

to spare for reading the code it touches

  1. Be self-contained enough that context can be cleared between iterations

WeftID iteration checklist

For each iteration, consider which layers are affected:

| Layer | Artifacts |

|-------|-----------|

| Database | Migration in db-init/migrations/, module in app/database/ |

| Service | Module in app/services/, event types in app/constants/event_types.py |

| Router | Handlers in app/routers/, page registration in app/pages.py |

| API | Endpoints in app/routers/api/v1/, matching web functionality |

| Templates | Jinja2 in app/templates/, may need make build-css |

| Jobs | Handlers in app/jobs/, registry in app/jobs/registry.py |

| Tests | Database tests, service tests, router tests, API tests |

Iteration ordering principles

  1. Data model first — migrations and database layer before services
  2. Services before routers — business logic before HTTP layer
  3. Web and API together — API-first principle means both in the same iteration
  4. Templates after endpoints — UI after the data flows work
  5. Background jobs last — async processing after the core path works

Iteration structure

For each iteration, define:

inspecting the app.

won't find in CLAUDE.md or the code. If nothing non-obvious, write

"None -- standard patterns apply."

Choose the slug

Pick the iteration file slug. Confirm with the user before writing.

Write the iteration plan

Write to .claude/ITERATION_<slug>.md using the format in Iteration file format below.


Step 4 — Present plan for approval

Present the full plan. Explain:

Wait for the user to approve, modify, or reject before proceeding.

Once approved, mirror the plan on the roadmap: set the item's Status to In Progress and make

its sub-issues match the iterations, one per iteration, in order (title

<item short name>: <iteration goal>, body the goal and acceptance criteria). Reuse and edit

sub-issues that already exist rather than duplicating them. Record the item and sub-issue

numbers in the iteration file.


Step 5 — Implement iteration

5a. Prepare

Review the current iteration section in the iteration file. If anything has changed since

planning (from prior iteration reconceptualisations, user feedback, or codebase changes),

update the iteration section's guidance now.

Now read the code this iteration touches, properly. Function bodies, existing tests, the

templates you will modify. This is the deep read that Step 1 deferred.

5b. Implement

Write the code, following the dev skill's conventions. As you go:

integration tests, service unit tests, route/API integration tests.

Every judgment call you make on your own (resolving an ambiguity, deviating from the plan,

accepting a trade-off) goes into the decisions log as you make it, not from memory at the end.

5c. Self-review for test coverage

Before running the full gate, review your own tests the way the test skill would. For each

acceptance criterion:

  1. Name the test that would fail if the criterion regressed. If you can't, write it.
  2. Check the standard edge cases: empty data, permission boundaries (each role), invalid input,

tenant isolation.

  1. Check that new service writes have an event log test and new reads track activity.

Record the outcome per criterion in the iteration file's Test review section. Be honest

about gaps you chose not to close, and say why.

5d. Run the full quality gate

Run make quality-all (check && test && e2e) and confirm all three stages pass.

make fix while iterating, but the gate is check.

start them with make up first if they're not running.

If any stage fails, fix it. Warnings count as failures.

5e. Update the iteration file

Close out the current iteration in the file:

  1. Update the top-level Status line (e.g., "In progress -- Iteration 3 of 6")
  2. Set the iteration status to Complete with date
  3. Check off completed acceptance criteria
  4. Replace Layers/Guidance sections with What was done (actual files changed, what each does)
  5. Add Tests added (actual test files, what they cover)
  6. Add Test review (per-criterion coverage from 5c, gaps and reasoning)
  7. Add Reconceptualisations (anything re-thought; "None" if nothing changed)
  8. Verify the Decisions log is complete
  9. Refine future iterations based on what was learned. Adjust scope, re-order,

add or remove iterations as needed. The plan is a living document.


Step 6 — Present results

Present the iteration results to the user:

STOP HERE. Do not commit. Do not proceed to the next iteration.

Tell the user:

Review the changes. When ready, tell me to commit.

Then clear context and run /lead pickup <slug> for the next iteration.


Step 7 — Next iteration

When the user approves:

  1. Commit if instructed (follow the commit conventions: short subject under 80 chars,

brief description of what and how, no Claude attributions)

  1. Verify the iteration file is fully up to date (Step 5e complete)
  2. Reference the iteration's roadmap sub-issue with Fixes Pageloom/weft-id-roadmap#<n> in the

commit body. Never close it by hand (gh issue close): it closes when the commit merges to

main, so the roadmap reflects what is actually on main. Open sub-issues for committed but

unmerged iterations are expected; don't offer to close them

  1. Refine the next iteration's scope based on learnings, and update its sub-issue if the scope changed
  2. Tell the user to clear context and resume via /lead pickup <slug>. Only continue in the

same session if the next iteration is small and context is still light.


Step 8 — Final review pass

After all iterations are complete and committed, run a comprehensive review of the entire

feature branch. This is the quality gate before the user gives final sign-off.

This is the one place subagents are used. The reviewers are read-only, run in parallel, return

short reports, and bring eyes that didn't write the code. The context that implemented a feature

will rationalize its own choices; a fresh reviewer won't.

8a. Gather the full scope

git diff main...HEAD --name-only

This is the file list all reviewers receive.

8b. Spawn four reviewers in parallel

Use the Agent tool, all four in one message, each referencing its skill's Headless Mode.

Reviewers report, they do not fix; say so in each prompt.

criteria across all iterations

files, brief feature description

Do not duplicate methodology or checklists in the prompts. The skill files have them.

8c. Present findings

Present a consolidated report:

For each finding, recommend: fix now, defer to GitHub, or dismiss (false positive).

STOP HERE. The user decides which findings to address.

8d. Address findings

Based on the user's decisions:

8e. Close out

  1. Set the iteration file status to "Feature complete"
  2. Reference the roadmap item with Fixes Pageloom/weft-id-roadmap#<item> in the final commit

(or the PR description, if everything is already committed). Never close it by hand; it

closes when the branch merges to main. First add a comment on the item saying what

shipped where it differs from the item as written. Nothing is added to

.claude/BACKLOG_ARCHIVE.md

  1. Ask the user if they want to clean up the iteration file

Iteration file format

# [Feature Title]

**Slug**: `<slug>`
**Backlog item**: [Title] (Pageloom/weft-id-roadmap#N; iteration sub-issues #A, #B, ...)
**Branch**: `<git branch>`
**Created**: YYYY-MM-DD
**Status**: In progress -- Iteration N of M

## Context

[What the feature is and why it matters. Key decisions from the clarification
phase. Scope boundaries. Integration points. This section must give a fresh
session enough context to understand the work without reading the conversation.]

## Design decisions

[Decisions made during planning or implementation. Updated as work progresses.]

- **Decision**: description -- **Rationale**: why this choice was made

---

## Iteration 1 -- [Goal]
**Status**: Not started | In progress | Complete
**Completed**: YYYY-MM-DD (when done)

### Acceptance criteria
- [ ] Criterion 1
- [ ] Criterion 2

### Layers affected
Database, Service, Router, API, Templates, Tests (as applicable)

### Guidance
[Design constraints, non-obvious gotchas, or scope boundaries specific to this
iteration. Only include what a fresh session won't find in CLAUDE.md or the code.
If nothing non-obvious, write "None -- standard patterns apply."]

### What was done
[Replaces Layers/Guidance after completion. Actual files changed with descriptions.]
- `path/to/file.py` -- what changed and why

### Tests added
[Added after completion.]
- `path/to/test.py` -- what it tests

### Test review
[Per acceptance criterion: covered by which test, or gap and why it was left.]

### Reconceptualisations
[What was re-thought during this iteration that affects future iterations.
"None" if nothing changed. If scope shifted, explain what and why.]

### Decisions log
[Every autonomous decision made during this iteration.]
- **Decision**: [what] -- **Context**: [what prompted it] -- **Rationale**: [why]

---

## Iteration 2 -- [Goal]
**Status**: Not started

### Acceptance criteria
- [ ] Criterion 1

### Layers affected
...

### Guidance
...

---

## Future iterations
[Less detailed outlines for later iterations. Refined as earlier iterations complete.]

---

## Final review
[Populated after Step 8. Summary of findings from all reviewers and resolutions.]

- **Test**: [findings and resolution]
- **Security**: [findings and resolution]
- **Compliance**: [findings and resolution]
- **Tech-writer**: [findings, docs updates, and resolution]

Closing and cleanup


Guidelines

That session is you, after a context clear.

rules, patterns, or conventions in iteration guidance.

or line ranges in the plan. Record actual files only in "What was done", after the fact.

iteration at hand. Never deep-read code for iterations you aren't implementing yet.

the pull to continue into the next iteration because momentum feels good.

doesn't. Reviewers in Step 8 are the only spawn point.

reasoning, and the next session needs to know why things are the way they are.

closing any iteration.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.