/timefold-java-skill:timefold-javafrom timefold-java-skill
Guides modeling scheduling/planning systems in Java using Timefold: 6-step methodology from business description to domain classes, constraints, and solver config.
Ships in timefold-java-skill. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
核心定位:从业务需求 → Timefold 领域模型 + 约束 + 求解器配置的方法论 + 能力目录。
不是"场景查找表"。遇到任何新排程需求(教学排课、车辆路径、人员排班、半导体生产排程、项目调度 ...)都走同一套 6 步法。
使用本 skill 当用户请求涉及:
拿到需求先做 6 步抽象,不要直接写代码。详见 references/modeling-methodology.md。
@PlanningEntity)@PlanningVariable / @PlanningListVariable)@ValueRangeProvider 位置)@InverseRelationShadowVariable / @PreviousElementShadowVariable / @ShadowVariable + @ShadowSources / @CascadingUpdateShadowVariable)每一步对应的能力都在 references/capability-catalog.md。
完整细节见 references/capability-catalog.md。
| 建模需求 | Timefold 能力 | 能力目录章节 |
|---|---|---|
| 实体从值域选 1 个 | @PlanningVariable | §1 |
| 实体排成有序列表(路径 / 工序链 / 装载) | @PlanningListVariable + 配套 shadow | §2 |
| 反查列表载体 | @InverseRelationShadowVariable | §3.1 |
| 列表中的前 / 后 / 索引 | @PreviousElementShadowVariable / @NextElementShadowVariable / @IndexShadowVariable | §3.2 / §3.3 |
| 派生字段(到达时间、总成本) | @ShadowVariable(supplierName) + @ShadowSources | §3.4 |
| 沿列表级联派生 | @CascadingUpdateShadowVariable | §3.5 |
| 允许部分实体不分配 | allowsUnassigned=true / allowsUnassignedValues=true | §4 |
| 冻结已确定的排程 | @PlanningPin / @PlanningPinToIndex | §5 |
| 动态值域(按实体过滤) | 实体级 @ValueRangeProvider | §6 |
| 选分数类型 | HardSoftScore / HardMediumSoftScore / BendableScore / *LongScore | §7 |
| 约束逻辑 | ConstraintProvider + ConstraintStream DSL | §8 |
| 运行时调权重 | ConstraintWeightOverrides | §8.2 |
| 异步求解(Web 服务) | SolverManager | §9.2 |
| 分数解释 | SolutionManager.analyze() | §9.3 |
| 实时变更 | ProblemChange | §10 |
| 大规模加速 | Nearby Selection | §11 |
| 区间聚类 / 间隙检测 | toConnectedRanges / toConnectedTemporalRanges | §13 |
| 方案对比(Preview) | SolutionManager.diff() | §14 |
| 自定义 Move(Preview) | Neighborhoods API | §15 |
| 新元启发式(Preview) | Diversified Late Acceptance | §16 |
写 ConstraintStream 前先查 references/constraint-cookbook.md:
forEachUniquePair + Joiners.overlappingforEach + filter 前置.endTime vs 当前.startTimegroupBy + sum + filtergroupBy + count + filterifNotExists / forEachIncludingUnassignedifExists / filterConstraintCollectors.loadBalance 或平方惩罚toConnectedRanges / toConnectedTemporalRanges见 references/solver-tuning.md:
spent-limit + unimproved-spent-limitenvironment-mode=REPRODUCIBLE + random-seedenablePreviewFeature(Diversified Late Acceptance / Neighborhoods / Solution Diff)timefold-solver-spring-boot-starter + timefold.solver.* propertiestimefold-solver-quarkus + quarkus.timefold.solver.* propertiesSolverFactory.create(new SolverConfig()...)骨架可直接复用:assets/skeleton/(pom.xml + Entity/Value/Solution/ConstraintProvider/App/Test 全套)。
见 references/testing-patterns.md:
ConstraintVerifier 单测(违反 N 次 / 违反 0 次 / 边界)SolutionManager.analyze| 错误 | 修正 |
|---|---|
派生字段标 @PlanningVariable | 改 @ShadowVariable / @CascadingUpdateShadowVariable |
用 sourceVariableName / variableListenerClass(deprecated since 1.27) | 用 supplierName + @ShadowSources |
用 @PlanningVariable(graphType=CHAINED)(deprecated since 1.31) | 用 @PlanningListVariable |
@ValueRangeProvider 返回值依赖规划变量 | 只能依赖 problem facts |
| 时间直接当 PlanningVariable | 时间通常是 shadow,变量是序列位置或离散时段 |
| supplier 里做 IO / 改字段 | supplier 必须纯函数 |
| 一个方法堆多条约束 | 一条业务规则 = 一个方法 = 一个 .asConstraint("名") |
对齐 timefold-solver 1.33+(group ai.timefold.solver;旧版 org.optaplanner.* 已迁移)。Java 17+ required。
assets/skeleton/README.md (opens in a new tab)assets/skeleton/pom.xml (opens in a new tab)assets/skeleton/src/main/java/com/example/App.java (opens in a new tab)assets/skeleton/src/main/java/com/example/domain/MyEntity.java (opens in a new tab)assets/skeleton/src/main/java/com/example/domain/MySolution.java (opens in a new tab)assets/skeleton/src/main/java/com/example/domain/MyValue.java (opens in a new tab)assets/skeleton/src/main/java/com/example/solver/MyConstraintProvider.java (opens in a new tab)assets/skeleton/src/test/java/com/example/solver/MyConstraintProviderTest.java (opens in a new tab)references/capability-catalog.md (opens in a new tab)references/constraint-cookbook.md (opens in a new tab)references/integration.md (opens in a new tab)references/modeling-methodology.md (opens in a new tab)references/solver-tuning.md (opens in a new tab)references/testing-patterns.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub 3taste/timefold-java-skill --plugin timefold-java-skill