Discover and apply best practice skills automatically. Gap analysis scans the codebase, skill-search fills gaps from the registry, skill-classifier separates proactive from reactive skills, quality-standards generates CLAUDE.md guidance, self-review compares code against checklists, and verification-strategy sets up test/lint/typecheck feedback loops.
86
86%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
#!/bin/bash
# quality-standards: Inject quality block into CLAUDE.md
#
# Reads proactive skills from .skill-discovery-state.json, extracts their
# checklist sections, and generates a quality block in CLAUDE.md.
#
# If no proactive skills are found or no checklists exist, falls back to
# the generic quality block template.
#
# Safe to run multiple times — removes existing block first.
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
CLAUDE_MD="CLAUDE.md"
STATE_FILE=".skill-discovery-state.json"
GENERIC_TEMPLATE="$SCRIPT_DIR/../references/quality-block-generic.md"
# --- Generate quality block from proactive skills ---
BLOCK=""
if [ -f "$STATE_FILE" ]; then
BLOCK=$(python3 -c "
import json, re, os
with open('$STATE_FILE') as f:
state = json.load(f)
proactive = state.get('proactiveSkills', [])
if not proactive:
exit(1)
sections = {}
for path in proactive:
if not os.path.isfile(path):
continue
with open(path) as f:
content = f.read()
# Extract checklist section
match = re.search(r'## Checklist\s*\n(.*?)(?=\n## |\Z)', content, re.DOTALL)
if not match:
continue
# Extract skill name from frontmatter
name_match = re.search(r'^name:\s*(.+)$', content, re.MULTILINE)
name = name_match.group(1).strip() if name_match else os.path.basename(os.path.dirname(path))
checklist = match.group(1).strip()
if checklist:
sections[name] = checklist
if not sections:
exit(1)
# Build the block
lines = []
lines.append('<!-- skill-discovery:start -->')
lines.append('<!-- Managed by tessl-labs/skill-discovery. Do not edit manually. -->')
lines.append('<!-- To remove: bash .tessl/tiles/tessl-labs/skill-discovery/skills/quality-standards/scripts/remove-quality-block.sh -->')
lines.append('')
lines.append('## Project Quality Standards')
lines.append('')
for name, checklist in sections.items():
lines.append(f'### {name.replace(\"-\", \" \").title()}')
# Convert checklist items to concise bullet points
for line in checklist.split('\n'):
line = line.strip()
if line.startswith('- [ ]'):
lines.append('- ' + line[5:].strip())
elif line.startswith('- '):
lines.append(line)
elif line.startswith('**') and line.endswith('**'):
lines.append('')
lines.append(f'### {line.strip(\"*\").strip()}')
lines.append('')
lines.append('<!-- skill-discovery:end -->')
print('\n'.join(lines))
" 2>/dev/null)
fi
# Fall back to generic template if no proactive skills produced content
if [ -z "$BLOCK" ]; then
if [ -f "$GENERIC_TEMPLATE" ]; then
BLOCK=$(cat "$GENERIC_TEMPLATE")
else
echo "Error: No proactive skills found and no generic template available."
exit 1
fi
fi
# --- Remove existing block if present ---
if [ -f "$CLAUDE_MD" ]; then
python3 -c "
import re
with open('$CLAUDE_MD') as f:
content = f.read()
content = re.sub(r'\n?<!-- skill-discovery:start -->.*?<!-- skill-discovery:end -->\n?', '', content, flags=re.DOTALL)
with open('$CLAUDE_MD', 'w') as f:
f.write(content)
" 2>/dev/null
fi
# --- Inject new block ---
touch "$CLAUDE_MD"
echo "" >> "$CLAUDE_MD"
echo "$BLOCK" >> "$CLAUDE_MD"
echo "Quality standards injected into $CLAUDE_MD"