routine-parameter-design

在定义或重构 API 接口、方法签名或函数参数时,设计和优化参数列表,应用参数数量、排序、传递机制及文档化的最佳实践,以创建清晰、高效且易维护的接口。

仓库最近推送
GitHub Stars
140
Forks
36
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "routine-parameter-design":https://skillpi.com/zh/skills/deepskill-a5c5ffe03d352c3d6d11c31cdde1618e922811e390348b1c17e3ec1f32035f0b。安装前核对上游来源和版本:https://github.com/kitchen-engineer42/pdf2skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

在定义或重构 API 接口、方法签名或函数参数时,设计和优化参数列表,应用参数数量、排序、传递机制及文档化的最佳实践,以创建清晰、高效且易维护的接口。

0 下载

介绍来源: third_party · kitchen-engineer42 · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
输入和输出
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: routine-parameter-design
description: Design and optimize function/method parameter lists when defining or refactoring API interfaces, method signatures, or function parameters. Apply best practices for parameter count, ordering, pass mechanisms, and documentation to create clear, efficient, and maintainable interfaces.

Routine Parameter Design

Use this skill when defining new functions, refactoring existing method signatures, or designing API interfaces to ensure proper parameter design.

When to Use

  • Defining or refactoring a function's parameter list
  • Designing API interfaces or method signatures
  • Reviewing code for parameter-related issues
  • Optimizing function interfaces for clarity and maintainability

Core Design Principles

1. Limit Parameter Count

  • Minimize the number of parameters to improve readability and usability
  • Consider using parameter objects or structs when parameters exceed 3-5 items
  • Each parameter should serve a distinct, necessary purpose

2. Order Parameters (Input-Modify-Output)

Arrange parameters in this specific sequence:

  1. Input parameters: Data the routine reads but does not modify
  2. Modify parameters: Data the routine both reads and modifies
  3. Output parameters: Data the routine writes but does not read

3. Choose Appropriate Pass Mechanisms

  • Pass by value: For primitive types and small objects that won't be modified
  • Pass by reference: For objects that need modification or to avoid copying overhead
  • Objects: Typically passed as object references (not individual fields)
  • Pointers: Follow the asterisk rule (use * consistently for pointer parameters)

4. Ensure Interface Consistency

  • Match actual parameters with formal parameter types
  • Follow language-specific conventions (e.g., C library ordering when applicable)
  • Maintain consistent ordering across related functions
  • Use similar parameter names for similar purposes across the codebase

5. Apply Modifiers Appropriately

  • Use const prefix to prevent modification of input parameters
  • Use in keyword to explicitly mark input-only parameters
  • Use out keyword to explicitly mark output-only parameters
  • Consider inout or equivalent for parameters that are both read and modified

6. Document and Name Clearly

  • Use descriptive, self-documenting parameter names
  • Write clear comments explaining parameter purpose and constraints
  • Document expected ranges, valid values, and edge cases
  • Include units of measurement when applicable

7. Validate Parameter Usage

  • Ensure the routine uses all passed parameters
  • Remove unused parameters to avoid confusion
  • If a parameter is temporarily unused, document why and when it will be used

8. Avoid Global Variables

  • Never use global variables as substitutes for parameters
  • Pass all required data explicitly through the parameter list
  • Global variables make code harder to test, understand, and maintain

Language-Specific Considerations

  • C/C++: Pay attention to pointer vs reference semantics, const correctness
  • Java: All objects are passed by reference; primitives by value
  • Visual Basic: Use ByVal and ByRef keywords explicitly
  • Always check language-specific syntax limitations and conventions

Review Checklist

  • [ ] Parameter count is minimized and reasonable
  • [ ] Parameters follow input-modify-output ordering
  • [ ] Pass mechanism is appropriate for each parameter
  • [ ] Modifiers (const, in, out) are used correctly
  • [ ] All parameters have clear names and documentation
  • [ ] All parameters are actually used by the routine
  • [ ] No global variables are used as parameter substitutes
  • [ ] Interface is consistent with related functions

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值82/100

亮点

  • 提供系统性的函数/API参数设计最佳实践,覆盖参数数量、排序、传递机制等核心维度
  • 适用于广泛开发者场景,具有明确的实用价值和通用性
触发精准92/100

亮点

  • 触发描述清晰完整,涵盖定义、重构、优化等多种使用场景,边界明确
结构规范88/100

亮点

  • 结构完整,包含设计原则、语言特定建议、检查清单,逻辑清晰易遵循
  • frontmatter 完整,文档组织良好
执行可靠65/100

待提升项

  • 缺少可执行示例 原报告严重程度:轻微

    内容为设计原则与检查清单,未提供具体代码示例来验证建议的正确性

    改进建议:建议补充 1-2 个典型语言(如 Python/Java)的参数设计正反示例,提升可操作性

亮点

  • 检查清单设计合理,便于开发者在实际编码中逐项验证
证据可验 (前四项均值)82/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。