[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7C0HXPWJZFHBZG6223F2JPD":3,"skill-same:01M7C0HXPWJZFHBZG6223F2JPD":45},{"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":6,"updatedAt":30,"install":31,"resources":44},"01M7C0HXPWJZFHBZG6223F2JPD","typescript-functions",null,"Style and good practices when implementing or refactoring TypeScript functions and methods","fabiommendes\u002Fcodehood","fabiommendes","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1248626?v=4","01M7B2WVHQWE1G2F5M3BGZ15BV","Fábio Macêdo Mendes","01M7C0GNT3JXJAT1KEPF3PDAT1",1,"AGPL-3.0","https:\u002F\u002Fgithub.com\u002Ffabiommendes\u002Fcodehood\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Ftypescript-functions\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: typescript-functions\ndescription: Style and good practices when implementing or refactoring TypeScript functions and methods\n---\n\n# typescript-functions\n\nBest practices and style guide for implementing TypeScript functions and methods.\n\n\n## Architecture\n\nAvoid side-effects. Most functions and methods should be pure or at least\nprovide local reasoning. Leave the most egregious side effects either to the\nframework or to an outer layer of the application.\n\nFor reference, the list shows effects from best to worst. \n\n* no side effects, pure function (best).\n* logging.\n* local mutation of self.\n* local mutation of input args.\n* caching.\n* print and input.\n* file I\u002FO, \n* database access.\n* image display, sound, complex rendering of markup.\n* network access.\n* global mutation of application behavior (worst).\n\nTry to keep implementations as high as possible in this list.\n\n## Testing\n\nPure functions should be tested with examples in unit tests. If the function\nrespect some invariant, use property-based testing to generate a wide range of \nTypeScript's `fast-check` library is a good choice for this.\n\nFunctions up to \"local mutation of input args\" can be tested with no special setup.\nAlways use property based tests, when an invariant is known. \n\nFunctions that use caching should usually reset the cache before each test.\n\nFunctions with simple IO should capture output using appropriate mocking for\n`console.log` and `console.error` and for `prompt`.\n\nFunctions that read files should use mocking and functions that write files\nshould do so in temporary directories, e.g., using the `tmp` library.\n\nFunctions that access databases should use transactions and rollbacks to avoid \nleaving the database in a dirty state. Many frameworks provide built-in support \nfor this via pytest fixtures.\n\nFunctions that produces complex multimedia usually should be tested via approval\ntesting. Python have the approvaltests.Python library for this.\n\nNetwork access should usually be mocked in unit tests and tested in integration \ntests.\n\nWhen a function produces a global mutation of application behavior, it should \nshould also provide a snapshot mechanism that restore the application to its \nprevious state. Ideally it should be done using context managers. Ask the user\nif this mechanism should be exposed as a public API or not.\n\n\n## Coding style\n\nNames of functions are camelCase. Always document public functions. Always type\ninput and output parameters. At toplevel, use `function` declarations instead of\n`const` with arrow functions. Use arrow functions as callbacks and for inner\nfunctions.\n\n\n## Arguments\n\nUse at most 4 positional arguments in a function. If it has more then 4\nparameters, use a single object parameter with named properties.\n\nIf the function has more than 2 arguments of the same type, prefer an object \nparameter with named properties. Break this rule if the function expresses a \nclear relation between the two arguments or if the position does not matter.\n\nA clear relation has form `word(first, second)` and can be understood as\n`first word second`.\n\n```typescript\n\u002F\u002F good\nfunction join(a: string, b: string): string { ... }\nfunction hasPrefix(text: string, prefix: string): boolean { ... }\nfunction replace(text: string, { sub, by }: { sub: string, by: string }): string { ... }\n\n\u002F\u002F bad\nfunction replace(text: string, sub: string, by: string): string { ... }\n```\n\nIf the function expresses a relation between two arguments and the role of each\nargument is implicit by position, also require them to be positional. E.g., \n\n```python\ndef swap[T](a: T, b: T, \u002F) -> tuple[T, T]: ...\n```\n\nIf the function has more than one optional argument with the same type, require\nboth to be keyword-only. If it has more than 3 optional arguments, require all\nof them to be keyword-only. Use the `*` symbol to enforce this in the function\nsignature. E.g., \n\n```python\ndef join_items(data: Iterable[str], *, sep: str = \",\", end: str = \"\\n\") -> str: ...\n```\n\nIf the function does not change the input args, prefer interfaces over concrete types.\n\n\n## Documentation comments\n\nUse JSDoc style. Always break the block comment to have more then one line,\neven for short comments, e.g.,\n\n```typescript\n\u002F**\n * Return a new array in reverse order of elements.\n *\u002F\nfunction reverse() {\n    \u002F\u002F ...\n}\n```\n\nUse markdown to structure information (e.g., lists, code blocks).\n\nThe first line should be a short summary of the function's purpose. If there are\nmore relevant details, they should be included as one or more paragraphs\nseparated by blank lines.\n\nUse JSDoc tags `@param`, `@returns`, and `@throws` to document parameters,\nreturn values and exceptions. Do not include the types in the `@param` and\n`@returns` tags. Specify them in the function signature.\n\nPut a blank line before the first `@param` tag and before the `@returns` tag and `@throws` tags. \n\nPublic functions that do not produce side effects should be documented with a\ndoctest example. Use the `@example` tag. Skip the test if it is too complex or\nrequires too much external dependencies or preparation.\n\nBelow is a good example of how to document a function:\n\n```typescript\n\u002F** \n  * Return a new array in reverse order of elements.\n  *\n  * @example reverse([1, 2, 3]) \n  * \u002F\u002F=> [3,2,1]\n  * \n  * @param arr - The array to reverse.\n  * @param inplace - If true, reverse the array in place. Otherwise, return a new array.\n  *\n  * @returns A new array with the elements in reverse order.\n  *\u002F \nfunction reverse\u003CT>(arr: T[], inplace: boolean = false): T[] {\n    return inplace? arr.reverse() : [...arr].reverse();\n}\n```\n","# typescript-functions\n\nBest practices and style guide for implementing TypeScript functions and methods.\n\n\n## Architecture\n\nAvoid side-effects. Most functions and methods should be pure or at least\nprovide local reasoning. Leave the most egregious side effects either to the\nframework or to an outer layer of the application.\n\nFor reference, the list shows effects from best to worst. \n\n* no side effects, pure function (best).\n* logging.\n* local mutation of self.\n* local mutation of input args.\n* caching.\n* print and input.\n* file I\u002FO, \n* database access.\n* image display, sound, complex rendering of markup.\n* network access.\n* global mutation of application behavior (worst).\n\nTry to keep implementations as high as possible in this list.\n\n## Testing\n\nPure functions should be tested with examples in unit tests. If the function\nrespect some invariant, use property-based testing to generate a wide range of \nTypeScript's `fast-check` library is a good choice for this.\n\nFunctions up to \"local mutation of input args\" can be tested with no special setup.\nAlways use property based tests, when an invariant is known. \n\nFunctions that use caching should usually reset the cache before each test.\n\nFunctions with simple IO should capture output using appropriate mocking for\n`console.log` and `console.error` and for `prompt`.\n\nFunctions that read files should use mocking and functions that write files\nshould do so in temporary directories, e.g., using the `tmp` library.\n\nFunctions that access databases should use transactions and rollbacks to avoid \nleaving the database in a dirty state. Many frameworks provide built-in support \nfor this via pytest fixtures.\n\nFunctions that produces complex multimedia usually should be tested via approval\ntesting. Python have the approvaltests.Python library for this.\n\nNetwork access should usually be mocked in unit tests and tested in integration \ntests.\n\nWhen a function produces a global mutation of application behavior, it should \nshould also provide a snapshot mechanism that restore the application to its \nprevious state. Ideally it should be done using context managers. Ask the user\nif this mechanism should be exposed as a public API or not.\n\n\n## Coding style\n\nNames of functions are camelCase. Always document public functions. Always type\ninput and output parameters. At toplevel, use `function` declarations instead of\n`const` with arrow functions. Use arrow functions as callbacks and for inner\nfunctions.\n\n\n## Arguments\n\nUse at most 4 positional arguments in a function. If it has more then 4\nparameters, use a single object parameter with named properties.\n\nIf the function has more than 2 arguments of the same type, prefer an object \nparameter with named properties. Break this rule if the function expresses a \nclear relation between the two arguments or if the position does not matter.\n\nA clear relation has form `word(first, second)` and can be understood as\n`first word second`.\n\n```typescript\n\u002F\u002F good\nfunction join(a: string, b: string): string { ... }\nfunction hasPrefix(text: string, prefix: string): boolean { ... }\nfunction replace(text: string, { sub, by }: { sub: string, by: string }): string { ... }\n\n\u002F\u002F bad\nfunction replace(text: string, sub: string, by: string): string { ... }\n```\n\nIf the function expresses a relation between two arguments and the role of each\nargument is implicit by position, also require them to be positional. E.g., \n\n```python\ndef swap[T](a: T, b: T, \u002F) -> tuple[T, T]: ...\n```\n\nIf the function has more than one optional argument with the same type, require\nboth to be keyword-only. If it has more than 3 optional arguments, require all\nof them to be keyword-only. Use the `*` symbol to enforce this in the function\nsignature. E.g., \n\n```python\ndef join_items(data: Iterable[str], *, sep: str = \",\", end: str = \"\\n\") -> str: ...\n```\n\nIf the function does not change the input args, prefer interfaces over concrete types.\n\n\n## Documentation comments\n\nUse JSDoc style. Always break the block comment to have more then one line,\neven for short comments, e.g.,\n\n```typescript\n\u002F**\n * Return a new array in reverse order of elements.\n *\u002F\nfunction reverse() {\n    \u002F\u002F ...\n}\n```\n\nUse markdown to structure information (e.g., lists, code blocks).\n\nThe first line should be a short summary of the function's purpose. If there are\nmore relevant details, they should be included as one or more paragraphs\nseparated by blank lines.\n\nUse JSDoc tags `@param`, `@returns`, and `@throws` to document parameters,\nreturn values and exceptions. Do not include the types in the `@param` and\n`@returns` tags. Specify them in the function signature.\n\nPut a blank line before the first `@param` tag and before the `@returns` tag and `@throws` tags. \n\nPublic functions that do not produce side effects should be documented with a\ndoctest example. Use the `@example` tag. Skip the test if it is too complex or\nrequires too much external dependencies or preparation.\n\nBelow is a good example of how to document a function:\n\n```typescript\n\u002F** \n  * Return a new array in reverse order of elements.\n  *\n  * @example reverse([1, 2, 3]) \n  * \u002F\u002F=> [3,2,1]\n  * \n  * @param arr - The array to reverse.\n  * @param inplace - If true, reverse the array in place. Otherwise, return a new array.\n  *\n  * @returns A new array with the elements in reverse order.\n  *\u002F \nfunction reverse\u003CT>(arr: T[], inplace: boolean = false): T[] {\n    return inplace? arr.reverse() : [...arr].reverse();\n}\n```\n",{"name":5,"description":7},"main","bd51a80f42ea533b45c523008c3361a46bc3ed3a",".claude\u002Fskills\u002Ftypescript-functions",0,"https:\u002F\u002Fgithub.com\u002Ffabiommendes\u002Fcodehood","https:\u002F\u002Fgithub.com\u002Ffabiommendes","2026-11-15 05:44:14",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add fabiommendes\u002Fcodehood --skill typescript-functions",{"tool":37,"command":38},"bunx","bunx skills add fabiommendes\u002Fcodehood --skill typescript-functions",{"tool":40,"command":41},"pnpm","pnpm dlx skills add fabiommendes\u002Fcodehood --skill typescript-functions","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Ffabiommendes\u002Fcodehood\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Ftypescript-functions\u002FSKILL.md",true,[],[46,53,60,67,74,81],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M7C0JM7A0PBSDW9R7M6C79JN","unslop","Cut AI tells from any writing. Must always apply.","https:\u002F\u002Fgithub.com\u002Ffabiommendes\u002Fcodehood\u002Fblob\u002Fmain\u002Fcli\u002F.claude\u002Fskills\u002Funslop\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7C0JJYQCZM1X851ABVDQ5QZ","python-publish","Guidelines to publish Python packages","https:\u002F\u002Fgithub.com\u002Ffabiommendes\u002Fcodehood\u002Fblob\u002Fmain\u002Fcli\u002F.claude\u002Fskills\u002Fpython-publish\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7C0JHDJFYY2KKPP9B0TKBDY","python-projects","Style and good practices when implementing Python projects","https:\u002F\u002Fgithub.com\u002Ffabiommendes\u002Fcodehood\u002Fblob\u002Fmain\u002Fcli\u002F.claude\u002Fskills\u002Fpython-projects\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7C0JFZNESV9HMQW8V35DZ9D","python-paths","Good practices when working with file paths in Python","https:\u002F\u002Fgithub.com\u002Ffabiommendes\u002Fcodehood\u002Fblob\u002Fmain\u002Fcli\u002F.claude\u002Fskills\u002Fpython-paths\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7C0JE3YZNMMDYM17DP681SM","python-modules","Style and good practices when implementing or refactoring Python modules","https:\u002F\u002Fgithub.com\u002Ffabiommendes\u002Fcodehood\u002Fblob\u002Fmain\u002Fcli\u002F.claude\u002Fskills\u002Fpython-modules\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7C0JCAR3N81GQ8Z068FTYX9","python-functions","Style and good practices when implementing or refactoring Python functions and methods","https:\u002F\u002Fgithub.com\u002Ffabiommendes\u002Fcodehood\u002Fblob\u002Fmain\u002Fcli\u002F.claude\u002Fskills\u002Fpython-functions\u002FSKILL.md",[],[]]