Secure Codingのロゴ

Secure Coding

コミュニティ
MartinOlivero
secure-coding

WebアプリやSaaSのバックエンド、API、認証、データ処理のコードを書くときに使います。リリース後の監査ではなく、開発中に脆弱性を防ぐためのスキルです。「エンドポイントを追加」「ユーザー入力を処理」「ユーザーデータを保存」「安全かどうか確認」「APIを構築」「データベースに保存」「フォームを処理」「ユーザーがファイルをアップロード」「決済を処理」「シークレットを扱う」「CORSを設定」「レート制限」などの依頼をきっかけに使用します。開発中にOWASP Top 10の脆弱性対策、入力検証、シークレットの適切な管理、GDPRの基本を適用します。

Add to TypingMind

概要

公開者MartinOlivero
リポジトリsaas-builder
スキル名secure-coding
スター
4
フォーク
2
同梱ファイル
1
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 1個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    MartinOliveroがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Secure Coding」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/MartinOlivero/saas-builder/tree/main/skills/secure-coding
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MartinOlivero/saas-builder.git /tmp/saas-builder
mkdir -p .claude/skills
cp -r /tmp/saas-builder/skills/secure-coding .claude/skills/secure-coding
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSecure Codingを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSecure Codingを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Secure Codingは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Secure Coding

This skill keeps you from introducing vulnerabilities while you build. It is prevention, not audit — it runs at the moment you write an endpoint, a form handler, or a database write, and bakes in the safe default before the bug exists.

Analogy: it is the seatbelt you put on before driving, not the crash investigator who shows up afterward. Audit tools (Trail of Bits, Semgrep, CodeQL) inspect the wreck. This skill stops the crash.

Scope

This skill is for the solo dev or small team who has no security tooling installed and just wants to ship without leaving holes. If a dedicated audit plugin is present, this skill still runs first — preventing a vuln is always cheaper than finding it later.

Trigger

Activate whenever code touches: a request handler/endpoint, user input, a database write, authentication, file uploads, secrets/env vars, CORS, or any third-party webhook. Default-deny mindset: code with no explicit security decision is the bug.

Discovery (max 3 questions, only if unknown)

  1. Is this endpoint/data public, authenticated, or admin-only?
  2. Does it touch personal data (email, name, payment, location, anything identifying a person)?
  3. What is the backend — serverless functions (Vercel), a Node server, or a BaaS (Supabase/InsForge)?

The OWASP Top 10, as prevention rules

Apply the matching rule the instant you write the code. Each maps an OWASP 2021 category to a concrete default.

RiskPrevent it by
A01 Broken Access ControlCheck authorization on the server, on every endpoint. Verify the resource belongs to req.user (stop IDOR). Default-deny: no explicit check = bug. Never trust client-sent role/price/owner fields.
A02 Cryptographic FailuresHTTPS everywhere (free on Vercel). Hash passwords with bcrypt or argon2, never plaintext/reversible. Encrypt PII at rest. Never roll your own crypto.
A03 InjectionNever string-concat SQL. Parameterized queries / ORM only (pg params, Drizzle, Prisma, Kysely). Validate every input at the boundary with zod before it reaches logic or the DB.
A04 Insecure DesignThreat-model the feature first: who can call this, what is the worst input. Enforce limits by design — quotas, server-side amount/price checks.
A05 Security MisconfigurationAdd Helmet for secure headers. CORS = explicit origin allowlist (never * with credentials: true). Disable verbose error stacks in prod.
A06 Vulnerable ComponentsPin deps, run npm audit + Dependabot, remove unused packages, update before shipping.
A07 Auth FailuresUse a vetted auth provider (see the auth skill). Rate-limit login routes harder. httpOnly + Secure + SameSite cookies for sessions. MFA where possible.
A08 Data IntegrityVerify webhook signatures (e.g. Stripe signing secret). Don't deserialize untrusted data. Commit the lockfile.
A09 Logging FailuresLog auth + authz denials — but never log PII, tokens, passwords, or full request bodies. Redact first.
A10 SSRFDon't fetch user-supplied URLs server-side without an allowlist; block internal/metadata IP ranges.

