decode_tools / CLAUDE.md
hemsby's picture
gates: sync to final DECODE hardening pattern
c2771d8
|
Raw History Blame Contribute Delete
6.08 kB

A newer version of the Streamlit SDK is available: 1.67.0

Upgrade

CLAUDE.md

Session-start: ensure required plugins are installed

At the start of any new session in this repo, run /plugin marketplace list. If claude-plugins-official is not listed, install the four required plugins:

/plugin marketplace add anthropics/claude-plugins-official
/plugin install feature-dev@claude-plugins-official
/plugin install code-simplifier@claude-plugins-official
/plugin install claude-md-management@claude-plugins-official
/plugin install superpowers@claude-plugins-official

One-time per user per machine. feature-dev provides the code-reviewer subagent referenced by the reviewer procedure (and code-architect for plan review). Without feature-dev installed, every commit touching source code will be blocked by the commit-msg gate.

Subsequent sessions refresh plugins automatically.

Reviewer procedure

Triggered by the Stop hook when the session modified substantive files and no fresh .decode-reviewer-clean marker exists. The Stop hook blocks session end and points the model back to this procedure. Steps, in order:

  1. Run git diff HEAD via Bash.
  2. Dispatch feature-dev:code-reviewer via the Agent tool. Pass the diff as context. Instruct: review only the changes, target latency under 90 seconds, report only blocking issues (confidence ≥ 80).
  3. When the reviewer returns:
    • No blocking issues → compute HEAD_SHA=$(git rev-parse HEAD) and DIFF_HASH=$(bash scripts/reviewer-hash.sh), then Write .decode-reviewer-clean with exactly one line: <HEAD-SHA> <DIFF-HASH> <ISO-8601-UTC-timestamp>. The hash helper covers tracked-file diffs AND untracked file contents; do not substitute a plain git diff | git hash-object pipe — it misses untracked files and lets create-file → pass-review → silent-edit bypass the marker.
    • Blocking issues → Write .decode-reviewer-findings.md with the list. Do NOT write .decode-reviewer-clean.
  4. Return.

If the feature-dev plugin is not installed, stop and ask the user to run /plugin install feature-dev@claude-plugins-official.

The commit-msg git hook blocks commits unless the marker's HEAD and DIFF hashes both match the current repo state, or the commit message contains [override-reviewer: <reason>]. Binding to the diff content means any edit made after review invalidates the marker. Overrides are visible forever in git log --grep="override-reviewer".

DECODE base rules

This repo enforces DECODE's Claude Code standards. The full rule catalog lives at https://github.com/implicitdiagnosticsandsolutions/decode-claude-wiki/tree/main/docs/rules — rules are loaded by reference.

The short version — what you must follow:

  1. Reviewer subagent required before commit. For any change that touches source code, generator scripts, or data outputs, dispatch the feature-dev:code-reviewer subagent before committing. The Stop hook blocks session end until this procedure is handled. Committing without a fresh .decode-reviewer-clean marker is blocked by .githooks/commit-msg unless the commit message contains [override-reviewer: <reason>]. Overrides are visible forever in git log --grep="override-reviewer".

  2. Verify before claiming. Before saying "X works", "it's documented", or "it's in memory", run a concrete check. Paste the output. "Should" is a red flag — replace it with a check.

  3. Patch the source, not the generated artifact. If a file under output/ or dist/ was produced by a script, edit the script and regenerate. Never edit the artifact directly.

  4. Stage files explicitly. Never git add -A or git add .. Name each file.

  5. No AI attribution in commits. Conventional format, human author.

Optional final cleanup

This template also ships a repo-local deslop skill under .claude/skills/deslop/.

Use it after a change already works and before commit when you want a final pass focused on:

  • removing unnecessary wrappers or indirection
  • preserving source-of-truth files and types
  • catching debug leftovers and placeholder comments
  • reducing AI slop without widening scope

deslop is advisory, not a hard gate.

First-time setup in this repo

Setup runs automatically on Claude Code session start via the ensure-setup.sh SessionStart hook — it wires .githooks into git (core.hooksPath) so the commit-msg and pre-commit gates fire. Idempotent; no-ops once wired.

If you commit from a plain terminal in a fresh clone without ever opening a Claude Code session, the hooks will not fire until you run setup manually:

bash scripts/setup.sh

Destructive operations

Destructive git operations (push --force, reset --hard, clean -f, branch -D, etc.) are blocked by the block-dangerous-git.sh PreToolUse hook. If you genuinely need one, ask the user to run it manually after explicit chat confirmation.

Writes to .env*, credentials*, *.pem, *.key, and other secret files are blocked by block-env-writes.sh.


This repo

icat_app ist eine Streamlit-Webanwendung mit 8 Tools für Brand Asset Management bei DECODE. Sie läuft auf Hugging Face Spaces (Python 3.12, Streamlit 1.32.2).

Lokal starten:

pip install -r requirements.txt
streamlit run app.py
# öffnet http://localhost:8501

Source-Layout:

  • app.py — Entry Point, konfiguriert die Seite und bindet alle Tabs ein
  • tab1.py – tab8.py — je ein Tool (ein Tab = eine Datei)
  • helper.py — geteilte Hilfsfunktionen
  • requirements.txt — Python-Abhängigkeiten (Quelle der Wahrheit für Dependencies)

Die 8 Tools:

  1. Extract Images from Excel
  2. Name Assets by Brand
  3. Canvas White to Transparent
  4. Asset Overview (PDF)
  5. Name Stims by Block
  6. Re-run Matrix
  7. Resize
  8. Place on Canvas

Repo-spezifische Regeln:

  • Jeder Tab hat seine eigene Datei (tab1.py–tab8.py) — neue Tools als neue Tab-Datei anlegen, nicht in app.py einbauen.
  • Die App deployed automatisch auf Hugging Face Spaces bei Push auf main.