Apply and validate the 7 Key Principles to code - TDD, Fail Fast, Modular, Reuse, Open Source, No Debt, Excellence. Checks code compliance and suggests improvements. Use during code review or refactoring.
/plugin marketplace add foolishimp/ai_sdlc_method/plugin install aisdlc-methodology@aisdlcThis skill is limited to using the following tools:
Skill Type: Validator/Sensor Purpose: Validate code compliance with 7 Key Principles Prerequisites: Code exists to validate
You are validating code against the 7 Key Principles.
The 7 Key Principles:
Your role: Check code compliance and report violations.
Check: Does code have tests?
Validation:
# For each file in src/, check if tests exist
for file in src/**/*.py; do
test_file="tests/$(basename $file | sed 's/\.py$//')"
if [ ! -f "${test_file}_test.py" ]; then
echo "VIOLATION: $file has no tests"
fi
done
✅ Pass:
❌ Fail:
Check: Does code fail loudly?
Validation:
# Look for silent failures
grep -rn "except.*pass" src/ # Empty except blocks (silent failures)
grep -rn "return None" src/ | grep -v "Optional" # Silent None returns
grep -rn "# TODO: error handling" src/ # Deferred error handling
✅ Pass:
❌ Fail:
Check: Is code modular?
Validation:
# Check file/function sizes
find src -name "*.py" -exec wc -l {} \; | awk '$1 > 300' # Files > 300 lines
# Check cyclomatic complexity
radon cc src/ -a | grep "F" # Functions with F rating (too complex)
✅ Pass:
❌ Fail:
Check: Is this functionality already available?
Validation:
# Search for similar code in project
grep -rn "function_name" src/
# Check for duplicate code
jscpd src/ # Copy-paste detector
✅ Pass:
❌ Fail:
Check: Could we use an open source library?
Validation:
✅ Pass:
❌ Fail:
Check: Is code clean of technical debt?
Validation:
# Unused imports
grep -rn "^import\|^from" src/ | check_usage
# Dead code
find_functions_with_zero_callers src/
# Commented code
grep -rn "# " src/ | grep -v "^#" | check_if_code
# Complexity
radon cc src/ -a | grep -E "C|D|E|F"
✅ Pass:
❌ Fail:
If FAIL: Invoke prune-unused-code, simplify-complex-code
Check: Is this excellent code?
Validation:
# Naming quality
grep -rn " x " src/ # Single-letter variables
grep -rn " temp" src/ # Temp variables
# Documentation
find src -name "*.py" -exec grep -L '"""' {} \; # Files without docstrings
# Type hints (Python)
grep -rn "def " src/ | grep -v " -> " # Functions without return types
# Style compliance
pylint src/ --errors-only
black src/ --check
✅ Pass:
❌ Fail:
When all principles satisfied:
[APPLY KEY PRINCIPLES]
Validating code against 7 Key Principles...
✅ Principle #1: Test Driven Development
- All files have tests
- Tests written first (git history verified)
- Coverage: 95.2%
✅ Principle #2: Fail Fast & Root Cause
- No silent failures
- Specific error messages
- Comprehensive logging
✅ Principle #3: Modular & Maintainable
- Max file size: 187 lines (< 300)
- Max function size: 23 lines (< 50)
- Max complexity: 6 (< 10)
✅ Principle #4: Reuse Before Build
- No duplicate code
- Using standard libraries (bcrypt, datetime)
- Searched codebase first
✅ Principle #5: Open Source First
- Using bcrypt library (not custom hashing)
- Documented in ADR-001
✅ Principle #6: No Legacy Baggage
- Tech debt: 0 violations
- No unused imports
- No dead code
- No commented code
- Max complexity: 6
✅ Principle #7: Perfectionist Excellence
- Clear naming (validate_email, normalize_email)
- Comprehensive docstrings
- Type hints on all functions
- Style: PEP 8 compliant
Result: 7/7 Principles Satisfied ✅
Quality: EXCELLENT 🔥
Ready for commit/deployment
When violations found:
[APPLY KEY PRINCIPLES - VIOLATIONS FOUND]
❌ Principle #6: No Legacy Baggage
Violations (5):
1. Unused import: import hashlib (src/auth.py:3)
2. Dead function: legacy_hash_password() (src/auth.py:67-74)
3. Commented code: Lines 120-135 (src/auth.py)
4. High complexity: login() complexity 14 (src/auth.py:89)
5. TODO without ticket: # TODO: Add rate limiting (src/auth.py:145)
❌ Principle #7: Perfectionist Excellence
Violations (3):
1. Missing docstring: _check_password() (src/auth.py:156)
2. No type hint: def validate(email) (src/auth.py:178)
3. Vague naming: variable 'x' (src/auth.py:192)
Result: 5/7 Principles Satisfied ⚠️
Violations: 8 total
Quality: NEEDS IMPROVEMENT
Actions Required:
1. Invoke 'prune-unused-code' to fix Principle #6
2. Fix naming, docs, types for Principle #7
3. Re-run validation after fixes
Blocked: Fix violations before commit
Before invoking:
plugins:
- name: "@aisdlc/principles-key"
config:
principles:
enforce_tdd: true
enforce_fail_fast: true
enforce_modular: true
enforce_reuse_first: true
enforce_open_source_first: true
enforce_no_legacy: true
enforce_excellence: true
block_on_violation: true
thresholds:
max_file_lines: 300
max_function_lines: 50
max_complexity: 10
min_coverage: 80
Why apply principles?
Principles manifest in code:
Homeostasis Goal:
desired_state:
all_seven_principles_satisfied: true
violations: 0
code_quality: excellent
"Excellence or nothing" 🔥
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.