API security defaults

  • Validate at the boundary with zod, and use .strict() schemas that whitelist exactly the allowed fields. This kills mass assignment — never spread req.body into a DB write; explicitly drop role, isAdmin, id, ownerId.
  • Rate-limit every public and auth endpoint (express-rate-limit, or the platform's edge limiter). Auth routes get a stricter limit.
  • CORS: allowlist origins explicitly. With credentials, * is forbidden by spec and a real hole.
  • Return correct status codes — 401 vs 403, 422 on validation, 429 + Retry-After on limit.

User data & GDPR basics (for developers)

  • Collect the minimum PII. Drop optional fields. Less data = less liability (GDPR Art. 5 minimization).
  • Encrypt in transit (TLS) and at rest. GDPR Art. 32 cites encryption as the recommended safeguard.
  • Set retention + deletion. Provide a way to delete a user's data on request.
  • Never log PII. Redact emails, tokens, bodies before they hit logs or Sentry.

Secrets hygiene

  • .gitignore .env, .env*.local, *.pem, *.key. Commit a .env.example with names only.
  • Secrets live in the platform's encrypted store (Vercel env vars marked Sensitive), never in the repo.
  • On Vite, only VITE_-prefixed vars reach the browser — a secret behind that prefix is a public leak.
  • Rotate by add-new → redeploy → revoke-old. Optionally run gitleaks as a pre-commit net.

Server decides, client asks

The rule behind most real holes: anything the client sends is a request, not a fact.

  • Prices, totals, roles, owners, statuses — computed or checked on the server.
  • File uploads — the server builds the path (scoped to the user), chooses the bucket, restricts the type, caps the size.
  • Identity — from a token the server validates, never from a cookie or field the browser can edit.
  • Never switch to the admin/service client to make a permission error go away. That removes the permission. Find out why the user's own credentials were refused.

Public endpoints (no login)

A form or endpoint anyone can call needs, at minimum: a captcha or equivalent, a honeypot field (named so autofill won't fill it), a rate cap that does not depend on the caller's IP, and sanitizing of every value that ends up in a message sent to someone else.

Field notes

references/field-notes.md holds the security failures behind these rules — plus a working Content-Security-Policy recipe (per-request nonce, strict-dynamic, Report-Only rollout) and where secrets actually leak from. The three that cost the most:

  1. A storage path taken from the form, uploaded with the admin client.
  2. An order line saved at a client-chosen price.
  3. An API key published inside a Markdown notes file by git add -A.

For database permissions on a BaaS, run rls-audit. For third-party webhooks, see integrations. For LLM calls, see ai-features.

Output

For each piece of code, deliver: the secure implementation, a one-line note on which risk it defends against, and any validation schema (zod) inline. When you spot a violation in existing code the user shows you, flag it with the fix — but the job is to write it safe the first time.

Reference

OWASP Cheat Sheet Series (~29k⭐), OWASP Top 10:2021, GDPR.eu / gdpr-info Art. 32. Tools: zod, helmet, express-rate-limit, bcrypt/argon2, gitleaks.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Secure Coding」では何ができますか?

WebアプリやSaaSのバックエンド、API、認証、データ処理のコードを書くときに使います。リリース後の監査ではなく、開発中に脆弱性を防ぐためのスキルです。「エンドポイントを追加」「ユーザー入力を処理」「ユーザーデータを保存」「安全かどうか確認」「APIを構築」「データベースに保存」「フォームを処理」「ユーザーがファイルをアップロード」「決済を処理」「シークレットを扱う」「CORSを設定」「レート制限」などの依頼をきっかけに使用します。開発中にOWASP Top 10の脆弱性対策、入力検証、シークレットの適切な管理、GDPRの基本を適用します。

TypingMindでSecure Codingを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Secure Codingはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSecure Codingをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/MartinOlivero/saas-builder/tree/main/skills/secure-codingを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Secure Codingを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Secure Codingで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSecure Codingを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Secure Coding」は無料ですか?

はい。MartinOliveroがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