Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions template/.claude/hooks/post-edit-markdown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,24 @@ if echo "$FILE_PATH" | grep -qE '(^|/)docs/'; then
exit 0
fi

# Files under tasks_summary/ are allowed (SDLC workflow summaries)
if echo "$FILE_PATH" | grep -qE '(^|/)tasks_summary/'; then
exit 0
fi

# ── Violation ──────────────────────────────────────────────────────────────
echo "┌─ Markdown placement violation: $FILE_PATH"
echo "│"
echo "│ RULE: Markdown files produced during agent workflows or analysis"
echo "│ MUST be written inside the docs/ folder."
echo "│ MUST be written inside the docs/ or tasks_summary/ folder."
echo "│"
echo "│ Allowed exceptions:"
echo "│ • README.md (anywhere)"
echo "│ • CLAUDE.md (anywhere)"
echo "│ • README.md (anywhere)"
echo "│ • CLAUDE.md (anywhere)"
echo "│ • docs/** (any depth)"
echo "│ • tasks_summary/** (SDLC workflow summaries)"
echo "│"
echo "│ Action required: delete this file and recreate it under docs/."
echo "│ Action required: delete this file and recreate it under docs/ or tasks_summary/."
echo "└─"

exit 0
16 changes: 12 additions & 4 deletions template/.claude/hooks/pre-write-doc-file-warning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,26 @@ if echo "$FILE_PATH" | grep -qE '(^|/)docs/'; then
exit 0
fi

# Files under tasks_summary/ are allowed (SDLC workflow summaries)
if echo "$FILE_PATH" | grep -qE '(^|/)tasks_summary/'; then
echo "$INPUT"
exit 0
fi

# ── Violation — block the write ───────────────────────────────────────────────
echo "┌─ BLOCKED: Markdown placement violation" >&2
echo "│" >&2
echo "│ Attempted path: $FILE_PATH" >&2
echo "│" >&2
echo "│ RULE: Markdown files produced during workflows or analysis must" >&2
echo "│ be written inside the docs/ folder." >&2
echo "│ be written inside the docs/ or tasks_summary/ folder." >&2
echo "│" >&2
echo "│ Allowed exceptions:" >&2
echo "│ • README.md — anywhere" >&2
echo "│ • CLAUDE.md — anywhere" >&2
echo "│ • README.md — anywhere" >&2
echo "│ • CLAUDE.md — anywhere" >&2
echo "│ • docs/** — any depth" >&2
echo "│ • tasks_summary/** — SDLC workflow summaries" >&2
echo "│" >&2
echo "│ Action: recreate the file under docs/ — e.g. docs/$(basename "$FILE_PATH")" >&2
echo "│ Action: recreate the file under docs/ or tasks_summary/" >&2
echo "└─" >&2
exit 2
49 changes: 42 additions & 7 deletions template/.claude/skills/sdlc-workflow/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ current, `○` for upcoming.

```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SDLC ○DESIGN ○RED ○GREEN ○REFACTOR ○QUALITY ○SECURE ○DOCS ○COMMIT ○PR
SDLC ○DESIGN ○RED ○GREEN ○REFACTOR ○QUALITY ○SECURE ○DOCS ○COMMIT ○PR ○SUMMARY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```

