Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
globs: |
**/*.md
!CHANGELOG.md
!references/ffca/**
config: 'config/custom.markdownlint.jsonc'

spelling:
Expand Down Expand Up @@ -66,6 +65,8 @@ jobs:
run: bash hooks/check_vgv_cli_test.sh
- name: Validate layers hook tests
run: bash hooks/validate_layers_test.sh
- name: Sync VGE standards hook tests
run: bash hooks/sync-vge-standards_test.sh

skills-lint:
name: 🔍 Skills Lint
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/reference_drift.yaml

This file was deleted.

31 changes: 12 additions & 19 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Project Overview

VGV FFCA Plugin teaches Claude Code the Feature-First Clean Architecture (FFCA) for Flutter monorepos. It ships skills, one read-only auditor agent, and a PostToolUse hook that blocks pubspec edits breaking the layer rules.
VGV FFCA Plugin teaches Claude Code the Feature-First Clean Architecture (FFCA) for Flutter monorepos. It ships skills, one read-only auditor agent, a PostToolUse hook that blocks pubspec edits breaking the layer rules, and a SessionStart hook that syncs Very Good Engineering's published standards.

The skills and the agent carry workflows only. The architecture itself lives in `references/ffca/`, which is the single source of truth. It is a byte mirror of the FFCA section of VGV Engineering, one file per page, regenerated by `scripts/sync_reference.dart`. Never edit its content to match a skill. Change the upstream page, re-sync, then fix the skills that drifted.
The skills and the agent carry workflows only. The architecture itself lives in the FFCA section of Very Good Engineering, the single source of truth. `hooks/sync-vge-standards.sh` syncs it at session start, one file per page under `architecture/ffca/`. The plugin ships no copy. Each skill and the agent carry a `## VGE Standards` section that names the synced path and says to stop when there is no synced copy. Change the upstream page, then fix the skills that drifted.

The only code is the Dart layer validator under `scripts/` and the bash hook wrapper that calls it.
The only code is the Dart layer validator under `scripts/` and the bash hooks under `hooks/`.

## Repository Structure

Expand All @@ -20,29 +20,21 @@ config/
cspell.json # Spell check dictionary
custom.markdownlint.jsonc # markdownlint rules
hooks/
hooks.json # Hook definitions (PreToolUse, PostToolUse)
hooks.json # Hook definitions (SessionStart, SubagentStart, PreToolUse, PostToolUse)
check_vgv_cli.sh # Checks the Very Good CLI version and auto-approves its MCP tools
check_vgv_cli_test.sh # Tests for check_vgv_cli.sh
sync-vge-standards.sh # Syncs the Very Good Engineering standards to a shared cache
sync-vge-standards_test.sh # Tests for sync-vge-standards.sh
validate_layers.sh # Runs the validator on edited pubspec.yaml files
validate_layers_test.sh # Tests for validate_layers.sh
references/
ffca/ # Byte mirror of the VGV Engineering FFCA pages, single source of truth
README.md # Manifest: which upstream page each file mirrors
overview.md # Goals, three-part structure, feature archetypes, layer model
domain.md # Models, Commands and Queries, repository interfaces, Summary pattern
data.md # Data sources, DTOs, converters and mappers
presentation.md # Modules, localizations, widget slots, subfeature barrels
navigation.md # Callback injection, typed routes, splitting the routing table
project_structure.md # Dependency rules, naming, folder layout, tooling
faq.md # Frequently asked questions
code_templates/
data_templates.md # DTO, data source, mapper, repository implementation shapes
domain_templates.md # Model, repository interface, Command and Query shapes
presentation_templates.md # Cubit, Module, route shapes
scripts/
analysis_options.yaml # Excludes the test fixtures from analysis
pubspec.yaml # Dev dependency on package:test for the validator tests
sync_reference.dart # Regenerates references/ffca/ from VGV Engineering, --check for drift
validate_layers.dart # FFCA layer, naming, cycle, import, and barrel validator
test/
validate_layers_test.dart # Validator tests
Expand Down Expand Up @@ -70,11 +62,12 @@ Every `SKILL.md` follows this structure:
- `effort`: reasoning effort while the skill is active. Every skill here sets `high`.
2. **H1 title**, the human-readable skill name.
3. **A short purpose paragraph**, then numbered workflow steps.
4. **Citations** into `references/ffca/` by file and section name, and into `references/code_templates/` for code shapes.
4. **A `## VGE Standards` section** naming the synced path and saying to stop when there is no synced copy.
5. **Citations** into `architecture/ffca/` by file and section name, and into `references/code_templates/` for code shapes.

## Writing Conventions

- Do not restate architecture rules inside a skill. Cite the file and section of `references/ffca/` by its heading so the reference stays the only place a rule is written.
- Do not restate architecture rules inside a skill. Cite the file and section of `architecture/ffca/` by its heading so Very Good Engineering stays the only place a rule is written.
- Frame standards as clear directives. No soft language like "consider" or "prefer".
- Use fenced code blocks with language identifiers for all examples.
- Reference packages by full name, for example `package:go_router_builder`.
Expand Down Expand Up @@ -106,15 +99,15 @@ Agents live in `agents/<name>.md` and are auto-discovered. No `plugin.json` chan

Documentation drifts when an asset changes and the docs describing it do not. Update the matching docs in the same change:

- **The FFCA architecture changes.** Update the VGV Engineering page first, then run `dart run scripts/sync_reference.dart` to re-sync `references/ffca/`. Check every skill, the agent, and the code templates for section names that moved or rules that changed. If a dependency rule changed, update the rules table at the top of `scripts/validate_layers.dart` and its tests.
- **The FFCA architecture changes.** Update the Very Good Engineering page first. Check every skill, the agent, and the code templates for section names that moved or rules that changed. If a dependency rule changed, update the rules table at the top of `scripts/validate_layers.dart` and its tests.
- **A skill's scope or triggers change.** Update `description` and the matching row in the `README.md` Skills table.
- **The validator's rules or flags change.** Update `scripts/test/validate_layers_test.dart` and its fixtures, the **Hooks** section of `README.md`, and the `## Hooks` section of `CLAUDE.md` if the hook's behavior changes.
- **A hook changes in `hooks/hooks.json`.** Update the **Hooks** section of `README.md` and the `## Hooks` section of `CLAUDE.md`. If it is `check_vgv_cli.sh` or `validate_layers.sh`, update its `_test.sh` file.
- **A hook changes in `hooks/hooks.json`.** Update the **Hooks** section of `README.md` and the `## Hooks` section of `CLAUDE.md`. If it is `check_vgv_cli.sh`, `validate_layers.sh`, or `sync-vge-standards.sh`, update its `_test.sh` file.
- **An MCP tool is added, renamed, or removed.** Check every skill's `allowed-tools` and the **MCP Integration** section of `README.md`. Nothing validates those names.

## Checks

CI runs markdownlint with `config/custom.markdownlint.jsonc`, cspell with `config/cspell.json`, the validator's analyze, format, and tests from `scripts/`, skills lint on `skills/`, a check that every plugin file path in `skills/` and `agents/` starts with `${CLAUDE_PLUGIN_ROOT}/`, and `claude plugin validate .`. `CHANGELOG.md` and `references/ffca/` are excluded from markdownlint. A weekly `reference_drift` workflow runs `sync_reference.dart --check` and fails when the mirror is stale.
CI runs markdownlint with `config/custom.markdownlint.jsonc`, cspell with `config/cspell.json`, the validator's analyze, format, and tests from `scripts/`, skills lint on `skills/`, a check that every plugin file path in `skills/` and `agents/` starts with `${CLAUDE_PLUGIN_ROOT}/`, and `claude plugin validate .`. `CHANGELOG.md` is excluded from markdownlint.

## Commits

Expand Down
6 changes: 5 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@

## Hooks

`hooks/hooks.json` defines one PostToolUse hook and one PreToolUse hook.
`hooks/hooks.json` defines one SessionStart hook, one SubagentStart hook, one PostToolUse hook, and one PreToolUse hook.

- SessionStart and SubagentStart → `sync-vge-standards.sh`. At session start it syncs the Very Good Engineering bundles for major `VGE_TARGET_MAJOR` into `${XDG_CACHE_HOME:-~/.cache}/very_good_engineering/bundles/`, the cache vgv-ai-flutter-plugin shares, under a lock so two plugins never download twice. It sends conditional GETs for the manifest and index, downloads only missing or changed documents, keeps each only when its sha256 and byte count match the index, and prunes documents the index drops. It prints one line naming the synced path. When VGE publishes a newer major or stops listing the target one, it pauses the sync and prints a notice instead of syncing. With `--subagent`, matched to `ffca-layer-auditor`, it only hands that agent the path line as `additionalContext`, with no network. It skips when `jq`, `curl`, or a sha256 tool is missing, fails open on any network, parse, or filesystem error, and always exits 0. Bump `VGE_TARGET_MAJOR` in the same change that updates the skills for a new major.

- `Edit|MultiEdit|Write` matcher → `validate_layers.sh`. The matcher is a filter, not a guarantee, so the hook reads `tool_name` from the payload and exits 0 unless it is `Edit`, `MultiEdit`, or `Write`. When the edited file is a `pubspec.yaml` or a Dart file inside an FFCA-shaped repo, meaning a `features/` folder exists above it, the hook runs `dart run scripts/validate_layers.dart --file <path>`. For a pubspec, the validator checks the edited package and its direct dependents, reporting the edited package's warnings and errors but only the errors of its dependents, and running the import checks and suppression validation for the edited package only, and it does not require a barrel from a package with no `lib/` yet. For a Dart file under a package's `lib/` or `bin/`, it reports only the import and barrel findings located in that file, so a Dart edit never blocks on a violation elsewhere. Exit 2 means at least one error-severity finding. The hook forwards only the validator's report, from the first `FFCA findings in` line, so `dart run`'s own notices never reach Claude. It prints the findings to stderr and exits 2, which blocks Claude until the dependency is fixed. When the validator exits 0 with output, every finding is a warning: the hook returns it as `additionalContext` JSON and exits 0, so Claude sees it without being blocked. A `# ffca-ignore: <rule-id> — <reason>` comment in a pubspec suppresses that rule for that package, and `// ffca-ignore:` in a Dart file suppresses it for that file, except for rules reported on the pubspec, which a Dart file cannot suppress.
- Any other file, or a repo with no `features/` folder, exits 0 silently.
- The hook skips with exit 0 when `jq` or `dart` is missing from `PATH`. The `dart` check runs only for FFCA pubspec and Dart edits. A validator failure other than exit 2 is reported to stderr but never blocks.

- `mcp__.*very-good-cli__.*` matcher → `check_vgv_cli.sh`. For a Very Good CLI MCP tool, it returns `allow` when `very_good --version` is 1.3.0 or newer and `deny` with an install or upgrade message when the CLI is missing or older. It stands aside with exit 0 for any other tool, when the version cannot be read, or when `jq` is missing. `allowed-tools` grants only last for the invoking turn, so this hook is what keeps the tools approved afterwards.

`hooks/sync-vge-standards_test.sh` covers the SessionStart and SubagentStart hook against a stubbed `curl` and runs in CI under the **Hook Tests** job.

`hooks/check_vgv_cli_test.sh` covers the PreToolUse hook against a stubbed `very_good` and runs in CI under the **Hook Tests** job.

`scripts/test/validate_layers_test.dart` covers the validator and runs in CI under the **Layer Validator** job. Add a fixture and a case there when changing a rule, and add a new rule as a value of the `Rule` enum, with its ID and severity, and to the rules table in the **Hooks** section of `README.md`.
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ First of all, thank you for taking the time to contribute! 🎉👍 Before you d
| ------------ | ----- |
| **New skill** | `skills/<skill-name>/SKILL.md` |
| **Improve an existing skill** | Edit the relevant `skills/*/SKILL.md` |
| **Architecture conventions** | Upstream on VGV Engineering, then `dart run scripts/sync_reference.dart` to refresh `references/ffca/` |
| **Architecture conventions** | Upstream on Very Good Engineering. The SessionStart hook syncs it to users |
| **Layer validator** | `scripts/validate_layers.dart` and `scripts/test/` |
| **Hook** | `hooks/` directory |
| **Agent** | `agents/` directory |
Expand Down Expand Up @@ -58,7 +58,7 @@ Add a row to the skills table in `README.md` and to the list of slash commands b

## Skill Writing Guidelines

- **Point into the reference, do not restate it.** The conventions live in `references/ffca/`. Link to the file and section by name so the architecture keeps one source of truth.
- **Point into the reference, do not restate it.** The conventions live in the synced Very Good Engineering pages under `architecture/ffca/`. Link to the file and section by name so the architecture keeps one source of truth.
- **Use clear directives.** No soft language like "consider" or "prefer". Say "Use X" or "Do not use Y".
- **Fence all code blocks** with language identifiers, for example ` ```dart `.
- **Reference packages by full name**, for example `package:go_router_builder`.
Expand Down Expand Up @@ -132,7 +132,7 @@ Every pull request runs the following checks from `.github/workflows/ci.yaml`:

| Check | What it does | Config |
| ----- | ------------ | ------ |
| Markdown Quality | Lints all `*.md` files with markdownlint-cli2, except `CHANGELOG.md` and `references/ffca/` | `config/custom.markdownlint.jsonc` |
| Markdown Quality | Lints all `*.md` files with markdownlint-cli2, except `CHANGELOG.md` | `config/custom.markdownlint.jsonc` |
| Spelling Check | Runs cspell on all `*.md`, `*.yml`, and `*.yaml` files except `CHANGELOG.md` | `config/cspell.json` |
| Layer Validator | Runs `dart analyze --fatal-infos`, `dart format --set-exit-if-changed`, and `dart test` in `scripts/` | `scripts/pubspec.yaml` |
| Hook Tests | Runs `bash hooks/check_vgv_cli_test.sh` | `hooks/check_vgv_cli_test.sh` |
Expand Down
Loading
Loading