Skip to content

feat(hygiene): support layered projects via docs/features/ - #96

Closed
jota-batuta wants to merge 9 commits into
addyosmani:mainfrom
jota-batuta:feature/layered-project-support
Closed

jota-batuta wants to merge 9 commits into
addyosmani:mainfrom
jota-batuta:feature/layered-project-support

Conversation

@jota-batuta

Copy link
Copy Markdown

Summary

  • Adds Step 0 to batuta-project-hygiene that classifies projects as feature-oriented (vertical slices) vs layer-oriented (horizontal layers like Django, Rails, FastAPI, Temporal workers).
  • Layer-oriented projects now route feature docs to docs/features/<name>/ instead of attempting to create src/<name>/ or move existing code.
  • Scoped CLAUDE.md gets a new Code map section in the layered variant that lists which files in each technical layer implement the feature.
  • Updates user-settings/CLAUDE.md backup with a matching "Decisión previa" section and revised hard rules Add Claude Code plugin support and fix stale swe-skills references #1 and docs: add code-simplification to README #4.
  • Bumps plugin version 1.1.0 → 1.2.0 (MINOR — additive, non-breaking: legacy CLAUDE.md without style: field defaults to feature-oriented).

Rationale

Forcing a vertical-slice refactor in a monolith-by-layer breaks imports, tests and worker/router registrations with risk disproportionate to the doc-scoping benefit. Rule of thumb: if relocating code to reach src/<feature>/ would need a PR touching >20 files, the project is layered → use docs/features/.

Test plan

  • python -c "yaml.safe_load(...)" parses SKILL.eval.yaml cleanly (6 cases incl. new trigger-03).
  • plugin.json parses, version is 1.2.0.
  • SKILL.md keeps valid frontmatter and all canonical sections (Overview / When to Use / Process / Verification / Red Flags); grew 196 → 291 lines.
  • user-settings/CLAUDE.md in sync with ~/.claude/CLAUDE.md (diff empty).
  • E2E scenario A — scratch layered Python project (pyproject.toml + src/pkg/{models,services,activities}) gets classified as layered and routes daily-report to docs/features/daily-report/.
  • E2E scenario B — scratch Next.js App Router project (package.json + app/existing-feature-one) keeps legacy feature-oriented behavior and creates app/billing/.

(Last two run locally after merge — tracked separately.)

Add 4 skills on top of upstream addyosmani/agent-skills:
- batuta-skill-authoring: meta-skill that enforces npx-skills-find-first before authoring
- batuta-agent-authoring: meta-skill enforcing distinctness check against existing agents
- research-first-dev: wraps context7 with citation-comment enforcement
- notion-kb-workflow: three modes for Notion KB sync (read/init/append)

Vendor two upstream skills with their licenses preserved:
- skills/_vendored/writing-skills from obra/superpowers (MIT, Jesse Vincent)
- skills/_vendored/context7 from intellectronica/agent-skills (CC0)

Modify CLAUDE.md: append Mandatory Skills section declaring the 4 new
skills and documenting the vendored directory.

Add ATTRIBUTION.md at root listing all sources, licenses, and the
referenced find-skills dependency (not vendored, install via npx skills).

Upstream remains untouched. Merge upstream changes via:
  git fetch upstream && git merge upstream/main
…, update README

The marketplace.json inherited from the upstream declared the marketplace
as addy-agent-skills and pointed the plugin source back at
addyosmani/agent-skills — so users installing via the fork URL got the
upstream without the four Batuta additions.

Fix:
- Rename marketplace.name to batuta-agent-skills
- Update owner to jota-batuta
- Point plugin source at jota-batuta/batuta-agent-skills
- Rename the plugin to batuta-agent-skills
- Rewrite the README to describe the fork and install path
- Preserve upstream README as a reference section below

Install path after this fix:
  /plugin marketplace add jota-batuta/batuta-agent-skills
  /plugin install batuta-agent-skills@batuta-agent-skills
New skill batuta-project-hygiene automates two moments that must not depend
on the operator remembering a slash command:

- project-init mode: triggered at session start when cwd has no CLAUDE.md
  but looks like a project. Detects stack from manifest files, runs built-in
  /init, appends Mandatory Skills and Feature folder convention sections,
  handles git init and optional gh repo create.

