skills/dimon94/constitution-guardian/SKILL.md
Real-time Constitution compliance checker for devflow documents. Blocks partial implementations and hardcoded secrets during file editing.
npx skillsauth add aiskillstore/marketplace constitution-guardianInstall 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.
Enforce CC-DevFlow Constitution compliance by detecting violations in real-time during document editing, preventing non-compliant content from being saved.
Trigger: PreToolUse hook when editing devflow documents (PRD.md, EPIC.md, TASKS.md, TECH_DESIGN.md)
Focus Articles (Real-time prevention):
Note: Full Constitution has 10 Articles. This guardrail focuses on the most critical real-time violations. Batch validation by validate-constitution.sh covers all Articles.
# ❌ BLOCKED
## User Stories
### US1: User Registration
TODO later: Add email verification flow
FIXME: Implement password strength validation
Regex Patterns:
TODO.*laterFIXME\[placeholder\]// TODO:.*later# FIXME:.*# ❌ BLOCKED
## Implementation Notes
This is simplified for now, complete implementation would require...
Regex Pattern: simplified for now
# ❌ BLOCKED
## Acceptance Criteria
- [ ] Basic login (v1)
- [ ] Remember me (defer to v2)
Regex Pattern: defer to v\d|will complete in v\d
# ❌ BLOCKED
## Configuration
API_KEY=sk-abc123def456
JWT_SECRET=mysecretkey123
PASSWORD=admin123
Regex Patterns:
API_KEY\s*=\s*['"]?[a-zA-Z0-9_-]{10,}SECRET\s*=\s*['"]?[a-zA-Z0-9_-]+PASSWORD\s*=\s*['"]?[^\s]+TOKEN\s*=\s*['"]?[a-zA-Z0-9_-]{10,}// ❌ BLOCKED
const config = {
apiKey: "sk-abc123def456",
dbPassword: "postgres123"
};
Regex Patterns:
apiKey:\s*['"][^'"]+['"]password:\s*['"][^'"]+['"]secret:\s*['"][^'"]+['"]When violation detected, PreToolUse hook returns exit code 2 (blocks file save):
⚠️ BLOCKED - Constitution Violation
Detected:
- [Line 42] TODO placeholder (Article I.1 - No Partial Implementation)
- [Line 58] Hardcoded API key (Article III.1 - No Hardcoded Secrets)
📋 ACTION:
1. Complete all TODOs/FIXMEs before saving
2. Move secrets to environment variables (.env, not committed)
3. Review `.claude/rules/project-constitution.md` v2.0.0
4. Run /flow-verify for comprehensive check
Source: Constitution Articles I.1, III.1
File: {file_path}
Constitutional Basis:
Article I.1: "NO PARTIAL IMPLEMENTATION: Complete implementation or no implementation"
Article III.1: "NO HARDCODED SECRETS: Use environment variables or secret management"
💡 SKIP: Add `@constitution-verified` comment or set SKIP_CONSTITUTION_CHECK=1
I.1 Complete Implementation Mandate:
Prohibition: Any form of partial implementation or placeholder code
Requirement: Complete implementation or no implementation
Examples:
❌ Forbidden: "// TODO: Implement this later"
❌ Forbidden: "// Simplified for now, will complete in v2"
✅ Required: Fully functional, production-ready code
Enforcement:
III.1 No Hardcoded Secrets:
Prohibited:
❌ API_KEY = "sk-abc123..." in source code
❌ PASSWORD = "admin123" in config files
❌ JWT_SECRET embedded in code
Required:
✅ Environment variables (.env files, not committed)
✅ Secret management services (AWS Secrets Manager, etc.)
✅ Configuration injection at runtime
Detection: Pre-push guard scans for secret patterns
Enforcement:
Users can bypass Constitution guardian in specific scenarios:
sessionSkillUsed: true in skill-rules.json@constitution-verified comment in document<!-- @constitution-verified: Legacy doc migration, compliance review completed -->
SKIP_CONSTITUTION_CHECK=1Relationship: Complementary (互补)
.claude/rules/project-constitution.md v2.0.0In .claude/skills/skill-rules.json:
{
"constitution-guardian": {
"type": "guardrail",
"enforcement": "block",
"priority": "critical",
"description": "Real-time Constitution compliance, extracted from Constitution v2.0.0",
"fileTriggers": {
"pathPatterns": [
"devflow/requirements/**/PRD.md",
"devflow/requirements/**/EPIC.md",
"devflow/requirements/**/TASKS.md",
"devflow/requirements/**/TECH_DESIGN.md",
"devflow/requirements/**/contracts/**/*.yaml",
"devflow/requirements/**/data-model.md"
],
"contentPatterns": [
"TODO.*later",
"FIXME",
"\\[placeholder\\]",
"simplified for now",
"defer to v\\d",
"API_KEY\\s*=\\s*['\"]?[a-zA-Z0-9_-]{10,}",
"SECRET\\s*=\\s*['\"]?[a-zA-Z0-9_-]+",
"PASSWORD\\s*=\\s*['\"]?[^\\s]+",
"TOKEN\\s*=\\s*['\"]?[a-zA-Z0-9_-]{10,}",
"apiKey:\\s*['\"][^'\"]+['\"]",
"password:\\s*['\"][^'\"]+['\"]"
]
},
"blockMessage": "⚠️ BLOCKED - Constitution Violation\n\nDetected:\n- Partial implementation (Article I.1)\n- Hardcoded secrets (Article III.1)\n\n📋 ACTION:\n1. Complete all TODOs/FIXMEs\n2. Move secrets to config system\n3. Run /flow-verify\n\nSource: .claude/rules/project-constitution.md v2.0.0",
"skipConditions": {
"sessionSkillUsed": true,
"fileMarkers": ["@constitution-verified"],
"envOverride": "SKIP_CONSTITUTION_CHECK"
}
}
}
Goal: Precise violation location reporting
Implementation (in PreToolUse hook):
function detectViolations(content: string, patterns: string[]) {
const lines = content.split('\n');
const violations: Array<{line: number, pattern: string, text: string}> = [];
lines.forEach((line, index) => {
patterns.forEach(pattern => {
if (new RegExp(pattern, 'i').test(line)) {
violations.push({
line: index + 1,
pattern: pattern,
text: line.trim()
});
}
});
});
return violations;
}
Enhanced Blocking Message:
⚠️ BLOCKED - Constitution Violation
Detected 3 violations:
[Line 42] TODO placeholder (Article I.1)
→ "TODO later: Add email verification"
[Line 58] Hardcoded API key (Article III.1)
→ "API_KEY=sk-abc123def456"
[Line 73] FIXME comment (Article I.1)
→ "FIXME: Complete error handling"
📋 ACTION: ...
This guardrail does NOT contain:
This guardrail ONLY contains:
Rationale: Avoid duplication ("不重不漏" principle). Constitution document owns full text, guardrail owns real-time enforcement of critical rules.
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.