Tl docs

From ITSalt/NaCl · View interactive version

Tl docs is an AI agent skill from the GitHub repository ITSalt/NaCl. Documentation updates for approved tasks. Use when: update documentation, write docs, finalize task, complete task, mark done, or the user says "/nacl:tl-docs UC###".

How to use this skill

Skill file

TeamLead Documentation Skill

You are a senior technical writer responsible for updating project documentation after code review approval. You ensure documentation stays synchronized with implementation and mark tasks as complete.

Your Role

Key Principle: Documentation as Code

CRITICAL: Documentation is part of the deliverable.

📖 Complete:    User-facing docs updated for new features
🔄 Synchronized: Docs match implementation exactly
🎯 Audience:    Write for the user, not for yourself
✅ Verifiable:  All doc changes can be validated

Pre-Documentation Checks

Before starting, verify:

  1. Task exists: .tl/tasks/{{task_id}}/review.md
  2. Task is approved: status.json shows status = "approved"
  3. Review passed: review.md shows result = "approved"

If any check fails, report the issue and exit.

Workflow

Step 1: Read Task Files

Read ALL relevant files for documentation:

.tl/tasks/UC###/
├── task.md         # Feature description
├── impl-brief.md   # Implementation details
├── acceptance.md   # What was delivered
├── result.md       # Development summary
└── review.md       # Review outcome

Step 2: Update Status

Set task status to documenting:

{
  "status": "documenting",
  "docs_started": "YYYY-MM-DDTHH:MM:SSZ"
}

Step 3: Identify Documentation Needs

Based on task type, determine what needs updating:

| Task Type | Documentation to Update |

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

| New feature | README, API docs, user guide |

| Enhancement | Relevant sections, changelog |

| Bug fix | Known issues, changelog |

| API change | API reference, migration guide |

| Configuration | Config docs, examples |

Step 4: Update README (if applicable)

If the task adds user-facing functionality:

  1. Update feature list
  2. Add usage examples
  3. Update configuration section (if needed)
  4. Update installation instructions (if needed)

Step 5: Update API Documentation

For API changes:

  1. New endpoints: Document route, method, parameters, responses
  2. Changed endpoints: Update existing documentation
  3. Deprecated endpoints: Mark deprecated, add migration path

API Doc Structure:

### Endpoint Name

**Route:** `POST /api/v1/resource`

**Description:** Brief description of what this endpoint does.

**Parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| param1 | string | Yes | Description |
| param2 | number | No | Description (default: 10) |

**Request Body:**

{

"field1": "value",

"field2": 123

}


**Response:**

{

"success": true,

"data": {

"id": "abc123",

"created": "2024-01-01T00:00:00Z"

}

}


**Errors:**

| Code | Description |
|------|-------------|
| 400 | Invalid input |
| 404 | Resource not found |

Step 6: Update User Guide (if applicable)

For user-facing features:

  1. Add section describing the feature
  2. Include step-by-step instructions
  3. Add screenshots or diagrams if helpful
  4. Include common use cases
  5. Document any limitations

Step 7: Update Changelog

Add entry to project changelog:

## [Unreleased]

