constitution-guardian

aiskillstore/marketplace

Проверяет соответствие документов devflow конституции проекта в реальном времени.

Звёзды486
Форки53
Авторaiskillstore
Обновлённоя 17 2026

Установка

SKILL.md

Constitution Guardian

Purpose

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)

Enforcement Scope

Focus Articles (Real-time prevention):

  • Article I.1: Quality First - No Partial Implementation
  • Article III.1: Security First - No Hardcoded Secrets

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.

Violation Patterns

Article I.1: No Partial Implementation

Pattern 1: TODO placeholders

# ❌ BLOCKED
## User Stories
### US1: User Registration
TODO later: Add email verification flow
FIXME: Implement password strength validation

Regex Patterns:

  • TODO.*later
  • FIXME
  • \[placeholder\]
  • // TODO:.*later
  • # FIXME:.*

Pattern 2: Simplified/Partial notes

# ❌ BLOCKED
## Implementation Notes
This is simplified for now, complete implementation would require...

Regex Pattern: simplified for now

Pattern 3: Version deferral

# ❌ BLOCKED
## Acceptance Criteria
- [ ] Basic login (v1)
- [ ] Remember me (defer to v2)

Regex Pattern: defer to v\d|will complete in v\d

Article III.1: No Hardcoded Secrets

Pattern 1: Environment variables with secrets

# ❌ 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,}

Pattern 2: Code snippets with hardcoded secrets

// ❌ BLOCKED
const config = {
  apiKey: "sk-abc123def456",
  dbPassword: "postgres123"
};

Regex Patterns:

  • apiKey:\s*['"][^'"]+['"]
  • password:\s*['"][^'"]+['"]
  • secret:\s*['"][^'"]+['"]

Blocking Message

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

Constitutional Basis

Article I: Quality First

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:

  • Generation time: prd-writer, tech-architect, planner agents check output
  • Edit time: constitution-guardian guardrail blocks save (this skill)
  • Phase completion: validate-constitution.sh batch validation

Article III: Security First

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:

  • Generation time: All agents avoid secrets in generated docs
  • Edit time: constitution-guardian guardrail blocks save (this skill)
  • Pre-push: Git pre-push hook scans for secrets

Skip Conditions

Users can bypass Constitution guardian in specific scenarios:

1. Session Skip (One-time per session)

  • Mechanism: sessionSkillUsed: true in skill-rules.json
  • Behavior: Guardrail only triggers once per Claude session
  • Use case: User acknowledged violation, working on fix

2. File Marker (Permanent skip for specific file)

  • Marker: Add @constitution-verified comment in document
  • Example:<!-- -->
    <!-- @constitution-verified: Legacy doc migration, compliance review completed -->
    
  • Use case: Legacy documentation, special cases

3. Environment Variable (Temporary global skip)

  • Variable: SKIP_CONSTITUTION_CHECK=1
  • Scope: Current terminal session
  • Use case: Bulk imports, automated migrations

Relationship with Other Components

validate-constitution.sh (Script)

  • Purpose: Batch validation of all 10 Constitutional Articles
  • Scope: Complete document/codebase scan
  • Timing: Phase completion (e.g., /flow-prd Exit Gate)
  • Articles: I, II, III, IV, V, VI, VII, VIII, IX, X

constitution-guardian (Guardrail)

  • Purpose: Real-time prevention of critical violations
  • Scope: Single document being edited
  • Timing: During file editing (PreToolUse hook)
  • Articles: Focus on I.1, III.1 (most critical for documents)

Relationship: Complementary (互补)

  • Guardrail: Real-time prevention (write-time, partial Articles)
  • Script: Batch validation (phase-time, all Articles)
  • Double insurance: Guardrail catches most issues, Script catches remaining

Constitution Document

  • Source of Truth: .claude/rules/project-constitution.md v2.0.0
  • Contains: All 10 Articles with detailed rules
  • This guardrail: Extracts Articles I.1, III.1 prohibition rules only

Configuration

In .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"
    }
  }
}

Line Number Reporting (Enhancement)

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: ...

Design Principle

