AgentSkillsCN

scaffold-router

根据任务特性,自动路由至正确的 Maven 模块或软件包,并精准选择本地仓库中的生成器技能。以路径优先,辅以意图Fallback机制。

SKILL.md
--- frontmatter
name: scaffold-router
description: "Routes tasks to the correct Maven module/package and selects the right repo-local generator skill. Path-first, intent fallback."

Scaffold Router

Variables are defined in .codex/skills/VARIABLES.md.

Goal

Given a change request, choose:

  1. Maven module (domain/app/infra/adapter/start)
  2. Package path consistent with existing package-info.java
  3. The most specific skill to use next

This skill is a meta-skill: it does not generate code by itself unless a suitable generator skill does not exist.

Routing algorithm (must follow)

  1. If the user provides a file path, route by path (see mapping below).
  2. Resolve {{domainModuleDir}}/{{appModuleDir}}/{{infraModuleDir}}/{{adapterModuleDir}}/{{startModuleDir}}:
    • Prefer scanning pom.xml and locating modules by artifactId suffix (-domain/-app/-infra/-adapter/-start).
  3. Resolve {{basePackage}} / {{basePackagePath}} from src/main/java/**/package-info.java if not provided.
  4. If module/package is still ambiguous, ask one question to confirm.
  5. Infer module + package from:
    • existing package-info.java patterns in the target module
    • the type of artifact requested (PO/Mapper/Flyway/Job/Consumer/etc.)
  6. Select one generator skill. Always apply scaffold-architecture-guardrails as a checklist.

Precedence rule

When multiple path patterns match, choose the most specific one:

  • infra/repository/**, infra/query/**, infra/gateway/** override the generic infra/**/po|mapper mapping.
  • db/migration/** overrides generic infra mappings.

Path → skill mapping

The mapping below is module-agnostic. Apply it within the selected module directory.

More specific:

  • **/db/migration/**infra-flyway-migration-generator
  • **/infra/repository/biz/**infra-bc-repository-generator
  • **/infra/query/biz/**infra-bc-query-generator
  • **/infra/gateway/**infra-system-gateway-generator
  • **/infra/**/po/** or **/infra/**/mapper/**infra-mybatis-po-mapper-generator
  • **/adapter/scheduler/**adapter-scheduler-job-generator
  • **/start/src/main/resources/**.yml / **.yamlstart-yaml-config-generator

One question policy

Ask one question when routing is ambiguous. Prefer multiple-choice.

Common disambiguations:

  • unit test vs integration test
  • event retry semantics (retryable vs non-retryable)
  • storage choice (single table vs 2 tables) where applicable