[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75HZ8SEXWSA1XHQBG7D7PCS":3,"skill-same:01M75HZ8SEXWSA1XHQBG7D7PCS":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M75HZ8SEXWSA1XHQBG7D7PCS","add-a-rule",null,"How to declare a necroflow rule correctly — command decorators, built-in file rules, placeholders, typed outputs, and common mistakes.","MatteoLacki\u002Fnecroflow","MatteoLacki","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F3964160?v=4","01M75HZ5XZX3Y0EBFWNS5N278P","Matteo","01M75HZ5Z2VGHESSAYCXRHETR6",1,"MIT","https:\u002F\u002Fgithub.com\u002FMatteoLacki\u002Fnecroflow\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fadd-a-rule\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: add-a-rule\ndescription: How to declare a necroflow rule correctly — command decorators, built-in file rules, placeholders, typed outputs, and common mistakes.\n---\n\n# Adding a necroflow rule\n\nFull reference: `docs\u002Frules.md`, `docs\u002Fgenerated-config-files.md`, `src\u002Fnecroflow\u002Frules.py`.\n\n## shell command rules\n\n```python\nimport necroflow as nf\n\n@nf.command\ndef align(fastq: Fastq, ref: str, threads: nf.Resource[int] = 4,\n          ram: nf.Resource[int] = nf.memory_bytes(\"8Gi\")):\n    \"\"\"Align reads to a reference genome with BWA-MEM.\"\"\"\n    bam = nf.outputs(Bam)\n    log = nf.outputs(Log)\n    nf.shell(\"bwa mem -t {threads} {ref} {fastq} > {bam} 2> {log}\")\n    return bam, log\n```\n\n- Bare @command executes the body during construction; register exactly one shell.\n- Function parameters follow ordinary Python binding; Node annotations describe\n  dependencies, plain types describe config, and Resource[T] describes execution quantities.\n- Outputs use real local assignments: `name = outputs(Node)`. Return every\n  declared name exactly once, using a tuple for multiple outputs. The docstring becomes\n  `node.info`.\n- Call the decorated name directly: `bam, log = align(fastq_node, ref=\"hg38\")`.\n- There is no registry or explicit shell-rule constructor.\n\n## Command placeholders — validated during construction\n\nAllowed: declared input names, declared output names, and built-ins:\n\n- `{workdir}` — the rule-call output directory (`nodes\u002F{rule}\u002F{provenance_hash}`), created before\n  execution and reserved as an input\u002Foutput name.\n- `{threads}` (defaults to 1), `{ram}`, other declared constraints; `{constraint:name}`\n  is an explicit, self-documenting alternative to the plain form.\n- Double literal shell braces: `{{left,right}}`. Bash syntax needs an explicit\n  `shellpath=\"\u002Fbin\u002Fbash\"` or `--shellpath`.\n\nAn undeclared shell placeholder fails when its command is called, before execution.\n\n## Reserved names — checked at declaration\n\nAn input\u002Foutput name may not collide with `workdir`, with a constraint the rule\ndeclares, or with `threads` (every rule carries an implicit `threads=1` even without\n`Constraints(...)`). Declaring `Inputs(threads=int)` on a rule constrained with\n`Constraints(threads=8)` — or with no constraints at all — raises `ValueError` when\nthe `@command`\u002F`Rule` runs, not at call time. There is no shadowing: rename the\ninput\u002Foutput, or the constraint.\n\n## Rules of the game\n\n- Generated input\u002Foutput paths are shell-quoted by the template renderer. Argv-list\n  commands are unsupported.\n- The command must write every output; exit 0 with a missing output is a failure.\n- Constraints are scheduling metadata and do not affect fingerprints. `repeat=N` retries failed commands up to N attempts,\n  stopping at the first success; retry policy stays outside fingerprints.\n- Config values are fingerprinted by value. A file path string does not hash that file.\n  Ingest external datasets with `symlink(Type, path)` or\n  `symlink_file_rule(name, OutputType)` so source edits enter stale detection.\n- Subtypes satisfy parent Node inputs; declare the most general true contract.\n\n## Built-in file rules\n\nIngest files directly in workflows; declare text generation with `@text_file`:\n\n```python\nimport necroflow as nf\n\n@nf.text_file\ndef sage_config(text: str):\n    config = nf.outputs(SageConfig)\n    return config\n\n@nf.workflow\ndef build(P, config):\n    P.fastq = nf.symlink(Fastq, config[\"reads\"])\n    P.config = sage_config(text=config[\"sage_config\"])\n```\n\nOutside workflows, use `symlink(Fastq, path, pipeline=P)`. The old\n`@symlink_file` decorator is removed. `symlink_file_rule(...)` supports explicit\nrule\u002Finput\u002Foutput names; `text_file_rule(name, Type, encoding=\"utf-16\")` supports\nnon-default text encodings. `@text_file` is bare-decorator-only. Text content\nparticipates in normal config hashing; neither built-in needs a user shell command.\n","# Adding a necroflow rule\n\nFull reference: `docs\u002Frules.md`, `docs\u002Fgenerated-config-files.md`, `src\u002Fnecroflow\u002Frules.py`.\n\n## shell command rules\n\n```python\nimport necroflow as nf\n\n@nf.command\ndef align(fastq: Fastq, ref: str, threads: nf.Resource[int] = 4,\n          ram: nf.Resource[int] = nf.memory_bytes(\"8Gi\")):\n    \"\"\"Align reads to a reference genome with BWA-MEM.\"\"\"\n    bam = nf.outputs(Bam)\n    log = nf.outputs(Log)\n    nf.shell(\"bwa mem -t {threads} {ref} {fastq} > {bam} 2> {log}\")\n    return bam, log\n```\n\n- Bare @command executes the body during construction; register exactly one shell.\n- Function parameters follow ordinary Python binding; Node annotations describe\n  dependencies, plain types describe config, and Resource[T] describes execution quantities.\n- Outputs use real local assignments: `name = outputs(Node)`. Return every\n  declared name exactly once, using a tuple for multiple outputs. The docstring becomes\n  `node.info`.\n- Call the decorated name directly: `bam, log = align(fastq_node, ref=\"hg38\")`.\n- There is no registry or explicit shell-rule constructor.\n\n## Command placeholders — validated during construction\n\nAllowed: declared input names, declared output names, and built-ins:\n\n- `{workdir}` — the rule-call output directory (`nodes\u002F{rule}\u002F{provenance_hash}`), created before\n  execution and reserved as an input\u002Foutput name.\n- `{threads}` (defaults to 1), `{ram}`, other declared constraints; `{constraint:name}`\n  is an explicit, self-documenting alternative to the plain form.\n- Double literal shell braces: `{{left,right}}`. Bash syntax needs an explicit\n  `shellpath=\"\u002Fbin\u002Fbash\"` or `--shellpath`.\n\nAn undeclared shell placeholder fails when its command is called, before execution.\n\n## Reserved names — checked at declaration\n\nAn input\u002Foutput name may not collide with `workdir`, with a constraint the rule\ndeclares, or with `threads` (every rule carries an implicit `threads=1` even without\n`Constraints(...)`). Declaring `Inputs(threads=int)` on a rule constrained with\n`Constraints(threads=8)` — or with no constraints at all — raises `ValueError` when\nthe `@command`\u002F`Rule` runs, not at call time. There is no shadowing: rename the\ninput\u002Foutput, or the constraint.\n\n## Rules of the game\n\n- Generated input\u002Foutput paths are shell-quoted by the template renderer. Argv-list\n  commands are unsupported.\n- The command must write every output; exit 0 with a missing output is a failure.\n- Constraints are scheduling metadata and do not affect fingerprints. `repeat=N` retries failed commands up to N attempts,\n  stopping at the first success; retry policy stays outside fingerprints.\n- Config values are fingerprinted by value. A file path string does not hash that file.\n  Ingest external datasets with `symlink(Type, path)` or\n  `symlink_file_rule(name, OutputType)` so source edits enter stale detection.\n- Subtypes satisfy parent Node inputs; declare the most general true contract.\n\n## Built-in file rules\n\nIngest files directly in workflows; declare text generation with `@text_file`:\n\n```python\nimport necroflow as nf\n\n@nf.text_file\ndef sage_config(text: str):\n    config = nf.outputs(SageConfig)\n    return config\n\n@nf.workflow\ndef build(P, config):\n    P.fastq = nf.symlink(Fastq, config[\"reads\"])\n    P.config = sage_config(text=config[\"sage_config\"])\n```\n\nOutside workflows, use `symlink(Fastq, path, pipeline=P)`. The old\n`@symlink_file` decorator is removed. `symlink_file_rule(...)` supports explicit\nrule\u002Finput\u002Foutput names; `text_file_rule(name, Type, encoding=\"utf-16\")` supports\nnon-default text encodings. `@text_file` is bare-decorator-only. Text content\nparticipates in normal config hashing; neither built-in needs a user shell command.\n",{"name":5,"description":7},"main","3e33cb65c9af13a7acc2f5bb67401118fb7bc8e4",".claude\u002Fskills\u002Fadd-a-rule",0,"https:\u002F\u002Fgithub.com\u002FMatteoLacki\u002Fnecroflow","https:\u002F\u002Fgithub.com\u002FMatteoLacki","No Bio, go Mech.","2026-11-11 13:24:04",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add MatteoLacki\u002Fnecroflow --skill add-a-rule",{"tool":38,"command":39},"bunx","bunx skills add MatteoLacki\u002Fnecroflow --skill add-a-rule",{"tool":41,"command":42},"pnpm","pnpm dlx skills add MatteoLacki\u002Fnecroflow --skill add-a-rule","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMatteoLacki\u002Fnecroflow\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fadd-a-rule\u002FSKILL.md",true,[],[47,54,61,66,73],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M75HZQ3QM78KEGFEEDTXEJ1H","use-necroflow","Write, inspect, run, and debug downstream Necroflow pipelines with typed artifacts, Python workflows, and job TOMLs. Use when creating or operating a Necroflow workflow; framework internals have separate contributor guidance.","https:\u002F\u002Fgithub.com\u002FMatteoLacki\u002Fnecroflow\u002Fblob\u002Fmain\u002Fsrc\u002Fnecroflow\u002Fskills\u002Fuse-necroflow\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M75HZM61XFRA1BT0D59Z93T1","write-a-scheduler","How to write a custom necroflow RuleCall scheduler using current three-argument protocol.","https:\u002F\u002Fgithub.com\u002FMatteoLacki\u002Fnecroflow\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwrite-a-scheduler\u002FSKILL.md",[],[],{"skillNo":62,"name":49,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M75HZJSD4127JA0T1BFX1ZR6","https:\u002F\u002Fgithub.com\u002FMatteoLacki\u002Fnecroflow\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fuse-necroflow\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M75HZE54RH6Q4J26H1PKET7C","necroflow-style","necroflow coding style for AI agents — invariants and anti-patterns derived from the git history. Load before writing or refactoring necroflow source code.","https:\u002F\u002Fgithub.com\u002FMatteoLacki\u002Fnecroflow\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fnecroflow-style\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M75HZBJ04KWA4SWMRWKC7F2Q","debug-stale-classification","Diagnose why a necroflow RuleCall did or did not rerun using consumed hashes, invalidators, and forced invalidation.","https:\u002F\u002Fgithub.com\u002FMatteoLacki\u002Fnecroflow\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdebug-stale-classification\u002FSKILL.md",[],[]]