Skip to content

docs(skill): treat shallow/file_split as advisory and add stop rule - #184

Merged
kevmoo merged 2 commits into
mainfrom
skill-guardrails
Oct 9, 2026
Merged

kevmoo merged 2 commits into
mainfrom
skill-guardrails

Conversation

@kevmoo

@kevmoo kevmoo commented Oct 8, 2026

Copy link
Copy Markdown
Owner

The dart-cognitive-complexity skill pushes agents to clear every shallow and file_split finding, which caused over-refactoring and regressions in dogfood runs.

Changes

  • Stop rule: only declarations above the threshold are work items. When max CC <= threshold, report done and stop; anything further needs a user ask.
  • Advisory, not gates: shallow and file_split are documented as optional review aids. Removed the "batch re-inline SAFE_INLINE" triage option and every --fail-on-safe-inline gate recommendation. The findings-table action now reads "Review: consider re-inlining if ...".
  • Keep/revert heuristics (new §5.3): keep de-duplication, guard clauses, and named step helpers. Don't inline helpers with same-shape siblings or meaningful names/docs, don't make style-only edits, and don't split files without a cohesive name (no barrels or cycles).
  • Hot-loop rule (new §5.4): benchmark before splitting per-element kernels. Prefer an inline kernel with // cognitive_complexity:ignore on the line before the declaration, plus a reason comment.
  • Blind self-review: for diffs over ~300 lines, a fresh agent or human reviewer given only the before/after trees and diff judges each change.
  • refactoring_recipes.md: Pattern G no longer says "always re-inline". Pattern F now says to name split files by their contents.
  • Evals: replaced the shallow-gate assertion and added negative assertions (no batch re-inline, sibling helpers stay extracted, no style-only edits). Added complexity_stop_when_clean.

Docs-only: no version, pin, or CHANGELOG changes.

Evidence

Blind reviews of the dogfood PRs found that fixing CC > 15 helped, but re-inlining SAFE_INLINE helpers and name-by-one-function file splits mostly hurt:

Related (not fixed here): #181, #183

- Add a stop rule: only declarations above the threshold are work items.
- Treat shallow and file_split findings as advisory review aids; drop the
  batch re-inline option and --fail-on-safe-inline gate recommendations.
- Add keep/revert heuristics, a hot-loop benchmark rule, and a blind
  self-review step for large diffs.
- Reframe Pattern G in refactoring_recipes.md; name split files by contents.
- Evals: replace the shallow-gate assertion, add negative assertions, and
  add complexity_stop_when_clean.

@kevmoo kevmoo left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Sanity-check pass; two optional notes inline. Looks good to land otherwise.

Comment thread skills/dart-cognitive-complexity/SKILL.md Outdated
Comment thread skills/dart-cognitive-complexity/evals/evals.json
Clarify that shallow/file_split findings are advisory in consumer repos,
that a package may keep its own dogfood --fail-on-safe-inline CI step, and
that existing CI gates are not removed without an explicit ask.
@kevmoo
kevmoo merged commit b0ae595 into main Oct 9, 2026
11 checks passed
@kevmoo
kevmoo deleted the skill-guardrails branch October 9, 2026 04:37
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.

1 participant