From db4f30af86415a6f7de85ae17689b5338295b08f Mon Sep 17 00:00:00 2001 From: Lorenz Hilpert Date: Tue, 2 Dec 2025 12:57:27 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore:=20improve=20skills=20cros?= =?UTF-8?q?s-references=20and=20CLAUDE.md=20guidance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add --amend option with safety rules to commit command - Add logging skill cross-references to angular-template and html-template - Fix logging skill name from logging-helper to logging - Add extended thinking triggers, context monitoring, and code investigation rules to CLAUDE.md --- .claude/commands/commit.md | 36 +++++++++++++++++++ .claude/skills/angular-template/SKILL.md | 1 + .claude/skills/html-template/SKILL.md | 1 + .claude/skills/logging/SKILL.md | 2 +- CLAUDE.md | 46 ++++++++++++++++++++++++ 5 files changed, 85 insertions(+), 1 deletion(-) diff --git a/.claude/commands/commit.md b/.claude/commands/commit.md index 9e82c46ba..c180c49b1 100644 --- a/.claude/commands/commit.md +++ b/.claude/commands/commit.md @@ -174,6 +174,42 @@ Example of splitting commits: ## Command Options - `--no-verify`: Skip running the pre-commit checks (lint, build, generate:docs) +- `--amend`: Amend the previous commit (RESTRICTED - see rules below) + +## Amend Rules (CRITICAL) + +**ONLY use `--amend` in these specific cases:** + +1. **Adding pre-commit hook fixes**: If a pre-commit hook modified files (formatting, linting auto-fixes), you may amend to include those changes. + +2. **Before amending, ALWAYS verify:** + ```bash + # Check authorship - NEVER amend another developer's commit + git log -1 --format='%an %ae' + + # Check not pushed - NEVER amend pushed commits + git status # Should show "Your branch is ahead of..." + ``` + +3. **If either check fails:** + - Create a NEW commit instead + - Never amend commits authored by others + - Never amend commits already pushed to remote + +**Example workflow for pre-commit hook changes:** +```bash +# 1. Initial commit triggers pre-commit hook +git commit -m "feat(scope): add feature" +# Hook modifies files... + +# 2. Verify safe to amend +git log -1 --format='%an %ae' # Your name/email +git status # "Your branch is ahead..." + +# 3. Stage hook changes and amend +git add . +git commit --amend --no-edit +``` ## Important Notes diff --git a/.claude/skills/angular-template/SKILL.md b/.claude/skills/angular-template/SKILL.md index 9f19ae3eb..5b1c92c73 100644 --- a/.claude/skills/angular-template/SKILL.md +++ b/.claude/skills/angular-template/SKILL.md @@ -18,6 +18,7 @@ Guide for modern Angular 20+ template patterns: control flow, lazy loading, proj **Related Skills:** These skills work together when writing Angular templates: - **[html-template](../html-template/SKILL.md)** - E2E testing attributes (`data-what`, `data-which`) and ARIA accessibility - **[tailwind](../tailwind/SKILL.md)** - ISA design system styling (colors, typography, spacing, layout) +- **[logging](../logging/SKILL.md)** - MANDATORY logging in all Angular files using `@isa/core/logging` ## Control Flow (Angular 17+) diff --git a/.claude/skills/html-template/SKILL.md b/.claude/skills/html-template/SKILL.md index d7c3a9b51..68beb6173 100644 --- a/.claude/skills/html-template/SKILL.md +++ b/.claude/skills/html-template/SKILL.md @@ -19,6 +19,7 @@ Use this skill when: **Works seamlessly with:** - **[angular-template](../angular-template/SKILL.md)** - Angular template syntax, control flow, and modern patterns - **[tailwind](../tailwind/SKILL.md)** - ISA design system styling for visual design +- **[logging](../logging/SKILL.md)** - MANDATORY logging in all Angular components using `@isa/core/logging` ## Overview diff --git a/.claude/skills/logging/SKILL.md b/.claude/skills/logging/SKILL.md index efaed19ed..d3937a374 100644 --- a/.claude/skills/logging/SKILL.md +++ b/.claude/skills/logging/SKILL.md @@ -1,5 +1,5 @@ --- -name: logging-helper +name: logging description: This skill should be used when working with Angular components, directives, services, pipes, guards, or TypeScript classes. Logging is MANDATORY in all Angular files. Implements @isa/core/logging with logger() factory pattern, appropriate log levels, lazy evaluation for performance, error handling, and avoids console.log and common mistakes. --- diff --git a/CLAUDE.md b/CLAUDE.md index 677decc17..f8b3648b4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -112,6 +112,52 @@ angular-template → html-template → logging → tailwind Use `/clear` between unrelated tasks to prevent context degradation. +### Long-Running Task Pattern + +For complex tasks approaching context limits: +1. Dump progress to a `.md` file (e.g., `progress.md`) +2. Use `/clear` to reset context +3. Resume by reading the progress file +4. Continue from where you left off + +### Context Monitoring + +- Use `/context` to check current token usage +- Fresh session baseline: ~20k tokens +- Consider `/compact` when approaching 150k tokens +- Prefer `/clear` over `/compact` when starting new topics + +## Extended Thinking + +Use progressive thinking depth for complex analysis: + +| Trigger | Thinking Budget | Use Case | +|---------|----------------|----------| +| `"think"` | ~4k tokens | Basic analysis, simple decisions | +| `"think hard"` | ~10k tokens | Moderate complexity, multi-factor decisions | +| `"think harder"` | ~16k tokens | Deep analysis, architectural decisions | +| `"ultrathink"` | ~32k tokens | Maximum depth, critical planning | + +**Examples:** +- "Think about how to structure this component" +- "Think hard about the best approach for state management" +- "Ultrathink about the architecture for this feature" + +## Code Investigation (MANDATORY) + +**Never speculate about code you haven't read.** + +If user references a specific file: +1. **READ the file first** using the Read tool +2. **THEN provide analysis** based on actual contents +3. If file doesn't exist, **say so explicitly** + +**Anti-Hallucination Rules:** +- Never describe code you haven't opened +- Never assume file contents based on names +- Never guess API signatures without documentation +- Always verify imports and dependencies exist + ## Implementation Decisions | Task Type | Required Agent | Escalation Path |