Avoid Numeric Index
This skill prevents AI from using numbered lists or indices in its responses, promoting cleaner and more natural output.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add avoid-numeric-index npx -- -y @trustedskills/avoid-numeric-index
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"avoid-numeric-index": {
"command": "npx",
"args": [
"-y",
"@trustedskills/avoid-numeric-index"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill prevents AI agents from using numeric indexes when iterating over lists or arrays. It ensures that the agent uses more descriptive and readable methods for accessing elements, such as forEach, map, or filtering based on properties. This leads to clearer code and reduces potential errors associated with index-based access.
When to use it
- When reviewing AI-generated code that relies heavily on numeric indexes (e.g.,
for i in range(len(list))). - During code refactoring exercises where you want to improve the readability of list processing logic.
- To enforce coding style guidelines that discourage index-based iteration.
- When generating documentation or tutorials that emphasize best practices for working with lists and arrays.
Key capabilities
- Identifies instances of numeric indexing in code.
- Suggests alternative, more descriptive methods (e.g.,
forEach,map). - Automatically refactors code to avoid numeric indexes where appropriate.
Example prompts
- "Refactor this Python code to avoid using numeric indexes when iterating over the 'users' list."
- "Analyze this JavaScript function and suggest improvements for how it accesses elements in the 'products' array."
- "Rewrite this TypeScript snippet to use a more readable approach than
for (let i = 0; i < arr.length; i++)."
Tips & gotchas
The skill is most effective when applied to codebases where numeric indexing is prevalent. It may require some manual adjustments in complex scenarios or legacy code.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.