Write constitutions for existing codebases using Essential Floor + Emergent Ceiling approach. Use when creating constitutions for brownfield projects, codifying existing patterns, or when you see "brownfield", "existing codebase", "essential floor", "emergent ceiling", or "evolution roadmap". Extends authoring-constitution skill.
Writes constitutions for existing codebases using Essential Floor and Emergent Ceiling approach.
/plugin marketplace add deepeshBodh/human-in-loop/plugin install deepeshbodh-humaninloop-plugins-humaninloop@deepeshBodh/human-in-loopThis skill inherits all available tools. When active, it can use any tool Claude has access to.
EMERGENT-CEILING-PATTERNS.mdESSENTIAL-FLOOR.mdThis skill extends the authoring-constitution skill. Before using brownfield mode:
authoring-constitution for the Three-Part Principle Rule (Enforcement, Testability, Rationale)Brownfield constitutions follow all rules from authoring-constitution, plus additional guidance for existing codebases.
Write project constitutions for existing codebases using the Essential Floor + Emergent Ceiling approach.
Every constitution MUST include principles for these four categories, regardless of codebase state:
| Category | Minimum Requirements | Default Enforcement |
|---|---|---|
| Security | Auth at boundaries, secrets via env/secret managers, input validation, secret scanning in CI | Integration tests, code review, secret scanning tools |
| Testing | Automated tests exist, coverage ≥80% (configurable), ratchet rule (coverage MUST NOT decrease) | CI test gate, coverage threshold with warning/blocking levels |
| Error Handling | Explicit handling, RFC 7807 Problem Details format, correlation IDs in responses | Schema validation in tests, code review |
| Observability | Structured logging, correlation IDs, APM integration, no PII in logs | Config verification, log audit, APM dashboards |
See ESSENTIAL-FLOOR.md for detailed requirements and example principles for each category.
Writing Essential Floor Principles:
Beyond the essential floor, identify existing good patterns worth codifying:
See EMERGENT-CEILING-PATTERNS.md for the pattern library with examples.
Common Pattern Categories:
| Pattern Category | What to Look For |
|---|---|
| Code Quality | Documentation requirements, API annotations, deprecation handling |
| Architecture | Layer rules, dependency injection, module boundaries |
| API Design | Response formats, versioning, pagination |
| Authorization | Role-based access, permission checks |
| Resilience | Retry policies, circuit breakers, timeouts |
| Configuration | Strongly-typed options, feature flags |
| Error Handling | Error display guidelines, data resilience |
| Observability | Log levels, context requirements, crash reporting |
| Product Analytics | Event categories, naming conventions, funnel tracking |
| Naming Conventions | File/class/variable naming, directory structure |
# [Project] Constitution
<!-- SYNC IMPACT REPORT -->
## Core Principles
### Essential Floor Principles
I. Security by Default
II. Testing Discipline
III. Error Handling Standards
IV. Observability Requirements
### Emergent Ceiling Principles
V. [Pattern from codebase]
VI. [Pattern from codebase]
...
## Technology Stack
[From codebase analysis]
## Quality Gates
[From codebase analysis + essential floor requirements]
## Governance
[Standard governance section]
## Evolution Notes
This constitution was created from brownfield analysis.
**Essential Floor Status** (from codebase-analysis.md):
| Category | Status | Gap |
|----------|--------|-----|
| Security | partial | GAP-001 |
| Testing | partial | GAP-002 |
| Error Handling | present | - |
| Observability | absent | GAP-003 |
See `.humaninloop/memory/evolution-roadmap.md` for improvement plan.
Additional checks for brownfield constitutions (beyond standard checklist):
After completing brownfield constitution, run validation using validation-constitution skill.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.