skills/code-spec-backfill/SKILL.md
Backfill function-level contracts (docstrings, type annotations) where missing. Report unresolvable gaps with misuse scenarios. Incremental by default (state-driven).
npx skillsauth add liza-mas/liza code-spec-backfillInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
STATE_FILE = specs/.code-spec-backfill/state.yaml tracks per-file review freshness:
Constructive first, diagnostic second. Write the contract where you can infer it. Report what you can't resolve.
Only act on a gap if you can write a plausible incorrect usage that a senior engineer might write based on the function's public interface. The misuse scenario IS the quality gate — if no one would get burned, it's not a gap worth addressing.
Misuse scenario format: [caller_assumption] × [actual_behavior] → [consequence]
Example: "Returns empty list when no results" × "Raises NoResultError" → "Caller crashes on valid empty-result case"
A docstring that restates the function signature adds no value. Do not write docstrings that merely echo parameter names, types, or the function name as prose.
Tautological (do not write):
def get_user(user_id: int) -> User:
"""Get a user by user ID.
Args:
user_id: The user ID.
Returns:
The user.
"""
Valuable (write this):
def get_user(user_id: int) -> User:
"""Fetch user from database. Raises UserNotFoundError if no user exists
with this ID. Result is cached for the duration of the request."""
The test: does the docstring tell you something you couldn't already read from the signature? If not, skip it.
Adequate (skip):
Gap (apply core heuristic):
-> float but sometimes returns None)| Mode | Trigger | Behavior |
|------|---------|----------|
| Incremental (default) | no flags | State-driven: detect stale + unreviewed, batch of 10 |
| Files | --files <path> or --module <dir> | Targeted audit, ignores state |
version: 1
last_run: 2026-02-20
files:
internal/blackboard/lock.go:
sha: a1b2c3d
reviewed: 2026-02-15
status: current # current | stale | unreviewed
internal/agent/builder.go:
sha: e4f5g6h
reviewed: 2026-02-15
status: stale # file changed since review
internal/cli/init.go:
status: unreviewed # new file, never analyzed
1. UPDATE STATE
- git log since last_run → list touched files
- New files → add as "unreviewed"
- Changed files (SHA differs) → mark "stale"
- Deleted files → remove from state
- If no stale/unreviewed files → report "all current" and stop
2. SELECT BATCH
- Pick up to 10 stale/unreviewed files (stale first — regressions before new ground)
- List batch to user before proceeding
3. FOR EACH FILE IN BATCH
- List public callables
- For each target: assess spec clarity (adequate or gap)
- If adequate → skip
- If gap → apply core heuristic (write misuse scenario)
- Can't write misuse scenario → not a real gap, skip
4. FOR EACH CONFIRMED GAP — decide path:
a. Can infer contract from code + call sites + tests?
→ BACKFILL: write docstring and/or fix type annotations
→ Apply no-tautology rule — skip if docstring would only restate signature
→ If inferred from code body only (no call sites, no tests): flag ⚠️ for review
b. Behavior is ambiguous (multiple valid interpretations)?
→ REPORT: record gap with misuse scenario in report
5. OUTPUT
- Backfilled: docstrings/annotations added to source files
- Reported: unresolvable gaps per references/report-format.md
6. UPDATE STATE
- Set reviewed files to status: current, sha: current HEAD sha, reviewed: today
- Report remaining stale/unreviewed count
- Ask user to review backfilled changes
1. List public callables in specified paths
2–5. Same as incremental steps 3–5 (assess → backfill/report → output)
State file is not consulted or updated in Files mode.
For feature-level specifications (product specs, user stories), use the spec-backfill skill instead.
80% of targets flagged as gaps → pause, heuristic may be too loose
specification-gap findings. This skill resolves them — natural pipeline: white-box finds gaps → code-spec-backfill backfills or reports.development
Coordinate Pairing-mode doer/reviewer sessions through a Markdown blackboard. Use when the user invokes /adversarial-pairing with role and blackboard-path arguments or asks multiple pairing agents to coordinate plan review, implementation, staged code review, and follow-up review rounds without Liza multi-agent mode.
data-ai
Analyze Liza agents logs
development
Code Review Protocol
tools
Analyze Liza `.liza/agent-prompts/` and `.liza/agent-outputs/` from a context-engineering perspective: prompt payload shape, context budget use, cacheability, duplicated or missing context, instruction hierarchy, tool-output pressure, role-specific context fit, and prompt-output feedback loops. Use when diagnosing agent context bloat, prompt drift, poor agent handoffs, repeated misunderstandings, excessive tool output, or whether Liza agents received the right information at the right time.