[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7E8SA8XV8HF5SE08XD6TFPD":3,"skill-same:01M7E8SA8XV8HF5SE08XD6TFPD":44},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":13,"repositoryHtmlUrl":25,"repositoryHomepageUrl":6,"ownerHtmlUrl":26,"ownerBlogUrl":27,"ownerDescription":28,"updatedAt":29,"install":30,"resources":43},"01M7E8SA8XV8HF5SE08XD6TFPD","2python",null,"suissa\u002FTrajectory-Driven-Development","suissa","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F75607?v=4","01M7E8S58FCAQ2GZN55ZRS9P76","suissAI","01M7E8S59GD0G3Y592ZKANM5C4",0,"Unlicense","https:\u002F\u002Fgithub.com\u002Fsuissa\u002FTrajectory-Driven-Development\u002Fblob\u002Fmain\u002Fdocs\u002FDSL\u002F2python\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"# Trajectory-Driven DSL → Python Skill\n\n## 1. Purpose\n\nThis is the normative projection of T-DD-DSL into Python.\n\nFor DSL specification P and implementation Y:\n\n`Y ⊨ P`\n\nmust be demonstrable through validation, invariant enforcement, tests, and observed evidence.\n\nPython's dynamic runtime must never be used to omit DSL constraints.\n\n## 2. Required profile\n\nPrefer immutable dataclasses\u002Fvalue objects, Enum or Literal for finite states, complete annotations, Protocol for skills, explicit expected-failure types, runtime boundary validation, exhaustive transitions, and deterministic evidence.\n\n## 3. Mapping\n\n| DSL | Python |\n|---|---|\n| D | immutable destiny specification |\n| I | intent dataclass |\n| R | validated input dataclass |\n| B | behavior\u002Ftransition functions |\n| S | Enum\u002FLiteral state model |\n| A | authorization policy |\n| K | Protocol\u002Ffunction skill |\n| E | typed evidence dataclass |\n| X | invariant\u002Fforbidden predicate |\n| T | trajectory sequence |\n| → | ordered relation |\n| ∧ | and |\n| ¬ | not |\n| * | repeated sequence |\n| ⊨ | conformance validator |\n\n## 4. Destiny\n\nDSL:\n\n``text\nD: delivery → requested paid assigned tracked delivered settled\n``\n\nProjection:\n\n``python\nfrom typing import Final\n\nDESTINY: Final = (\n    \"requested\",\n    \"paid\",\n    \"assigned\",\n    \"tracked\",\n    \"delivered\",\n    \"settled\",\n)\n``\n\nThe tuple declares semantic milestones; it is not automatically an imperative program.\n\n## 5. Intent\n\nDSL:\n\n``text\nI: customer → deliver\n``\n\nProjection:\n\n``python\nfrom dataclasses import dataclass\n\n@dataclass(frozen=True)\nclass DeliveryIntent:\n    actor: str\n    goal: str\n``\n\nValidation must enforce the declared actor and goal.\n\n## 6. Required information\n\nDSL:\n\n``text\nR: pickup + dropoff\n``\n\nProjection:\n\n``python\n@dataclass(frozen=True)\nclass DeliveryRequest:\n    pickup: Address\n    dropoff: Address\n\n    def validate(self) -> None:\n        if self.pickup.id == self.dropoff.id:\n            raise ConstraintViolation(\"pickup_equals_dropoff\")\n``\n\nInvalid: behavior starts without both values.\n\n## 7. State\n\nDSL:\n\n``text\nS:\n  requested → collecting → searching → assigned\n  → awaiting_payment → paid → active → arriving\n  → delivered → settled\n``\n\nProjection:\n\n``python\nfrom enum import StrEnum\n\nclass DeliveryState(StrEnum):\n    REQUESTED = \"requested\"\n    COLLECTING = \"collecting\"\n    SEARCHING = \"searching\"\n    ASSIGNED = \"assigned\"\n    AWAITING_PAYMENT = \"awaiting_payment\"\n    PAID = \"paid\"\n    ACTIVE = \"active\"\n    ARRIVING = \"arriving\"\n    DELIVERED = \"delivered\"\n    SETTLED = \"settled\"\n    FAILED = \"failed\"\n``\n\nTransition relation:\n\n``python\nTRANSITIONS = {\n    DeliveryState.REQUESTED: frozenset({DeliveryState.COLLECTING}),\n    DeliveryState.COLLECTING: frozenset({\n        DeliveryState.SEARCHING,\n        DeliveryState.FAILED,\n    }),\n    DeliveryState.SEARCHING: frozenset({\n        DeliveryState.ASSIGNED,\n        DeliveryState.FAILED,\n    }),\n    DeliveryState.ASSIGNED: frozenset({\n        DeliveryState.AWAITING_PAYMENT,\n        DeliveryState.FAILED,\n    }),\n    DeliveryState.AWAITING_PAYMENT: frozenset({\n        DeliveryState.PAID,\n        DeliveryState.FAILED,\n    }),\n    DeliveryState.PAID: frozenset({DeliveryState.ACTIVE}),\n    DeliveryState.ACTIVE: frozenset({\n        DeliveryState.ARRIVING,\n        DeliveryState.FAILED,\n    }),\n    DeliveryState.ARRIVING: frozenset({DeliveryState.DELIVERED}),\n    DeliveryState.DELIVERED: frozenset({DeliveryState.SETTLED}),\n    DeliveryState.SETTLED: frozenset(),\n    DeliveryState.FAILED: frozenset(),\n}\n``\n\nInvalid: `REQUESTED → SETTLED`.\n\n## 8. Actor authorization\n\nDSL:\n\n``text\nA:\n  customer { request address pay code }\n  system   { classify collect discover select charge validate route settle }\n  courier  { accept locate deliver }\n  payment  { confirm reject }\n``\n\nProjection:\n\n``python\nAUTHORIZATION = {\n    \"customer\": frozenset({\"request\", \"address\", \"pay\", \"code\"}),\n    \"system\": frozenset({\n        \"classify\", \"collect\", \"discover\", \"select\",\n        \"charge\", \"validate\", \"route\", \"settle\",\n    }),\n    \"courier\": frozenset({\"accept\", \"locate\", \"deliver\"}),\n    \"payment\": frozenset({\"confirm\", \"reject\"}),\n}\n``\n\n``python\ndef allowed(actor: str, capability: str) -> bool:\n    return capability in AUTHORIZATION.get(actor, frozenset())\n``\n\n`allowed(\"customer\", \"settle\")` must be false.\n\n## 9. Skill\n\nDSL:\n\n``text\nK select_nearest {\n  in: couriers + origin\n  rule: min(distance(courier, origin))\n  out: courier\n  emit: courier.selected\n}\n``\n\nProjection:\n\n``python\nfrom typing import Protocol, Sequence\n\nclass SelectNearest(Protocol):\n    def __call__(\n        self,\n        couriers: Sequence[Courier],\n        origin: Coordinates,\n    ) -> Courier:\n        ...\n``\n\nExample implementation:\n\n``python\ndef select_nearest(\n    couriers: Sequence[Courier],\n    origin: Coordinates,\n) -> Courier:\n    available = [c for c in couriers if c.available]\n    if not available:\n        raise NoAvailableCourier(\"no_available_courier\")\n\n    return min(\n        available,\n        key=lambda courier: distance(courier.location, origin),\n    )\n``\n\nThe algorithm may change; the minimum-distance rule may not.\n\n## 10. Evidence\n\nDSL:\n\n``text\nE:\n  request.received\n  → intent.recognized\n  → addresses.collected\n  → courier.selected\n  → payment.confirmed\n``\n\nProjection:\n\n``python\nfrom dataclasses import dataclass\nfrom typing import Literal\n\nEvidenceKind = Literal[\n    \"request.received\",\n    \"intent.recognized\",\n    \"addresses.collected\",\n    \"courier.selected\",\n    \"payment.confirmed\",\n]\n\n@dataclass(frozen=True)\nclass Evidence:\n    kind: EvidenceKind\n    at: int\n``\n\nUndeclared evidence is invalid.\n\n## 11. Repetition\n\nDSL:\n\n``text\nlocation.received*\n``\n\nProjection:\n\n``python\nlocation_evidence: tuple[Evidence, ...]\n``\n\nZero or many observations are valid.\n\n## 12. Logic\n\nDSL:\n\n``text\npayment = confirmed ∧ location = dropoff\n``\n\nPython:\n\n``python\nvalid = (\n    payment.status == \"confirmed\"\n    and location.id == dropoff.id\n)\n``\n\nDSL:\n\n``text\n¬(payment = confirmed)\n``\n\nPython:\n\n``python\nif payment.status != \"confirmed\":\n    raise ForbiddenTransition(\"payment_not_confirmed\")\n``\n\nThe semantic error identity must be preserved.\n\n## 13. Forbidden scenarios\n\nDSL:\n\n``text\nX:\n  ¬ release(payment ≠ confirmed)\n  ¬ settle(code ≠ valid)\n  ¬ select(courier ∉ available)\n``\n\nProjection must reject each forbidden condition before its capability succeeds.\n\n## 14. Transition enforcement\n\n``python\ndef transition(\n    current: DeliveryState,\n    target: DeliveryState,\n) -> DeliveryState:\n    if target not in TRANSITIONS[current]:\n        raise IllegalTransition(\"undeclared_transition\")\n    return target\n``\n\nArbitrary strings must not bypass this boundary.\n\n## 15. Evidence\u002Fstate invariant\n\nWhen evidence establishes a state transition, establish evidence before exposing the new state.\n\nInvalid:\n\n``python\nstate = DeliveryState.PAID\nemit_payment_confirmed()\n``\n\nValid:\n\n``python\nemit_payment_confirmed()\nstate = DeliveryState.PAID\n``\n\nprovided all other constraints hold.\n\n## 16. Async and concurrency\n\nAsync does not weaken semantic order.\n\nValid:\n\n``python\nawait confirm_payment()\nawait release_delivery()\n``\n\nInvalid when release depends on confirmation:\n\n``python\nawait asyncio.gather(\n    release_delivery(),\n    confirm_payment(),\n)\n``\n\nConcurrent duplicate operations must not create incompatible semantic states. Use idempotency, transactionality, compare-and-set, serialization, or another equivalent mechanism.\n\n## 17. External boundaries\n\nValidate:\n\n- channel messages;\n- HTTP\u002Fwebhooks;\n- provider responses;\n- persisted data;\n- agent outputs.\n\nAnnotations alone are not runtime validation.\n\n## 18. Valid scenarios\n\n- complete delivery trajectory;\n- remaining in `searching` while no courier exists when permitted;\n- multiple location evidence items under `*`.\n\n## 19. Invalid scenarios\n\n- release before payment;\n- settlement with invalid code;\n- unavailable courier;\n- unauthorized customer settlement;\n- undeclared state transition;\n- undeclared evidence;\n- state change without required evidence.\n\n## 20. Test obligations\n\nFor every DSL declaration provide:\n\n- valid test;\n- invalid test;\n- boundary test;\n- invariant test;\n- forbidden-scenario test;\n- conformance test.\n\nFor `*` test zero and multiple occurrences.\n\nFor `→` test legal and illegal edges.\n\nFor each actor capability test allowed and denied execution.\n\n## 21. Property-oriented tests\n\nTests should represent DSL properties.\n\n``python\n@given(valid_requests())\ndef test_pickup_and_dropoff_are_distinct(request):\n    assert request.pickup.id != request.dropoff.id\n``\n\n``python\n@given(illegal_transitions())\ndef test_illegal_transition_is_rejected(pair):\n    with pytest.raises(IllegalTransition):\n        transition(*pair)\n``\n\n## 22. Forbidden shortcuts\n\nDo not bypass validation, use arbitrary string states, emit undeclared evidence, infer authorization from names, downgrade forbidden conditions to warnings, or modify the DSL merely because implementation is inconvenient.\n\n## 23. Correctness\n\n`runtime_behavior ⊨ DSL`\n\nis the final semantic judgment.\n\n\n## 24. Generator and projection failure mitigation\n\nGeneration failures are compilation failures, not reasons to weaken the DSL.\n\nRequired handling:\n\n| Failure | Meaning | Mitigation |\n|---|---|---|\n| syntax error | source cannot be parsed | fix DSL structure; do not generate |\n| unresolved actor\u002Fstate\u002Fevidence | semantic name has no declaration | add\u002Fresolve the declaration |\n| invalid behavior term | behavior shape is outside grammar | correct the behavior expression |\n| unsupported target | generator has no projection | implement the target profile before use |\n| runtime failure | generated Python violates the DSL | fix generator\u002Fruntime, not the specification |\n| nondeterministic output | same source produces different output | normalize ordering and serialization |\n| generated tests fail | semantic projection is incomplete | inspect the violated DSL obligation and repair the generator |\n\nA generator must fail closed. A partial Python module is never a successful projection.\n\nCI must verify:\n\n1. compiler validation;\n2. generation;\n3. language classification;\n4. runtime execution;\n5. deterministic regeneration.\n\nPython must preserve finite semantic domains with `StrEnum`, `Literal`, immutable values or equivalent runtime checks. Dynamic typing must not turn a DSL state or actor into an arbitrary string.\n",{},"main","640605c2608d1afc423c4453c644526230c2bc21","docs\u002FDSL\u002F2python","https:\u002F\u002Fgithub.com\u002Fsuissa\u002FTrajectory-Driven-Development","https:\u002F\u002Fgithub.com\u002Fsuissa","https:\u002F\u002Faurora.austral.codes","VibeCoding State-of-the-Art-Driven Development\r\n @AllasCodeInstitute Researcher","2026-10-19 16:46:22",{"source":7,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add suissa\u002FTrajectory-Driven-Development --skill 2python",{"tool":36,"command":37},"bunx","bunx skills add suissa\u002FTrajectory-Driven-Development --skill 2python",{"tool":39,"command":40},"pnpm","pnpm dlx skills add suissa\u002FTrajectory-Driven-Development --skill 2python","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsuissa\u002FTrajectory-Driven-Development\u002Fblob\u002Fmain\u002Fdocs\u002FDSL\u002F2python\u002FSKILL.md",true,[],[45,51],{"skillNo":46,"name":47,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":48,"categories":49,"keywords":50,"publishedAt":18},"01M7E8SER2TXHN5NYMQ1TSCX12","2typescript","https:\u002F\u002Fgithub.com\u002Fsuissa\u002FTrajectory-Driven-Development\u002Fblob\u002Fmain\u002Fdocs\u002FDSL\u002F2typescript\u002FSKILL.md",[],[],{"skillNo":52,"name":53,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":54,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":18},"01M7E8S7ME3NK5G01HGMZ5S8H5","Trajectory-Driven-Development","https:\u002F\u002Fgithub.com\u002Fsuissa\u002FTrajectory-Driven-Development\u002Fblob\u002Fmain\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsuissa\u002FTrajectory-Driven-Development\u002Fblob\u002Fmain\u002FSKILL.md",[],[]]