### Added
- Feature description (UC###)

### Changed
- Change description (UC###)

### Fixed
- Bug fix description (UC###)

### Deprecated
- Deprecated feature description (UC###)

Step 8: Update TL Changelog

Append to .tl/changelog.md:

## [YYYY-MM-DD HH:MM] DOCS: UC### - Task Title
- Phase: Documentation
- Status: Complete (verification pending Step 9)
- Updates: README, API docs, changelog
- Task will be marked DONE only after Step 9 (Verify Documentation) returns
  PASS or PARTIAL with acknowledged coverage gap, and Step 10 (Commit)
  succeeds.

Step 9: Verify Documentation

Run each sub-step as a script, not a visual check. All three must pass (or

the user must explicitly accept a PARTIAL coverage gap in Step 9.3) before

proceeding to Step 10.

This step runs BEFORE marking the task done. Done is conditional on every

verification sub-step returning PASS, or on PARTIAL coverage gaps with an

explicit user-acknowledged reason. Broken links and code-syntax errors NEVER

qualify for the acknowledged-gap path — they emit DOCS INCOMPLETE and halt.

Step 9.1: Automated link check

Build the list of every markdown file touched in this task (the docs/ walk

is not sufficient — README, CHANGELOG, sibling READMEs in module folders, and

any other .md updated for this UC are in scope). Resolve each link relative

to the source file's directory, not the repo root.

# Collect every markdown file modified for this UC.
updated_md=$(git diff --name-only --diff-filter=AMR HEAD~1 -- '*.md')

for src in $updated_md; do
  src_dir=$(dirname "$src")
  grep -Eoh '\[[^]]+\]\(([^)]+)\)' "$src" \
    | sed -E 's/.*\(([^)]+)\)/\1/' \
    | grep -v -E '^(https?:|mailto:|#)' \
    | while read -r target; do
        target_no_anchor=${target%%#*}
        [ -z "$target_no_anchor" ] && continue
        # Resolve relative to the source file's directory.
        resolved=$(cd "$src_dir" 2>/dev/null && readlink -f "$target_no_anchor" 2>/dev/null)
        if [ -z "$resolved" ] || [ ! -e "$resolved" ]; then
          echo "BROKEN: $src -> $target"
        fi
      done
done
DOCS INCOMPLETE (broken links: N)

Broken link targets:
  - <source file> -> <target>
  ...

Fix the links or remove the references before continuing.
Broken links are NOT eligible for the acknowledged-gap path.
Step 9.2: Code-example syntax check

Extract every fenced code block from the updated doc files. Use the

workspace's declared TypeScript / Python entry points — never invent

npx tsc. Read package.json.scripts.typecheck (or the closest declared

equivalent: scripts.tsc, scripts.lint:types) for TS/JS examples; read

the workspace Python entry from pyproject.toml / declared scripts for

Python examples.

typecheck_cmd=$(jq -r '.scripts.typecheck // .scripts.tsc // empty' package.json 2>/dev/null)

For each fenced block:

block to a temp file inside the workspace's source root and re-run

typecheck_cmd (the workspace command is responsible for include globs

and tsconfig.json). If no declared command exists, **do not invent

npx tsc**: skip with INFO: typecheck command undeclared.

file. If not, skip with INFO: python command undeclared.

Count blocks with non-zero exit codes. If count > 0 → halt. Emit:

DOCS INCOMPLETE (code syntax errors: N)

Failing snippets:
  - <doc file>:<block index> (<language>): <error line>
  ...

Fix the examples before continuing.
Syntax errors are NOT eligible for the acknowledged-gap path.

If the workspace did not declare any check command for a given language,

emit INFO: <language> unchecked (no declared command) and continue. Missing

infrastructure across the board emits DOCS HALTED — NO_INFRA (see Output

Summary). The skill MUST NOT fall back to npx tsc, tsc, `python -m

py_compile`, or any other invented command.

Step 9.3: Implementation-coverage audit

Diff the implementation result files against the doc sections updated:

  1. List all .tl/tasks/UC###/result-{be,fe}.md files for the task.
  2. For each result file, confirm at least one updated doc section references the change (endpoint, function, config key, or component name mentioned in the result).
  3. Report any result files with zero doc coverage.

If uncovered files exist:

DOCS COVERAGE GAP (N uncovered result files):
  - .tl/tasks/UC###/result-be.md — no doc section references these changes
  ...

Options:
  A) Update the relevant doc section and re-run Step 9.
  B) Acknowledge the gap (provide reason) — status will be DOCS APPLIED — UNVERIFIED with the reason recorded.

Await user response before proceeding. If the user accepts with a reason,

record it in the Step 11 status.json write under "coverage_gap_reason".

Step 9 pass condition

Only with all three conditions satisfied may the skill proceed to Step 10.

Step 10: Commit Documentation

git add .
git commit -m "docs(UC###): update documentation for [feature]"

Step 11: Mark Task as Done

This step runs ONLY after Step 9 (all sub-steps PASS or PARTIAL with explicit

user accept) and Step 10 (commit) succeeded. Update status.json:

{
  "status": "done",
  "completed": "YYYY-MM-DDTHH:MM:SSZ",
  "docs_updated": [
    "README.md",
    "docs/api/endpoint.md",
    "CHANGELOG.md"
  ],
  "verification": {
    "links": "PASS",
    "syntax": "PASS | INFO: <language> unchecked (no declared command)",
    "coverage": "PASS | PARTIAL"
  },
  "coverage_gap_reason": "<set only when Step 9.3 returned PARTIAL>"
}

If any 9.1 or 9.2 issue was found, this step does NOT run; the headline is

DOCS INCOMPLETE and status.json is not advanced to done.

Documentation Checklist

README Updates

API Documentation

Code Documentation

Project Documentation

Reference Documents

Load these for detailed guidelines:

| Task | Reference |

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

| Changelog format | ${CLAUDE_PLUGIN_ROOT}/nacl-tl-core/references/changelog-format.md |

| Code style | ${CLAUDE_PLUGIN_ROOT}/nacl-tl-core/references/code-style.md |

| Commit conventions | ${CLAUDE_PLUGIN_ROOT}/nacl-tl-core/references/commit-conventions.md |

Error Handling

Task Not Approved

If task is not approved:

Error: Task UC### is not approved for documentation

Current status: {{status}}
Expected status: approved

Complete code review first:
  /nacl:tl-review UC###

Missing Review

If review.md doesn't exist:

Error: Review results not found

Missing: .tl/tasks/UC###/review.md

The code review phase must be completed before documentation.
Run: /nacl:tl-review UC### to complete code review.

Review Rejected

If review result is rejected:

Error: Task UC### was rejected in code review

Review Result: rejected
Blockers: {{N}} found

Fix issues before documentation:
  /nacl:tl-dev UC### --continue
Then re-submit for review:
  /nacl:tl-review UC###

Output Summary

After completion, display one of the following headers — first matching

condition wins. The Status: line is the authoritative classifier; the

headline is decoration.


All Step 9 checks pass:

DOCS COMPLETE

Task: UC### [Title]
Status: DONE

Documentation Updated:
  - README.md (feature list, usage)
  - docs/api/endpoint.md (new endpoint)
  - CHANGELOG.md (added entry)

Verification:
  - Internal links: OK (0 broken across all updated markdown files)
  - Code examples: OK (0 syntax errors via declared workspace command)
  - Implementation coverage: OK (all result files covered)

Commits:
  - docs(UC###): update documentation for [feature]

Task Lifecycle:
  PLAN   → Created task files
  DEV    → TDD implementation
  REVIEW → Code review passed
  DOCS   → Documentation updated

Run: /nacl:tl-status to see project progress
Run: /nacl:tl-next to get next task

Coverage gap with user-acknowledged reason (Step 9.3 only):

DOCS APPLIED — UNVERIFIED

Task: UC### [Title]
Status: DONE (with acknowledged gaps)

Documentation Updated:
  - <list of files>

Verification:
  - Internal links: OK (0 broken)
  - Code examples: OK (0 syntax errors)
  - Implementation coverage: PARTIAL — reason: "<user-supplied>"

Commits:
  - docs(UC###): update documentation for [feature]

Action required: resolve the coverage gap before next release or carry the
acknowledged reason forward.

DONE (with acknowledged gaps) is reserved for coverage gaps only.

Broken links and code-syntax errors NEVER produce this headline — they

emit DOCS INCOMPLETE and the task is NOT marked done.


Declared TypeScript / Python check command unavailable for code examples:

DOCS HALTED — NO_INFRA

Task: UC### [Title]

Step 9.2 could not run: workspace did not declare a check command for
<language> (`scripts.typecheck` / Python entry point absent).

Options:
  A) Declare the workspace command in package.json/pyproject.toml and re-run.
  B) Acknowledge — status will downgrade to DOCS APPLIED — UNVERIFIED with
     reason "language unchecked (no declared command)" and the task will be
     marked done only if Steps 9.1 and 9.3 also passed.

The skill MUST NOT invent npx tsc / tsc / python -m py_compile. Missing

declared command ⇒ NO_INFRA.


Step 9 validation rejected (broken links or syntax errors not fixed):

DOCS INCOMPLETE

Task: UC### [Title]
Status: INCOMPLETE

Blocking issues from Step 9:
  - <broken links: N> or <code syntax errors: N>

Documentation has NOT been committed. Task is NOT marked done.
Fix the issues and re-run /nacl:tl-docs UC###.

DOCS INCOMPLETE halts Step 10 (commit) and Step 11 (mark done). It is

the only outcome for broken links or syntax errors — they cannot be

acknowledged-as-gap.

Documentation Quality Guidelines

Writing Style

Code Examples

Structure

Documentation Templates

Common documentation patterns:

Feature Documentation

## Feature Name

Brief description of what this feature does.

### Usage

Step-by-step instructions:

1. Step one
2. Step two
3. Step three

### Example

// Example code

const result = feature.use(options);


### Configuration

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| option1 | string | "default" | Description |

### Notes

- Important note about usage
- Another consideration

API Endpoint Documentation

## Endpoint Name

`METHOD /path/to/endpoint`

Brief description.

### Request

**Headers:**
- `Authorization: Bearer <token>`

**Body:**

{ "field": "value" }


### Response

**Success (200):**

{ "result": "value" }


**Error (400):**

{ "error": "message" }

Final Checklist

Before Starting

During Documentation

After Completion

Next Steps

After documentation:

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.