routine-parameter-design
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "routine-parameter-design" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-a5c5ffe03d352c3d6d11c31cdde1618e922811e390348b1c17e3ec1f32035f0b. Verify the upstream source and version against https://github.com/kitchen-engineer42/pdf2skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Design and optimize parameter lists when defining or refactoring API interfaces, method signatures, or function parameters, applying best practices for parameter count, ordering, passing mechanisms, and documentation to create clear, efficient, and maintainable interfaces.
Introduction source: third_party · kitchen-engineer42 · 0.0.1 Reference
SkillPi interpretation
- Tasks
- 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.
- Audience
- 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
- Inputs and outputs
- 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
- Testing
- Not tested
Browse files
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:
- Input parameters: Data the routine reads but does not modify
- Modify parameters: Data the routine both reads and modifies
- 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
constprefix to prevent modification of input parameters - Use
inkeyword to explicitly mark input-only parameters - Use
outkeyword to explicitly mark output-only parameters - Consider
inoutor 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
ByValandByRefkeywords 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
Current listing version
0.0.1
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供系统性的函数/API参数设计最佳实践,覆盖参数数量、排序、传递机制等核心维度
- 适用于广泛开发者场景,具有明确的实用价值和通用性
Highlights
- 触发描述清晰完整,涵盖定义、重构、优化等多种使用场景,边界明确
Highlights
- 结构完整,包含设计原则、语言特定建议、检查清单,逻辑清晰易遵循
- frontmatter 完整,文档组织良好
Areas to improve
-
缺少可执行示例 Reported severity: Minor
内容为设计原则与检查清单,未提供具体代码示例来验证建议的正确性
Recommendation: 建议补充 1-2 个典型语言(如 Python/Java)的参数设计正反示例,提升可操作性
Highlights
- 检查清单设计合理,便于开发者在实际编码中逐项验证
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.