Skip to content

feat: Add automated constitution compliance enforcement - #627

Merged
AustinChangLinksys merged 4 commits into
dev-2.0.0from
peter/ui-constituation-496
Feb 12, 2026
Merged

feat: Add automated constitution compliance enforcement#627
AustinChangLinksys merged 4 commits into
dev-2.0.0from
peter/ui-constituation-496

Conversation

@PeterJhongLinksys

Copy link
Copy Markdown
Collaborator

Summary

  • Add new implement-feature-with-checks skill that automatically enforces project constitution principles during feature implementation
  • Update and translate constitution.md with UI Kit Library principles

Key Features

The new skill provides automated enforcement of:

  • Requirements Clarity: Validates requirements are specific before implementation, integrates with brainstorming skill for unclear cases
  • UI Kit Library Usage: Verifies component usage against approved UI Kit library
  • Test Coverage Requirements: Enforces coverage thresholds (Service ≥90%, Provider ≥85%, Overall ≥80%)
  • Testing Automation: Automatically runs unit tests and screenshot tests
  • Code Quality: Executes dart format and flutter analyze
  • Architecture Compliance: Validates layer separation and error handling patterns

Behavior

  • Auto-triggers on implementation keywords (實作, 創建, 新增, 開發, 修改, 重構, 修正, etc.)
  • Provides decision trees and examples for common scenarios
  • Ensures consistent constitution adherence without manual reminders

Test Plan

  • Skill configuration validated
  • Constitution document updated with UI Kit Library principles
  • English translation added for broader team access

🤖 Generated with Claude Code

PeterJhongLinksys and others added 2 commits February 11, 2026 17:14
- Add Article XIV: UI Kit Library Principle with mandatory UI component usage rules
- Translate all remaining Chinese content in constitution.md to English
- Update "Last Amended" date to 2026-02-11

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ion compliance

Create new Claude Code skill that automatically enforces project constitution principles during feature implementation.

Key features:
- Requirements clarity check before implementation starts
- Integrates with brainstorming skill for unclear requirements
- Enforces UI Kit Library usage with component verification
- Mandates test coverage (Service ≥90%, Provider ≥85%, Overall ≥80%)
- Automates testing execution (unit tests + screenshot tests)
- Runs code formatting (dart format) and analysis (flutter analyze)
- Validates architecture compliance (layer separation, error handling)
- Provides decision trees and examples for common scenarios

The skill automatically triggers on keywords like 實作, 創建, 新增, 開發, 修改, 重構, 修正, etc., ensuring consistent adherence to constitution without manual reminders.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

Review Summary by Qodo

Add implement-feature-with-checks skill and UI Kit Library principle to constitution

✨ Enhancement 📝 Documentation

Grey Divider

Walkthroughs

Description
• Add new implement-feature-with-checks skill for automated constitution compliance enforcement
• Implement comprehensive workflow with 6 phases: planning, UI verification, implementation,
  testing, code quality, and verification
• Add Article XIV defining mandatory UI Kit Library usage rules with component verification process
• Translate constitution.md to English for broader team accessibility
Diagram
flowchart LR
  A["User Request<br/>with Keywords"] -->|Triggers| B["implement-feature-with-checks<br/>Skill"]
  B -->|Phase 1| C["Constitution Review<br/>& Planning"]
  C -->|Requirements Clear?| D{Decision}
  D -->|No| E["Stop & Suggest<br/>Brainstorming"]
  D -->|Yes| F["Phase 2: UI Kit<br/>Verification"]
  F -->|Component Missing?| G{Decision}
  G -->|Yes| H["Stop & Ask User"]
  G -->|No| I["Phase 3-6:<br/>Implementation,<br/>Testing, Quality"]
  I -->|All Pass| J["✅ Compliance<br/>Verified"]
  E -.->|After Clarification| B
  H -.->|User Decision| I
Loading

Grey Divider

File Changes

1. .claude/skills/implement-feature-with-checks/SKILL.md ✨ Enhancement +384/-0

Add implement-feature-with-checks skill with automated compliance workflow

• Create new skill file with 384 lines defining automated constitution compliance enforcement
• Implement 6-phase execution workflow: constitution review, UI kit verification, implementation,
 testing, code quality checks, and final verification
• Add requirements clarity check with decision tree to prevent unclear requirements from proceeding
• Include trigger keywords in English and Traditional Chinese for automatic skill invocation
• Provide detailed examples for feature creation, refactoring, bug fixes, and unclear requirements
 scenarios
• Document success criteria, architecture compliance checks, and integration with brainstorming
 skill

.claude/skills/implement-feature-with-checks/SKILL.md


2. constitution.md 📝 Documentation +170/-95

Translate constitution to English and add UI Kit Library principle

• Translate remaining Chinese content to English throughout the document (Articles X-XIII)
• Add new Article XIV defining mandatory UI Kit Library usage principles and component verification
 rules
• Update "Last Amended" date from 2025-12-17 to 2026-02-11
• Translate section headers, descriptions, and examples for Articles X (Code Review Standards), XI
 (Data Models), XII (State Management), and XIII (Error Handling)
• Add Rule 1 (UI Kit First) and Rule 2 (Stop and Ask When Missing) for component usage
• Include common ui_kit components list and import specification guidelines

constitution.md


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Feb 11, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. UI kit rule violates repo 🐞 Bug ⛯ Reliability
Description
New Article XIV forbids ui_kit_library subpath imports, but the repository currently contains
multiple such imports. Merging this change makes the repo instantly non-compliant with the
constitution’s new rule.
Code

constitution.md[R1139-1149]