This guardrail does NOT contain:

  • ❌ Complete Constitution (all 10 Articles are in project-constitution.md)
  • ❌ All violation patterns (only Articles I.1, III.1)
  • ❌ Batch validation logic (that's in validate-constitution.sh)

This guardrail ONLY contains:

  • ✅ Articles I.1, III.1 prohibition rule extraction
  • ✅ Real-time violation detection (content pattern matching)
  • ✅ Blocking mechanism (PreToolUse hook, exit code 2)
  • ✅ Precise line number reporting
  • ✅ Links to full Constitution document

Rationale: Avoid duplication ("不重不漏" principle). Constitution document owns full text, guardrail owns real-time enforcement of critical rules.

Вставить в README

Ссылка на карточку для вашего README — без картинок и счётчиков.

[DarkPlay: constitution-guardian](https://darkplay.ru/ai/skills/aiskillstore-marketplace-constitution-guardian)

Из того же репозитория

when-profiling-performance-use-performance-profiler Система профилирования производительности, поиска узких мест и оптимизации. ★486 when-managing-token-budget-use-token-budget-advisor Управление бюджетом токенов: оценка расхода, анализ сложности, стратегии разбиения. ★486 when-optimizing-agent-learning-use-reasoningbank-intelligence Адаптивное обучение с ReasoningBank: распознавание паттернов и оптимизация стратегий. ★486 when-optimizing-prompts-use-prompt-architect Фреймворк для анализа, создания и улучшения промптов на основе доказательных техник. ★486 when-optimizing-prompts-use-prompt-optimization-analyzer Диагностика промптов: оценка качества, поиск антипаттернов и лишних токенов. ★486 when-orchestrating-swarm-use-swarm-orchestration Оркестрация сложного роя агентов с декомпозицией задач и синтезом результатов. ★486 when-releasing-software-use-github-release-management Оркестрация релизов GitHub: версионирование, тестирование, деплой и откат. ★486 when-reviewing-github-pr-use-github-code-review Ревью pull request в GitHub с параллельным анализом специализированными агентами. ★486

Похожие скиллы и другие разделы каталога

Популярное в разделе «Скиллы»

Самые востребованные скиллов раздела по установкам и звёздам.

find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
4 400 000 устан.
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
1 600 000 устан.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
1 600 000 устан.
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
1 600 000 устан.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
1 600 000 устан.
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
1 500 000 устан.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
1 400 000 устан.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
1 300 000 устан.
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
1 300 000 устан.
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.
1 300 000 устан.
Похожее в других разделах каталога

Соседние разделы каталога: возможно, нужный инструмент живёт там.

Constitutional Validatorshanraisshan · Проверяет пункты роадмапа, функции и технические решения на соответствие конституции…
61 912 ★
safety-alignmentorchestra-research · Безопасность ИИ и модерация контента: Constitutional AI, LlamaGuard, NeMo Guardrails и…
96 комп.
claud-coachanthropics · Учебный компаньон для разработчиков: ведёт вопросами вместо готовых ответов и блокирует…
38 комп.
compact-guardiananthropics · Предотвращает потерю задач при компакции контекста: сохраняет недавние инструкции и…
38 комп.
context-guardiananthropics · Мониторинг окна контекста и умное сжатие для Claude Code без зависимостей.
38 комп.
env-guardiananthropics · Поиск утёкших секретов и ключей, шаблоны .env, проверка и ротация учётных данных.
38 комп.
fsd-architect-skillanthropics · Хранитель архитектуры Feature-Sliced Design для проектов на React, Next.js, Remix и React…
38 комп.
genesis-governance-claudeanthropics · Превращает проект Claude Code в управляемый: выводит конституцию, конфиг управления…
38 комп.
indian-family-draftinganthropics · Для адвокатов в семейных судах Индии по Family Courts Act 1984: стандартизирует…
38 комп.
indian-mact-draftinganthropics · Для адвокатов в трибуналах по ДТП Индии, где рассматриваются дела о компенсациях, и в…
38 комп.

Лучшие ИИ-инструменты для программирования

ИИ для программирования

Подборка нейросетей и ИИ-ассистентов для разработки и автоматизации кода. Сервисы, которые ускоряют написание, ревью и отладку, экономят часы рутины и снижают порог входа в сложные

GenAPIGenapi
По запросу
5.0
Notepad++ AINotepad-plus-plus
По запросу
4.9
GitHub CopilotGitHub
По подписке
4.9
Creatium MaxCremax
По запросу
4.8
Emacs AIGnu
По запросу
4.8
KiteKite
По запросу
4.8
Amazon Q DeveloperAmazon
По запросу
4.8
VECTA
Есть бесплатный тариф
4.8
SoftPractice
Есть бесплатный тариф
4.8
VibeForge
Есть бесплатный тариф
4.7

Лучшие ИИ-инструменты для генерации видео

Генерация видео

Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,

VEED.IOVeed
По запросу
5.0
MootionMootion
По запросу
5.0
FlyviFlyvi
Есть бесплатный тариф
4.9
Google Veo 3.1Google
Платно
4.9
Sora (OpenAI)OpenAI
Платно
4.9
PikaPika
Платно
4.9
captions space
Есть бесплатный тариф
4.8
Клайп
Есть бесплатный тариф
4.8
viralpulse.appViralpulse
По запросу
4.8
Viral Maker AIViral-maker
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации текста и копирайтинга

Генерация текста и копирайтинг

Подборка нейросетей для генерации текстов и копирайтинга. Сервисы, которые помогают создавать статьи, посты и рекламные объявления с нуля или по черновику, экономя часы рутинной ра

NeuroscribeNeuroscribe
Есть бесплатный тариф
5.0
GoGPTGogpt
По запросу
5.0
ChatsonicChatsonic
По запросу
4.9
НейроТекстерNeuro-texter
По запросу
4.9
ChatGPTOpenAI
По подписке
4.9
Редактум
Есть бесплатный тариф
4.8
ChadGPTChadgpt
По запросу
4.8
Cosmo ScribeCosmoscribe
Есть бесплатный тариф
4.8
Memo HelperCopilot33
По запросу
4.8
LibraChatLibrachat
Есть бесплатный тариф
4.8