- Home
- Skills
- Shinpr
- Claude Code Workflows
- Coding Principles
coding-principles_skill
102
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill shinpr/claude-code-workflows --skill coding-principles- SKILL.md7.5 KB
Overview
This skill provides language-agnostic coding principles focused on maintainability, readability, and quality. It distills practical rules for design, error handling, dependency management, performance, testing, security, and documentation. Use it as a lightweight guide when writing, refactoring, or reviewing code to keep systems clean and robust.
How this skill works
The skill inspects common development activities and offers concise, actionable heuristics: prefer simple solutions, enforce single-responsibility functions, group parameters, and separate side effects from transformation logic. It recommends concrete practices for error handling, dependency injection, testing, performance profiling, and secure defaults. It also provides triggers and safe refactoring steps to guide incremental improvements without breaking behavior.
When to use it
- Implementing new features and choosing a design approach
- Refactoring code or reducing technical debt
- Conducting code reviews and preparing PRs
- Designing interfaces, modules, or public APIs
- Writing tests or improving testability
Best practices
- Favor maintainability over short-term speed; delete unused code instead of commenting it out
- Keep functions small (typically <50 lines) and with 0–2 parameters; group related parameters into objects
- Handle errors explicitly, log contextual information, and avoid leaking sensitive data
- Inject dependencies to reduce coupling and make units easier to test
- Profile before optimizing and prefer algorithmic improvements over micro-optimizations
Example use cases
- Refactor a large function into small pure functions and explicit side-effect handlers
- Design an API: apply clear naming, document 'why', and include usage examples
- Prepare a pull request: self-review, keep commits atomic, and remove debug code
- Add robust error propagation and masked logging for production services
- Improve testability by converting hidden dependencies into injectable parameters
FAQ
Aim for 0–2 parameters; if you need 3+ group related values into an object/struct to keep signatures clear.
When should I optimize for performance?
Measure and profile first. Optimize only after identifying measurable bottlenecks and prefer algorithmic changes over premature micro-optimizations.