+**Section 14.2: Import Specification**
+
+Use the unified import approach:
+
+```dart
+// ✅ Correct
+import 'package:ui_kit_library/ui_kit.dart';
+
+// ❌ Wrong: Don't use subpath imports
+import 'package:ui_kit_library/src/components/button.dart';
+```
Evidence
Article XIV explicitly bans subpath imports, yet existing Dart files import from
package:ui_kit_library/src/..., so the constitution would contradict the current codebase state
immediately after merge.

constitution.md[1139-1149]
lib/demo/wcag_analysis_demo.dart[16-19]
test/accessibility/widget_accessibility_test.dart[14-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Article XIV bans `package:ui_kit_library/src/...` imports, but the codebase already uses them (e.g., accessibility utilities). This makes the repo non-compliant immediately after merging the constitution update.
### Issue Context
Some `ui_kit_library` APIs may not be exported from `ui_kit.dart`, forcing subpath imports. If so, the constitution needs an explicit exception/scope clarification.
### Fix Focus Areas
- constitution.md[1139-1149]
- lib/demo/wcag_analysis_demo.dart[16-19]
- test/accessibility/widget_accessibility_test.dart[14-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

✅ 2. Constitution amendment date mismatch 🐞 Bug ✓ Correctness
Description
constitution.md now states two different “Last Amended” dates (header vs footer). This makes the
constitution’s revision metadata ambiguous for reviewers and any automation that may rely on it.
Code

constitution.md[1160]

+**Version**: 1.0.0 | **Ratified**: 2025-12-09 | **Last Amended**: 2026-02-11
Evidence
The header still shows the older amendment date while the updated footer version line claims a newer
amendment date, so the document is self-contradictory.

constitution.md[1-8]
constitution.md[1158-1160]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`constitution.md` contains conflicting amendment metadata: the header lists `Last Amended: 2025-12-22` while the footer lists `Last Amended: 2026-02-11`.
### Issue Context
This PR adds Article XIV and updates the footer metadata, but does not update the header metadata.
### Fix Focus Areas
- constitution.md[1-8]
- constitution.md[1158-1160]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


✅ 3. Skill vs constitution format rule 🐞 Bug ✓ Correctness
Description
The new implement-feature-with-checks skill instructs formatting entire feature directories, which
can include unmodified files. This conflicts with the constitution’s review checklist requiring
dart format only on modified files.
Code

.claude/skills/implement-feature-with-checks/SKILL.md[R234-237]

+**Step 5.1: Format Code**
+```bash
+dart format lib/page/[feature]/ test/page/[feature]/
+```
Evidence
The constitution explicitly limits formatting to modified files, but the skill’s command formats
directories, which can reformat unrelated files and create noisy diffs.

.claude/skills/implement-feature-with-checks/SKILL.md[234-237]
constitution.md[838-840]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The skill’s formatting step uses directory-level `dart format`, which can format unmodified files and violate the constitution’s checklist.
### Issue Context
The constitution is explicit about limiting formatting to modified files to avoid noisy diffs.
### Fix Focus Areas
- .claude/skills/implement-feature-with-checks/SKILL.md[234-237]
- constitution.md[838-840]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment thread constitution.md
Comment on lines +1139 to +1149
**Section 14.2: Import Specification**

Use the unified import approach:

```dart
// ✅ Correct
import 'package:ui_kit_library/ui_kit.dart';

// ❌ Wrong: Don't use subpath imports
import 'package:ui_kit_library/src/components/button.dart';
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Ui kit rule violates repo 🐞 Bug ⛯ Reliability

New Article XIV forbids ui_kit_library subpath imports, but the repository currently contains
multiple such imports. Merging this change makes the repo instantly non-compliant with the
constitution’s new rule.
Agent Prompt
### Issue description
Article XIV bans `package:ui_kit_library/src/...` imports, but the codebase already uses them (e.g., accessibility utilities). This makes the repo non-compliant immediately after merging the constitution update.

### Issue Context
Some `ui_kit_library` APIs may not be exported from `ui_kit.dart`, forcing subpath imports. If so, the constitution needs an explicit exception/scope clarification.

### Fix Focus Areas
- constitution.md[1139-1149]
- lib/demo/wcag_analysis_demo.dart[16-19]
- test/accessibility/widget_accessibility_test.dart[14-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

- Update Last Amended date to 2026-02-11 in constitution header for consistency
- Allow ui_kit_library subpath imports when APIs are not exported from ui_kit.dart (e.g., accessibility utilities, foundation modules)
- Change dart format rule from "only on modified files" to "dart format ." for consistent formatting across project
- Update implement-feature-with-checks skill to use "dart format ." instead of specific feature directories

These changes address three issues raised in PR #627 code review:
1. Resolved subpath import restriction conflict with existing accessibility code
2. Fixed Last Amended date mismatch between header and footer
3. Unified dart format command to format entire project

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update constitution and implement-feature-with-checks skill to include AppSurface in the common UI Kit components list.

Changes:
- Add AppSurface as the recommended container component
- Note: Use AppSurface instead of Container for consistent styling
- Update both constitution.md Article XIV and skill documentation

This ensures developers and AI agents prioritize AppSurface over standard Container widgets for UI consistency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@AustinChangLinksys AustinChangLinksys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@AustinChangLinksys
AustinChangLinksys merged commit a98fc8f into dev-2.0.0 Feb 12, 2026
2 checks passed
@AustinChangLinksys
AustinChangLinksys deleted the peter/ui-constituation-496 branch February 12, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Constitution for decoupling between domain and UI layer

2 participants