Expand All @@ -54,6 +54,7 @@ Stage Name Model Execution Sub-skills
6 DOCUMENTATION Haiku Agent (parallel) python-docstrings, markdown
7 COMMIT + CHANGELOG Haiku Agent (sequential) (inline guidance)
8 PULL REQUEST Haiku Agent (sequential) prepare_pr
9 SUMMARY Haiku Agent (sequential) (task_summary_template.md)
```

Conditional stages (2.5, 3.5) only activate when flagged in task YAML.
Expand All @@ -68,9 +69,10 @@ Conditional stages (2.5, 3.5) only activate when flagged in task YAML.
3. Run `just preflight TASK_ID` to execute pre-flight checks.
4. This project uses `just test` for tests and `just ci` for full CI.
5. Explore the codebase: `pyproject.toml`, `conftest.py`, existing tests, target modules.
6. Create `task_channel/task_TASK_ID/` directory for persistent artifacts.
6. Create `tasks_summary/` directory if it does not exist (`mkdir -p tasks_summary`).
7. Output: requirement summary, acceptance criteria list, files that will change.
8. Get user approval before proceeding.

Proceed automatically to Stage 0.5.

---

Expand All @@ -95,8 +97,7 @@ Gate: all pre-flight checks pass. No user approval needed.
- Name: `test_<behaviour>_when_<condition>`
- Structure: AAA (Arrange-Act-Assert)
- Every test file must set `pytestmark = pytest.mark.<marker>` at module level.
4. Show draft to user, wait for approval.
5. Write the test file(s).
4. Write the test file(s).
6. Run `just test`. Classify the failure:

| Failure type | Meaning | Action |
Expand All @@ -121,8 +122,7 @@ Do not proceed until RED is confirmed for all acceptance criteria.
- Include type annotations on all public functions.
- If logging is involved, follow the structlog guidelines in `CLAUDE.md`
(see "Structured logging" and "Mandatory `logging_manager` usage" sections).
2. Show draft, wait for approval.
3. Write implementation.
2. Write implementation.
4. Run `just test`. All tests must pass.
5. Check coverage: `just coverage`. New code should be fully covered.
- If coverage below 85%, write targeted tests for the uncovered lines
Expand Down Expand Up @@ -256,6 +256,39 @@ Report: PR URL and title.

---

## Stage 9 — SUMMARY: Write task summary

**Model:** Haiku (Agent call, sequential after stage 8)

```
Using the task_summary_template.md from .claude/skills/sdlc-workflow/assets/templates/task_summary_template.md:

1. Create the tasks_summary/ directory if it does not already exist:
mkdir -p tasks_summary

2. Collect the following values from pipeline outputs:
- task_id, title, type, status, owner from the task YAML
- target_branch from `git branch --show-current`
- commit_hash from `git log -1 --format=%h`
- pr_url from Stage 8 output
- date: today's date (ISO 8601)
- stage-by-stage results: test counts, coverage %, lint/type/security findings, refactor changes

3. Fill every {{placeholder}} in the template with the collected values.

4. Write the completed document to:
tasks_summary/TASK_ID_summary.md
where TASK_ID is the actual task ID from the YAML.

5. Print the path of the written file.

Report: path of written summary file.
```

Gate: file exists at `tasks_summary/TASK_ID_summary.md`.

---

## Error handling

| Stage | On failure |
Expand All @@ -265,6 +298,7 @@ Report: PR URL and title.
| 4-6 (parallel) | Each retries up to 3 times independently. Others continue. |
| 7 (COMMIT) | CI fix loop, max 3 iterations. Then stop + report. |
| 8 (PR) | Report error. Provide PR body for manual creation. |
| 9 (SUMMARY) | Log warning. Do not fail the pipeline — PR is already merged. |

---

Expand Down Expand Up @@ -296,6 +330,7 @@ When TASK.md has several acceptance criteria:
| Definition of Ready validator | [scripts/validate_dor.py](scripts/validate_dor.py) |
| Task YAML starter template | [assets/templates/task_template.yaml](assets/templates/task_template.yaml) |
| Task summary starter template | [assets/templates/task_summary_template.md](assets/templates/task_summary_template.md) |
| Task summary output location | `tasks_summary/TASK_ID_summary.md` (repo root) |

## Support scripts

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ sort_commits = "newest"
# Clean commit messages

commit_preprocessors = [
{ pattern = "\(#[0-9]+\)", replace = "" }, # remove PR numbers
{ pattern = "\s+", replace = " " }, # normalize whitespace
{ pattern = "\\(#[0-9]+\\)", replace = "" }, # remove PR numbers
{ pattern = "\\s+", replace = " " }, # normalize whitespace
]

# ----------------------
Expand Down
Loading