# SkillFoundry v5.3.0 Release Notes

**Release Date:** 2026-04-16
**Codename:** Hook Enforcement

---

## Overview

v5.3.0 adds a production hook system that enforces coding discipline at the Claude Code tool level. Three hooks — GateGuard, Config Protection, and Session Quality Report — prevent common AI agent failure modes before they reach your codebase.

This release was inspired by workflow patterns from the `everything-claude-code` project, adapted and integrated into SkillFoundry's existing settings and hooks architecture.

---

## New Features

### GateGuard — Force-Read-Before-Edit

The #1 cause of AI-generated bugs is agents modifying files they haven't inspected. GateGuard blocks Edit/Write on any file the agent hasn't Read in the current session.

- **How it works:** A PostToolUse hook on Read records every file path. A PreToolUse hook on Edit/Write checks the record before allowing modifications.
- **Exempt:** New file creation (Write to a path that doesn't exist yet) is always allowed.
- **Enforces:** The Frontend-Backend Contract Rule from CLAUDE.md — "BEFORE writing ANY frontend API call, READ the actual backend endpoint code."

### Config Protection — Linter/Formatter Shield

When agents can't satisfy a linter rule, they often change the rule instead of fixing the code. Config Protection blocks this.

- **Protected files (30+):** `.eslintrc*`, `eslint.config.*`, `.prettierrc*`, `prettier.config.*`, `tsconfig*.json`, `biome.json`, `.stylelintrc*`, `.editorconfig`, `ruff.toml`, `.flake8`, `mypy.ini`, `.pylintrc`
- **Override:** The agent must ask the user for explicit approval when a genuine config update is needed (e.g., adding a new ESLint plugin).

### Session Quality Report — Batch Check at Session End

Instead of checking every edit in real time, the accumulator collects all edited files and runs a batch quality check when the session ends.

- **Tracks:** `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`, `.cjs`, `.py`, `.css`, `.scss`, `.less`, `.json`
- **Checks:** Prettier formatting, TypeScript type errors (`tsc --noEmit`), Ruff lint (Python)
- **Non-blocking:** Reports issues but doesn't prevent session end

### Session Lifecycle Management

- **SessionStart hook** clears stale state files from previous sessions
- All state files are ephemeral (stored in `.claude/hooks/state/`, gitignored)

---

## Files Added

| File | Purpose |
|------|---------|
| `.claude/hooks/gateguard.sh` | PreToolUse: blocks unread file edits |
| `.claude/hooks/track-reads.sh` | PostToolUse: records Read file paths |
| `.claude/hooks/config-protect.sh` | PreToolUse: blocks config file changes |
| `.claude/hooks/accumulate-edits.sh` | PostToolUse: logs edited file paths |
| `.claude/hooks/batch-check.sh` | Stop: runs batch lint/typecheck |
| `.claude/hooks/session-cleanup.sh` | SessionStart: clears stale state |

## Files Modified

| File | Change |
|------|--------|
| `.claude/settings.json` | Added SessionStart, PostToolUse, and Stop hook configurations |
| `.gitignore` | Added `.claude/hooks/state/` |
| `.version` | 5.2.0 -> 5.3.0 |
| `package.json` | 5.2.0 -> 5.3.0 |
| `sf_cli/package.json` | 5.2.0 -> 5.3.0 |
| `mcp-server/package.json` | 5.2.0 -> 5.3.0 |
| `README.md` | Updated "What's New" section and version badge |
| `CHANGELOG.md` | Added v5.3.0 entry |
| `sf_cli/src/core/banner.ts` | Added hooks count to banner stats |
| `site/index.html` | Updated version badge, hero description, footer |
| `site/pages/resources-changelog.html` | Updated version references |

---

## Upgrade Notes

- **No breaking changes.** All hooks are additive.
- Hooks require `jq` on the system PATH (standard on most Linux/macOS).
- State directory `.claude/hooks/state/` is created automatically on first use.
- To disable hooks temporarily: set `"disableAllHooks": true` in `.claude/settings.json`.
