secure-coding skill
✓ 検証済みコード生成時に、入力値の検証、インジェクション対策、シークレット管理などのセキュリティを考慮したコーディングプラクティスを適用します。
- GitHubスター
- 211
- ファイル
- 2
- 最終コミット
- 2026年10月24日
- ライセンス
- MIT
- 許可されたツール
- —
secure-coding skillは何をしますか
secure-codingはAgent Skillsです。 コード生成時に、入力値の検証、インジェクション対策、シークレット管理などのセキュリティを考慮したコーディングプラクティスを適用します。.
skillのSKILL.mdから生成された要約。
secure-coding skill について
この SKILL は、コード生成プロセスにおいて、セキュリティを意識した思考を開発者に提供します。信頼境界の意識、入力値の検証、インジェクション対策を強制することで、強固なセキュリティ態勢の維持に重点を置いています。エージェントがユーザー入力、認証、データベースクエリ、または外部 API の処理を担う際、この SKILL をロードすることで、生成されるコードが OWASP の原則などの安全基準に準拠することを保証します。
この SKILL は、code-forge、refactor-safely、bug-fix といったコード生成用の molecule に自動的に統合されています。自己検証チェックリストとアクティブなアンチパターンスキャンを実行することで、ハードコードされたシークレット、SQL 文字列の結合、過剰な権限設定などの問題を検知します。アーキテクチャやクリーンコードに関する SKILL とは異なり、このツールはコードのセキュリティを専門に制御します。例えば、エラーメッセージから内部のスタックトレースやファイルパスが漏洩しないようにするといった制御を行います。
開発者は .lattice/config.yaml ファイルを通じてセキュリティ基準をカスタマイズできます。これにより、デフォルトのセキュリティドキュメントを上書きまたはオーバーレイしたり、エラーハンドリングのパターンを特定の言語の慣習に適応させたりすることが可能です。この SKILL は、多層防御と最小権限の原則に基づいたコードを生成します。
エージェントができること
- 1セキュアなコード生成厳格な信頼境界を維持しながら、外部のユーザー入力を処理する新しいコードコンポーネントを生成します。
- 2脆弱性スキャン既存のコードに対してセキュリティレビューを実行し、潜在的なインジェクションや認可の欠陥を特定します。
- 3シークレット管理の強制コードベースからハードコードされた API キーやパスワードを特定し、削除します。
- 4カスタムセキュリティ基準リポジトリのルートにカスタムドキュメントを設定することで、プロジェクト固有のセキュリティルールを適用します。
skill の SKILL.md から作成されています。すべてのユースケースは、その引用と照合されています。
secure-coding skillのインストール方法
各コマンドはskillフォルダをクライアントのskillsディレクトリにコピーします。読み込むには、クライアントを再起動するか新しいセッションを開始してください。プラグインにsecure-coding skillをインストールする
/plugin marketplace add techygarg/lattice /plugin install lattice@lattice
Claude Codeにsecure-coding skillをインストールする
~/.claude/skills/secure-coding/SKILL.md
$ npx degit techygarg/lattice/skills/secure-coding ~/.claude/skills/secure-codingClaude Code (project)にsecure-coding skillをインストールする
.claude/skills/secure-coding/SKILL.md
$ npx degit techygarg/lattice/skills/secure-coding .claude/skills/secure-codingCodexにsecure-coding skillをインストールする
~/.agents/skills/secure-coding/SKILL.md
$ npx degit techygarg/lattice/skills/secure-coding ~/.agents/skills/secure-codingGemini CLIにsecure-coding skillをインストールする
~/.gemini/skills/secure-coding/SKILL.md
$ npx degit techygarg/lattice/skills/secure-coding ~/.gemini/skills/secure-codingClaude.aiにsecure-coding skillをインストールする
npx degit techygarg/lattice/skills/secure-coding secure-coding && zip -r secure-coding.zip secure-coding # claude.ai → Customize → Skills → + → Create skill → Upload a skill → secure-coding.zip
自動チェック
実行日 2026年11月15日完全なレポート →自動チェックに合格しました。これはセキュリティ監査ではありません。エージェントに実行させる前にスクリプトを読んでください。 チェックの仕組み
- ソースリポジトリがリンクされており、アクセス可能techygarg/lattice/skills/secure-coding is public and reachablegithub.com/techygarg/lattice/tree/HEAD/skills/secure-coding ↗合格
- オープンソースライセンス (OSI)MITspdx.org/licenses/MIT.html ↗合格
- 過去1年以内にコミットまたはリリースありLast commit 2026-10-24github.com/techygarg/lattice/commits ↗合格
- スクリプトにダウンロード実行や認証情報の窃取がないNo scripts in the skill folder合格
- SKILL.md に隠れた指示がないNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/techygarg/lattice/blob/HEAD/skills/secure-coding/ ↗合格
- 事前許可ツールが限定されているNo pre-approved tools; the agent asks before using onegithub.com/techygarg/lattice/blob/HEAD/skills/secure-coding/ ↗合格
- SKILL.md が Agent Skills の形式に従っているValid name and description; says when to use it; 68 linesgithub.com/techygarg/lattice/blob/HEAD/skills/secure-coding/ ↗合格
SKILL.md
GitHubで表示Secure Coding
Config Resolution
Projects can customize this skill's standards. Resolution order:
- Read
.lattice/config.yamlin the repo root. - If found, check
paths.secure_codingfor a custom document path. - If a custom document exists at that path, read it and check its YAML frontmatter for
mode:mode: override: the custom document has full precedence. Use it instead of the embedded defaults. It must be comprehensive -- treat it as the sole reference.mode: overlay(or no mode field): read the embedded./references/defaults.mdfirst, then apply the custom document's sections on top. A custom section replaces the matching default section (matched by exact heading); new sections append after the defaults.
- If a custom path is configured but no document exists at it → tell the user which configured path is missing, then fall back to
./references/defaults.md. - If there is no config file or no
paths.secure_codingkey, read./references/defaults.md. - Language adaptation: if
paths.language_idiomsis set in the config and the document exists, read its "Error Handling" section and adapt §2 (Input Validation Patterns) error-message patterns to the language's idioms. Language idioms take precedence over the pseudocode defaults.
Self-Validation Checklist
STOP after generating each component. Verify ALL checks before proceeding. A check clearly fails → fix the code before presenting. A check is a judgment call with multiple valid approaches (see Ambiguity Signals) → flag it -- present options and reasoning rather than silently choosing.
- TRUST BOUNDARIES: Where does trusted code meet untrusted data? Are all boundaries explicitly identified?
- INPUT VALIDATION: Is every external input validated at the boundary with an allowlist before it reaches business logic?
- QUERY SAFETY: Are all database queries parameterized? Is any string concatenation used in query building?
- COMMAND SAFETY: Is there any shell/command execution? If so, is the input strictly allowlisted?
- SECRETS: Are there API keys, passwords, tokens, or connection strings in code? If so → move them to environment variables or a secret manager.
- OUTPUT ENCODING: Is output encoded appropriately for its render context (HTML, JSON, URL)?
- AUTHORIZATION: Is authorization verified at the service layer, not just the controller? Does every endpoint enforce least privilege?
- ERROR MESSAGES: Do error messages exposed to users avoid revealing internal detail (stack traces, SQL queries, file paths)?
- DEPENDENCIES: Is each new third-party package necessary? Are versions pinned or constrained? Is any known-vulnerable package being added?
All checks pass → state "Passes secure-coding. [next step]."
Active Anti-Pattern Scan
STOP: After verifying the checklist above, scan the output for each anti-pattern below. Any box you can check → fix before presenting the code.
- Trust All Input: no validation on request parameters; data flows straight into business logic → validate at the boundary with an allowlist.
- SQL String Concatenation: user input interpolated into a SQL query → use a parameterized query or ORM query builder.
- Hardcoded Secrets: API key, password, or token in source code → use an env var or secret manager.
- Missing Authorization: auth checked at login but not re-verified at the service or resource level → check at every layer.
- Overly Broad Permissions: admin access granted where read-only suffices → apply least privilege.
- Unvalidated Redirects: a user-controlled URL used in a redirect → allowlist permitted destinations.
- Verbose Error Messages: stack trace or SQL in an API response → return a generic message; log details server-side.
- Logging Sensitive Data: passwords, tokens, or PII in log files → log the event, not the value; mask sensitive fields.
Ambiguity Signals
Checks here often have multiple valid outcomes. When you encounter one, present the options rather than silently choosing. If framework:collaborative-judgment is loaded, use its presentation format.
- Trust Boundary Scope: an internal API behind a trusted gateway may or may not need full boundary validation.
- Error Message Detail: how much detail is "actionable but safe" depends on whether the consumer is a human user, a frontend client, or an internal service.
- Validation Depth: whether to re-validate at inner layers (defense-in-depth) or trust boundary validation alone.
- Auth vs Authz Failure Response: whether to return 401 (not authenticated) or 403 (not authorized) depends on whether the identity is known.
Core Principle
Govern the security posture of generated code -- trust boundaries, input validation, injection prevention, secrets, authorization.
Boundary with clean-code: clean-code governs error-message craft; this skill governs what error messages must not reveal (internal detail).
Boundary with architecture: architecture defines where checks live (service layer, not controller); this skill defines what to check (identity confirmed, permission granted, resource owned).
See ./references/defaults.md.
このスキルのファイル
2secure-coding skillに関する質問
Claude Codeにsecure-coding skillをインストールするには
npx degit techygarg/lattice/skills/secure-coding ~/.claude/skills/secure-codingを実行してください。Claude Codeは~/.claude/skills(すべてのプロジェクト)または.claude/skills(単一プロジェクト)からskillsを読み込み、説明がタスクに一致する場合にskillを使用します。
secure-coding skillはどのクライアントで使用できますか
Agent Skills形式を読み込むすべてのクライアントで使用できます: Claude Code、Codex、Gemini CLI、claude.ai(ZIPとしてアップロード)。skill内のスクリプトは、クライアントがコード実行を許可した場合にのみ実行されます。
secure-coding SKILL の範囲は何ですか?
生成されるコードのセキュリティ態勢を制御します。具体的には、信頼境界、入力値の検証、インジェクション対策、シークレット管理、および多層防御による認可に焦点を当てています。
プロジェクトのセキュリティ基準をカスタマイズするにはどうすればよいですか?
リポジトリのルートに .lattice/config.yaml ファイルを作成し、paths.secure_coding の下にカスタムドキュメントのパスを指定することで、基準をカスタマイズできます。