workflow-optimization/SKILL.md
Adds Anthropic-inspired workflow optimization to existing projects - mistakes tracking, verification checklists, context pruning, code quality hooks, pattern learning, and build error resolution
npx skillsauth add petrogurcak/skills workflow-optimizationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Optimalizuje Claude Code workflow kombinací Anthropic best practices (Cherny pattern) + Everything Claude Code patterns.
Key improvements:
Announce: "I'm using workflow-optimization to improve your Claude Code workflow."
USE this skill:
projectsetup to add workflow improvementsDON'T use this skill:
.claude/ folder yet → run projectsetup firstprojectsetupdigraph workflow_optimization {
"Skill invoked" [shape=doublecircle];
"Detect current setup" [shape=box];
"Ask what to add" [shape=diamond];
"Implement changes" [shape=box];
"Verify" [shape=box];
"Done" [shape=doublecircle];
"Skill invoked" -> "Detect current setup";
"Detect current setup" -> "Ask what to add";
"Ask what to add" -> "Implement changes";
"Implement changes" -> "Verify";
"Verify" -> "Done";
}
Check existing .claude/ structure:
ls -la .claude/
| File | Status | Action |
|------|--------|--------|
| CLAUDE.md | Missing | Run projectsetup first |
| .claude/ | Missing | Run projectsetup first |
| mistakes.md | Missing | Create from template |
| verification.md | Missing | Create project-specific |
| ACTIVE_CONTEXT.md | >15KB | Prune with [MAJOR]/[MINOR] |
| CHECKPOINTS.md | Present | Add mistakes detection |
Question: What optimizations do you want?
| Option | What it adds | |--------|--------------| | A) Full optimization (Recommended) | Everything below | | B) Mistakes tracking only | .claude/mistakes.md + CHECKPOINTS update | | C) Verification checklist only | .claude/verification.md customized for project | | D) Context pruning only | Update ACTIVE_CONTEXT.md format | | E) Code quality hooks | Auto-Prettier, TS check, console.log warning | | F) Pattern learning | /learn command + continuous-learning SessionEnd hook | | G) Checkpoints | /checkpoint command for workflow milestones | | H) Build error resolver | Agent for minimal-diff build/TS error fixes |
Based on user choice, create/update files.
mistakes.md from templateverification.md customized for detected stackarchive/ folder for old sessions~/.claude/hooks/after-commit.sh - reflection reminder after commits~/.claude/hooks/load-mistakes.sh - load lessons at session start~/.claude/settings.json with PostToolUse + SessionStart hooksmistakes.md from templateverification.md with stack-specific checksAdd to ~/.claude/settings.json PostToolUse hooks:
See "Code Quality Hooks" section below for implementation.
/learn command in ~/.claude/commands/learn.md~/.claude/skills/learned/ directorySee "Pattern Learning" section below for implementation.
/checkpoint command in ~/.claude/commands/checkpoint.md.claude/checkpoints.log for trackingSee "Checkpoints" section below for implementation.
~/.claude/agents/build-error-resolver.mdSee "Build Error Resolver Agent" section below for implementation.
# Mistakes Log
> Reaktivní poučení z chyb. Pro proaktivní architektonická rozhodnutí viz `DECISIONS.md`.
> **Účel:** Cherny pattern - učit se z chyb = 2-3x quality improvement
---
## Template
## [YYYY-MM-DD]: Krátký popis chyby
**Co se stalo:**
[Konkrétní chyba - co nefungovalo]
**Proč:**
[Root cause - proč k tomu došlo]
**Oprava:**
[Jak se to vyřešilo]
**Poučení:**
[Co dělat příště jinak - konkrétní pravidlo]
**Tags:** #backend #frontend #database #testing #deployment #security
---
## Logged Mistakes
(Empty - will be populated during development)
---
**Last Updated:** [DATE]
Detect stack and generate relevant checklist:
| Stack | Sections | |-------|----------| | FastAPI | Tests (pytest, mypy), Security (input validation, tenant isolation), Database (N+1, migrations) | | Expo | Tests (npm test, tsc), UI/UX (iOS/Android test, dark mode), i18n | | Nette | Templates (Latte syntax), Assets (Vite build), Security (XSS) | | Generic | Tests, Type safety, Manual test, Security basics |
# Aktuální stav práce
> **Format:** [MAJOR] = architektonická rozhodnutí, nové features, breaking changes. [MINOR] = bug fixes, refactoring.
> **Rule:** All [MAJOR] + last 5 [MINOR]. Older [MINOR] → `archive/minor-sessions.md`
---
## [MAJOR] 2026-01-05: Feature Name
- **Impact:** Why this is major
- **Files:** key files changed
- **Commit:** hash
## [MINOR] 2026-01-04: Bug Fix
- Brief description
- **File:** single file if relevant
---
## Klíčová rozhodnutí
| # | Rozhodnutí | Důvod |
|---|------------|-------|
| 1 | Decision | Why |
---
**Last Updated:** [DATE]
**Archive:** Older [MINOR] sessions in `archive/minor-sessions.md`
Add to end of existing CHECKPOINTS.md:
---
## Before Session End - Mistakes Detection
If during this session:
- I apologized for an error
- I had to revert/undo something
- I made multiple attempts at the same thing
- Tests failed and I had to fix my code
→ **PROPOSE entry for `.claude/mistakes.md`:**
## [YYYY-MM-DD]: Brief description
**Co se stalo:** [What went wrong]
**Proč:** [Root cause]
**Oprava:** [How it was fixed]
**Poučení:** [What to do differently next time]
**Tags:** #relevant #tags
**Why:** Learning from mistakes = 2-3x quality improvement (Cherny pattern)
.claude/archive/minor-sessions.md❌ Archiving [MAJOR] entries: Never archive important decisions - they need to be visible.
❌ Too much detail in [MINOR]: Keep [MINOR] entries brief - just enough to remember what happened.
❌ Forgetting to update mistakes.md: CHECKPOINTS.md rule should remind Claude at session end.
❌ Stack-generic verification: Always customize verification.md for the specific project stack.
Full optimization includes automatic hooks for mistakes tracking:
Purpose: Triggers reflection reminder after every git commit - perfect moment for learning.
File: ~/.claude/hooks/after-commit.sh
#!/bin/bash
INPUT=$(cat)
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
if echo "$COMMAND" | grep -qE "git commit"; then
cat << 'EOF'
{"systemMessage": "Commit complete.\n\n**Quick reflection:**\n- Did anything unexpected happen?\n- Did I retry/revert anything?\n- Any assumptions that were wrong?\n\nIf yes -> propose .claude/mistakes.md entry"}
EOF
else
echo '{}'
fi
Purpose: Loads lessons from mistakes.md at session start as context.
File: ~/.claude/hooks/load-mistakes.sh
#!/bin/bash
if [ -f ".claude/mistakes.md" ]; then
# Support both Czech (Poučení) and ASCII (Pouceni) variants
LESSONS=$(grep -A2 "^\*\*Pou[čc]en[ií]:\*\*" .claude/mistakes.md 2>/dev/null | grep -v "^--$" | grep -v "^\*\*Pou[čc]en[ií]:\*\*" | sed '/^$/d')
if [ -n "$LESSONS" ]; then
ESCAPED=$(echo "$LESSONS" | jq -Rs .)
echo "{\"systemMessage\": \"Lessons from mistakes.md:\\n${ESCAPED}\"}"
exit 0
fi
fi
echo '{}'
Add to ~/.claude/settings.json:
{
"hooks": {
"SessionStart": [{
"matcher": "startup",
"hooks": [
{"type": "command", "command": "bash ~/.claude/hooks/load-mistakes.sh"}
]
}],
"PostToolUse": [{
"matcher": "Bash",
"hooks": [
{"type": "command", "command": "bash ~/.claude/hooks/after-commit.sh", "timeout": 5}
]
}]
}
}
When implementing Full optimization (Option A), create hooks:
# Create hooks
chmod +x ~/.claude/hooks/after-commit.sh
chmod +x ~/.claude/hooks/load-mistakes.sh
# Verify settings.json has PostToolUse + SessionStart hooks
| Skill | Relationship |
|-------|--------------|
| projectsetup | Run first if no .claude/ exists |
| deep-review | Use verification.md checklist |
| systematic-debugging | Log fixes to mistakes.md |
| development-workflow | Follow verification.md before commits |
| build-error-resolver | New agent for minimal-diff build fixes |
Automatic code quality checks after every edit.
| Hook | Trigger | What it does | |------|---------|--------------| | Auto-Prettier | Edit *.ts/tsx/js/jsx | Formats code automatically | | TypeScript check | Edit *.ts/tsx | Runs tsc --noEmit on file | | console.log warning | Edit *.ts/tsx/js/jsx | Warns about debug statements |
Add to ~/.claude/settings.json under hooks.PostToolUse:
1. Auto-Prettier:
{
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx|js|jsx)$\"",
"hooks": [{
"type": "command",
"command": "bash ~/.claude/hooks/auto-prettier.sh"
}],
"description": "Auto-format JS/TS files with Prettier"
}
File: ~/.claude/hooks/auto-prettier.sh
#!/bin/bash
INPUT=$(cat)
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
if [ -n "$FILE" ] && [ -f "$FILE" ]; then
npx prettier --write "$FILE" 2>/dev/null
fi
echo "$INPUT"
2. TypeScript Check:
{
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx)$\"",
"hooks": [{
"type": "command",
"command": "bash ~/.claude/hooks/ts-check.sh"
}],
"description": "TypeScript check after editing .ts/.tsx"
}
File: ~/.claude/hooks/ts-check.sh
#!/bin/bash
INPUT=$(cat)
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
if [ -n "$FILE" ] && [ -f "$FILE" ]; then
ERRORS=$(npx tsc --noEmit --pretty false 2>&1 | grep "$FILE" | head -10)
if [ -n "$ERRORS" ]; then
echo "$ERRORS" >&2
fi
fi
echo "$INPUT"
3. console.log Warning:
{
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx|js|jsx)$\"",
"hooks": [{
"type": "command",
"command": "bash ~/.claude/hooks/console-log-check.sh"
}],
"description": "Warn about console.log statements"
}
File: ~/.claude/hooks/console-log-check.sh
#!/bin/bash
INPUT=$(cat)
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
if [ -n "$FILE" ] && [ -f "$FILE" ]; then
MATCHES=$(grep -n "console\.log" "$FILE" 2>/dev/null | head -5)
if [ -n "$MATCHES" ]; then
echo "[Hook] WARNING: console.log found in $FILE" >&2
echo "$MATCHES" >&2
echo "[Hook] Remove before committing" >&2
fi
fi
echo "$INPUT"
Two-part system: manual /learn + automatic SessionEnd extraction.
File: ~/.claude/commands/learn.md
# /learn - Extract Reusable Patterns
Analyze current session and extract patterns worth saving.
## What to Extract
1. **Error Resolution** - How specific errors were resolved
2. **Debugging Techniques** - Non-obvious approaches
3. **Workarounds** - Library/framework quirks
4. **Project Patterns** - Conventions discovered
## Process
1. Review session for extractable patterns
2. Draft skill file:
## [Pattern Name]
**Extracted:** [Date]
**Context:** [When this applies]
### Problem
[What problem this solves]
### Solution
[The technique/workaround]
### Example
[Code if applicable]
3. Ask user to confirm
4. Save to ~/.claude/skills/learned/[pattern-name].md
## Don't Extract
- Trivial fixes (typos, syntax)
- One-time issues (API outages)
- Config that won't repeat
File: ~/.claude/hooks/evaluate-session.sh
#!/bin/bash
cat << 'EOF'
{"systemMessage": "Session ending.\n\n**Pattern check:**\n- Non-trivial problem solved?\n- Useful workaround discovered?\n- Debugging technique worth remembering?\n\nIf yes -> /learn or note for next session."}
EOF
Add to settings.json:
{
"hooks": {
"SessionEnd": [{
"matcher": "*",
"hooks": [{"type": "command", "command": "bash ~/.claude/hooks/evaluate-session.sh"}],
"description": "Pattern extraction reminder"
}]
}
}
mkdir -p ~/.claude/skills/learned
mkdir -p ~/.claude/commands
# Copy learn.md to ~/.claude/commands/
Simple milestone system for tracking workflow progress.
File: ~/.claude/commands/checkpoint.md
# /checkpoint - Workflow Milestones
## Usage
- /checkpoint create <name> - Create named checkpoint
- /checkpoint verify <name> - Compare to checkpoint
- /checkpoint list - Show all checkpoints
## Create Checkpoint
1. Verify clean state (tests pass)
2. Log to .claude/checkpoints.log:
YYYY-MM-DD-HH:MM | name | git-sha
3. Report success
## Verify Checkpoint
1. Find checkpoint in log
2. Compare:
- Files changed since
- Test/build status
3. Report comparison
## Typical Flow
[Start] -> /checkpoint create "feature-start"
[Implement] -> /checkpoint create "core-done"
[Test] -> /checkpoint verify "core-done"
[PR] -> /checkpoint verify "feature-start"
File: ~/.claude/scripts/checkpoint.sh
#!/bin/bash
ACTION=$1
NAME=$2
LOG=".claude/checkpoints.log"
case $ACTION in
create)
mkdir -p .claude
TIMESTAMP=$(date +%Y-%m-%d-%H:%M)
SHA=$(git rev-parse --short HEAD 2>/dev/null || echo "no-git")
echo "$TIMESTAMP | $NAME | $SHA" >> "$LOG"
echo "Checkpoint '$NAME' created at $SHA"
;;
verify)
ENTRY=$(grep "$NAME" "$LOG" | tail -1)
SHA=$(echo "$ENTRY" | awk -F'|' '{print $3}' | tr -d ' ')
echo "Changes since '$NAME' ($SHA):"
git diff --stat "$SHA" HEAD 2>/dev/null || echo "Cannot diff"
;;
list)
cat "$LOG" 2>/dev/null || echo "No checkpoints"
;;
esac
Dedicated agent for fixing build/TypeScript errors with minimal diffs.
File: ~/.claude/agents/build-error-resolver.md
---
name: build-error-resolver
description: Fixes build/type errors with minimal diffs. No refactoring, no architecture changes.
tools: Read, Edit, Bash, Grep, Glob
model: sonnet
---
# Build Error Resolver
Fix TypeScript and build errors quickly with smallest possible changes.
## Rules
**DO:** Add types, null checks, fix imports, add dependencies
**DON'T:** Refactor, rename, add features, optimize
## Workflow
1. Collect errors: npx tsc --noEmit --pretty
2. Fix one at a time, smallest change
3. Verify after each fix
4. Report: errors fixed, lines changed, status
## Common Fixes
**Type inference:** Add `: Type` annotation
**Null/undefined:** Add `?.` or `?? default`
**Missing property:** Add to interface
**Import error:** Fix path or install package
## Success Criteria
- tsc --noEmit exits 0
- npm run build passes
- < 5% lines changed per file
- No new errors
npm run build failsnpx tsc --noEmit shows errorsClaude automatically uses when detecting build failures, or manually:
Use build-error-resolver agent to fix these errors
development
Builds a pre-launch social proof strategy through structured beta programs using D'Souza Brain Audit interviews. Use when launching new products/services and need compelling testimonials, planning a beta cohort, designing interview questions to harvest objection-busting social proof, improving video testimonials for landing pages, or designing case studies with metrics. Trigger phrases include "beta tester program for testimonials", "pre-launch social proof", "Brain Audit testimonial framework", "case study harvest", "reverse testimonial", "video testimonial mechanics", "social proof landing page", "sběr referencí", "beta tester program", "testimonial pro landing page", "social proof před launchem", "rozhovor s klientem", "case study sběr", "reference před spuštěním". NOT for ongoing case study production (use growth-hacking case-study approach), offer design (use offer-creation), or conversion optimization (use ux-optimization).
development
Use when planning a product launch and the product type is unclear or could be either generic (SaaS/app/physical) or info-product. Routes between marketing:launch-strategy (generic launches) and marketing:info-product-launch (courses, memberships, ebooks, cohorts, communities). Trigger phrases - "launch", "spuštění", "go-to-market", "product launch", "release strategy", "uvedení na trh", "launch plan", "spuštění produktu", "launch sequence", "launch strategy". Do NOT trigger when product type is already clear (use specific skill directly).
testing
Specialized 8-week launch cadence for info-products — online courses, cohort programs, memberships, communities, ebooks, masterminds. Combines Jeff Walker's Product Launch Formula (Seed/Internal/JV variants, PLC sequence, open-cart day-by-day) with Stu McLaren's membership mechanics (closed cart, Success Path) and Hormozi Grand Slam Offer stacking. Use when planning "launch online kurzu", "info-product launch", "PLF launch", "course launch", "membership launch", "cohort launch", "ebook launch", "open cart close cart", "8-week launch of online course", "beta cohort to launch sequence", "spuštění kurzu", "launch členské sekce", "open cart strategie". Differentiates from marketing:launch-strategy (generic SaaS/app launches) — info-product-specific. NOT for SaaS launches, physical products, or services.
development
Use when releasing an Expo/React Native mobile app to App Store and Google Play - covers eas submit, ASC "Submit for Review", Play promote Internal→Production, OTA update, and decoding common silent failures (Apple agreement expiry, missing English locale, Background Location declaration, web bundle failure on react-native-maps).