- feature-init mode: triggered when the operator announces a new feature.
  Reads project CLAUDE.md for Feature folder convention, asks once and
  persists the choice if placeholder. Creates scoped sub-folder with its
  own CLAUDE.md plus SPEC.md, starts feature/<name> branch.

Evaluated with 5 cases (2 trigger, 1 bypass, 2 edge) via RED/GREEN
sub-agents: 5/5 PASS. Fork overall 14/14 PASS across 5 Batuta skills.

Also add user-settings/ as a backup of the operator's ~/.claude/CLAUDE.md
so the user-level rules survive machine changes. README explains the
sync flow.

CLAUDE.md of the fork updated to list five Mandatory Skills (from four).
The .claude-plugin/plugin.json kept the upstream name 'agent-skills', which
caused a namespace collision with the marketplace entry (also called
batuta-agent-skills). Claude Code resolved skills under the wrong namespace,
loading only a subset.

Also bump version to 1.1.0 to reflect the Batuta layer (5 added skills +
vendored writing-skills and context7 + ATTRIBUTION + user-settings backup).
…root

The skill previously delegated SPEC creation to upstream spec-driven-development
without overriding its target. Upstream default writes to project root — wrong
for monorepos and src-layout projects, produces spaghetti (every feature's
SPEC.md piles at root with no scope association).

Changes:
- SKILL.md description explicitly states 'NEVER at project root' — raises
  trigger priority for any flow that would write a scoped artifact.
- Feature-init Mode now auto-detects folder convention from project
  structure before asking: pyproject.toml + src/ -> src/<name>/;
  package.json + packages/ -> packages/<name>/; Next.js App Router + app/
  -> app/<name>/; Cargo.toml workspace -> crates/<name>/; otherwise
  features/<name>/.
- Hard override: if upstream /spec writes SPEC.md at root, move it to the
  feature folder before committing. Do not accept a root-level SPEC for a
  scoped feature.
- New red flag: 'SPEC.md or CLAUDE.md for a feature ending up at project
  root' — now the top failure mode in the list.

Also sync user-settings/CLAUDE.md with the expanded 'Autonomous project
hygiene' section that spells out the hard rules in the user-level file.
Make explicit that src/ (or packages/, app/, features/, crates/) is a
features root that holds N feature subfolders, each self-contained. The
previous single-feature example made this ambiguous. The skill rule was
already correct; this just clarifies the visual.

Also strip the confusing 'SPEC.md only for single-feature repos' note
from the user CLAUDE.md — specs are always scoped to features.

Sync user-settings backup.
Add Step 0 to project-init that classifies a project as feature-oriented
(vertical slices) or layer-oriented (horizontal layers like Django, Rails,
FastAPI, Temporal workers). Layered projects route feature docs to
docs/features/<name>/ instead of forcing a src/<feature>/ refactor, so
existing code stays in its technical layer.

- SKILL.md: add alternate layered layout, Step 0 classifier,
  style-aware feature-init branch, layered CLAUDE.md template with
  Code map, layered verification block, three new red flags.
- SKILL.eval.yaml: add trigger-03 case covering a Django/FastAPI/
  Temporal-style project with models/, services/, activities/.
- plugin.json: bump 1.1.0 -> 1.2.0 (MINOR, additive, non-breaking).

Rationale: forcing a vertical-slice refactor in a monolith-by-layer
breaks imports, tests and worker/router registrations with risk
disproportionate to the doc-scoping benefit. Layered projects keep
code where it is; docs/features/<feature>/CLAUDE.md maps which layer
files implement each feature.
Update the user-level CLAUDE.md backup to match the new
batuta-project-hygiene behavior:

- Insert a "Decisión previa" section before the hard rules block,
  explaining when to use vertical-slice folders vs docs/features/ for
  layered projects.
- Rewrite hard rule #1 to cover both feature-oriented and layered
  project layouts (previously only covered feature-oriented).
- Extend hard rule #4 auto-detection tree with a layered-project
  branch as the first check, and require explicit style: and
  features-root: fields in the persisted CLAUDE.md convention.
@jota-batuta

Copy link
Copy Markdown
Author

Created against the wrong upstream by mistake. Reopening in jota-batuta/batuta-agent-skills.

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