Agent skill
secure-coding-practices
Quellcode ansehen: nickcrew/claude-cortex
Installation
npx skills add nickcrew/claude-cortex --skill secure-coding-practices100
Installationen
EU-hosted inference API
Power your AI agent skills with open-source models.
Drop-in OpenAI-compatible API. No data leaves Europe.
MiniMax
MiniMax M3
$0.50 / $1.90
per M tokens
Z.ai
GLM 5.3 Flash
$0.20 / $0.60
per M tokens
MoonshotAI
Kimi K3
$4.00 / $18.00
per M tokens
DeepSeek
DeepSeek V4.1 Flash
$0.40 / $1.42
per M tokens
Secure Coding Practices
Comprehensive guidance for implementing security-first development patterns with defensive programming techniques and proactive threat mitigation strategies.
When to Use This Skill
- Implementing authentication and authorization systems
- Processing user input or external data
- Handling sensitive data (PII, credentials, financial information)
- Building APIs and web services
- Managing cryptographic operations (hashing, encryption)
- Conducting security-focused code reviews
- Establishing secure development standards for teams
- Evaluating third-party dependencies and libraries
- Designing error handling and logging strategies
- Implementing session management and token handling
Core Security Principles
Defense in Depth
Apply multiple layers of security controls - never rely on a single protection mechanism.
Fail Securely
When errors occur, default to the secure state (deny access, reject input, log event).
Least Privilege
Grant minimum necessary permissions - users, services, and databases should have only required access.
Trust Nothing
Validate all input, encode all output, verify all sources, authenticate all requests.
Quick Reference
| Task | Load reference |
|---|---|
| Input validation & sanitization | skills/secure-coding-practices/references/input-validation.md |
| Output encoding & XSS prevention | skills/secure-coding-practices/references/output-encoding.md |
| Authentication & sessions | skills/secure-coding-practices/references/authentication.md |
| Cryptography & key management | skills/secure-coding-practices/references/cryptography.md |
| Dependencies & supply chain | skills/secure-coding-practices/references/dependencies.md |
| Error handling & logging | skills/secure-coding-practices/references/error-handling.md |
| Secure defaults & configuration | skills/secure-coding-practices/references/secure-defaults.md |
Workflow
- Identify security requirements - Authentication, authorization, data protection, compliance
- Load relevant references - Use Quick Reference table to find specific guidance
- Implement security controls - Apply patterns from references with proper context
- Validate implementation - Test with security scanners, penetration testing, code review
- Monitor and maintain - Regular security audits, dependency updates, vulnerability scanning
Security Checklist
Input Validation:
- Validate all user input server-side with allowlists
- Use schema validation libraries (Joi, Yup, Zod)
- Implement strict type checking
- Sanitize file paths and prevent traversal
Output Encoding:
- Apply context-aware encoding (HTML, JS, URL, SQL)
- Use templating engines with auto-escaping
- Implement Content Security Policy (CSP)
- Set secure HTTP headers (Helmet.js)
Authentication & Authorization:
- Hash passwords with bcrypt/Argon2 (salt rounds ≥12)
- Implement secure session management
- Use HTTPS-only cookies with HttpOnly and SameSite
- Apply rate limiting on authentication endpoints
- Verify authorization on every request
Cryptography:
- Use AES-256-GCM for encryption
- Generate keys with crypto.randomBytes()
- Store secrets in environment variables or KMS
- Never roll your own crypto
Dependencies:
- Run npm audit regularly
- Lock dependency versions in package.json
- Use Snyk/Dependabot for monitoring
- Verify package integrity (SRI for CDN)
Error Handling & Logging:
- Return generic error messages to users
- Log errors with correlation IDs
- Never log passwords, tokens, or PII
- Monitor security events and alerts
Common Mistakes
- Using client-side validation as sole defense (always validate server-side)
- Blocklisting instead of allowlisting (define what's allowed, not forbidden)
- Exposing stack traces or internal errors to users
- Hardcoding secrets in source code
- Using Math.random() for security-critical operations
- Not implementing rate limiting on authentication endpoints
- Loose equality comparisons allowing type coercion attacks
- Trusting user input in database queries (SQL injection)
- Missing output encoding based on context (XSS vulnerabilities)
- Insufficient password hashing (weak algorithms or low work factor)
High-Risk Code Patterns
Watch for these patterns in code reviews:
- String concatenation in SQL queries (injection risk)
- Direct file path construction from user input (traversal risk)
- eval(), Function(), or exec() with user input (code injection)
- Deserialization of untrusted data (RCE risk)
- Hardcoded secrets or credentials (exposure risk)
- Missing authentication/authorization checks (access control)
- Weak cryptography (MD5, SHA1, ECB mode)
- Verbose error messages in production (information disclosure)
- Missing input validation (injection, DoS)
- Insecure session configuration (hijacking risk)
Resources
OWASP Resources:
- OWASP Top 10: https://owasp.org/Top10/
- OWASP Cheat Sheet Series: https://cheatsheetseries.owasp.org/
- OWASP ASVS: Application Security Verification Standard
- OWASP Dependency-Check: https://owasp.org/www-project-dependency-check/
Standards & Guidelines:
- NIST Cybersecurity Framework: https://www.nist.gov/cyberframework
- NIST SP 800-63B: Digital Identity Guidelines (Authentication)
- CWE Top 25: https://cwe.mitre.org/top25/
Tools:
- SAST: SonarQube, Semgrep, CodeQL
- DAST: OWASP ZAP, Burp Suite
- SCA: Snyk, npm audit, Dependabot
- Secrets Detection: TruffleHog, git-secrets
Verwandte Skills
Mehr aus dieser Quelle: nickcrew/claude-cortex
react-performance-optimization
nickcrew/claude-cortex
1.9K installs
owasp-top-10
nickcrew/claude-cortex
760 installs
ui-design-aesthetics
nickcrew/claude-cortex
362 installs
threat-modeling-techniques
nickcrew/claude-cortex
357 installs
token-efficiency
nickcrew/claude-cortex
245 installs
repo-cleanup
nickcrew/claude-cortex
183 installs
So verwenden Sie diesen Skill
- 1
Install secure-coding-practices by running
npx skills add nickcrew/claude-cortex --skill secure-coding-practicesin your project directory. Führen Sie den obigen Installationsbefehl in Ihrem Projektverzeichnis aus. Die Skill-Datei wird von GitHub heruntergeladen und in Ihrem Projekt platziert. - 2
Keine Konfiguration erforderlich. Ihr KI-Agent (Claude Code, Cursor, Windsurf usw.) erkennt installierte Skills automatisch und nutzt sie als Kontext bei der Code-Generierung.
- 3
Der Skill verbessert das Verständnis Ihres Agenten für secure-coding-practices, und hilft ihm, etablierte Muster zu befolgen, häufige Fehler zu vermeiden und produktionsreifen Code zu erzeugen.
Was Sie erhalten
Skills sind Klartext-Anweisungsdateien — kein ausführbarer Code. Sie kodieren Expertenwissen über Frameworks, Sprachen oder Tools, das Ihr KI-Agent liest, um seine Ausgabe zu verbessern. Das bedeutet null Laufzeit-Overhead, keine Abhängigkeitskonflikte und volle Transparenz: Sie können jede Anweisung vor der Installation lesen und prüfen.
Kompatibilität
Dieser Skill funktioniert mit jedem KI-Coding-Agenten, der das skills.sh-Format unterstützt, einschließlich Claude Code (Anthropic), Cursor, Windsurf, Cline, Aider und anderen Tools, die projektbezogene Kontextdateien lesen. Skills sind auf Transportebene framework-agnostisch — der Inhalt bestimmt, für welche Sprache oder welches Framework er gilt.
Data sourced from the skills.sh registry and GitHub. Install counts and security audits are updated regularly.