agentleFS
soujavasoujava/agent-skills/skills/sdd4j-package-by-feature/SKILL.md

sdd4j-package-by-feature

Skill10 starsChanged 4 months agoMITView on GitHub

SDD4J architecture adapter for Java projects organized by feature or capability package. Use with SDD4J and Java stack skills when each feature owns a package containing its spec, entrypoints, application code, domain/model code, and tests. Trigger on sdd4j-package-by-feature, package-by-feature, feature package, vertical slice package, capability package, or Java architecture mapping for co-located specs.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this adapter only when the project accepts strict feature-package ownership: one SDD4J capability maps to one feature package, and …

    line 14
  2. Distinctive:

    Do not mix this adapter with layered or BCE mapping inside the same capability.

    line 24
  3. Distinctive:

    Use this shape unless the project's AGENTS.md declares a different mapping:

    line 28
  4. Distinctive:

    When composed with SDD4J:

    line 49
  5. Distinctive:

    If the controller method is the only stable boundary, map the operation to the controller method.

    line 64
  6. Distinctive:

    Do not force every operation to have both controller and service methods.

    line 68
  7. Distinctive:

    Use this compact project mapping when defaults do not fit:

    line 100
  8. Distinctive:

    If the project has feature packages plus a few shared packages, treat shared packages as cross-cutting implementation unless the SDD4J …

    line 116

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: Package By Feature

Objective

Map a Java capability to one feature-owned package. This skill owns architecture layout only. Compose it with sdd4j for spec workflow and with a stack skill for framework idioms and verification.

Use this adapter only when the project accepts strict feature-package ownership: one SDD4J capability maps to one feature package, and contract-relevant code for that capability stays in or below that package unless AGENTS.md declares a shared or cross-cutting exception.

Architecture Invariants

  • The project or module has sdd4j-package-by-feature as its primary SDD4J architecture adapter.
  • One SDD4J capability maps to one Java feature package.
  • The feature package is the capability identity and the default ownership boundary.
  • The capability spec lives in that package's package-info.java.
  • Contract-relevant entrypoints, application operations, domain/model/entity types, and capability tests belong in the feature package, its subpackages, or a declared mirrored test package.
  • Shared packages are exceptional. They must be declared in AGENTS.md or treated as cross-cutting implementation outside the capability contract.
  • Do not mix this adapter with layered or BCE mapping inside the same capability.

Default Layout

Use this shape unless the project's AGENTS.md declares a different mapping:

src/main/java/<base>/<capability>/
  package-info.java
  <Capability>Controller.java       # optional, stack-specific entrypoint
  <Capability>Service.java          # optional, application operation owner
  <DomainType>.java                 # domain/model/entity types
  web/                              # optional
  application/                      # optional
  domain/                           # optional
  persistence/                      # optional

src/test/java/<base>/<capability>/
  <Capability>Test.java

The capability package is the architecture unit. Prefer co-locating related code under that package instead of spreading classes across global controller, service, repository, or model packages. A project dominated by global layer packages is not a feature-package project; use sdd4j-package-by-layer or define an explicit project mapping instead.

SDD4J Mapping

When composed with SDD4J:

  • An SDD4J capability maps to one Java feature package.
  • The spec lives at the feature package's package-info.java.
  • The capability name maps to the final package segment unless AGENTS.md declares another pattern.
  • ## Boundary operations map to public entrypoints or application operations inside the feature package.
  • ## Entities entries map to domain, model, aggregate, value object, or persistence entity classes inside the feature package or its subpackages.
  • Internal helpers, configuration classes, mappers, repositories, adapters, and persistence details are implementation unless the spec explicitly declares them as contract-relevant entities or operations.
  • Requirement ids must resolve to their exact runner-visible forms in executable tests or cases under the mirrored test package or the stack's test location. Traces may use literal ids or resolvable symbols; JavaDoc and comments alone do not count.

Operation Mapping

Map each transport-neutral operation to the narrowest stable code entrypoint:

  • For HTTP applications, prefer the application method behind the controller when that method is stable and testable.
  • If the controller method is the only stable boundary, map the operation to the controller method.
  • For event-driven code, map to the listener or handler method that receives the event.
  • For CLI code, map to the command or use-case method.

Do not force every operation to have both controller and service methods. The stack skill decides idiomatic structure.

Drift Detection

Detect spec-to-code gaps:

  • A ## Boundary operation has no mapped entrypoint or application operation in the feature package.
  • A ## Entities item has no matching domain/model/entity type when the architecture mapping says it should be materialized.
  • A requirement id has no executable test trace.

Detect code-to-spec drift:

  • A public entrypoint or application operation in the feature package is not represented in ## Boundary.
  • A domain/model/entity type appears contract-relevant but is absent from ## Entities.
  • A test under the feature package references a requirement id not present in the spec.
  • Contract-relevant capability code lives outside the feature package without a declared shared-package or adapter-routing rule.

Surface drift to the user. Do not rewrite the spec to match code without explicit instruction.

Fit And Rejection Rules

This adapter fits when new capabilities can be added as self-contained packages and existing capabilities have stable package ownership.

Reject or ask for a different mapping when:

  • Most capability code is organized primarily by technical layer.
  • A single capability must be split across unrelated package roots without an explicit mapping.
  • Multiple feature packages share the same mutable domain model without a declared shared contract.
  • The project wants BCE layer semantics inside each capability package; use sdd4j-bce instead.

AGENTS.md Override

Use this compact project mapping when defaults do not fit:

## SDD4J

Architecture layout:
- skill: `sdd4j-package-by-feature`
- scope: primary project architecture
- source root: `src/main/java`
- base package: `com.acme`
- capability package pattern: `com.acme.<capability>`
- test package mirrors main package: true
- entrypoint packages: same package, `web`, `application`
- entity packages: same package, `domain`, `model`, `persistence`

If the project has feature packages plus a few shared packages, treat shared packages as cross-cutting implementation unless the SDD4J system doc or AGENTS.md declares them part of a capability contract.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.