Skip to content
Back to skills

Sec Init

ASecurity

Enables the 57blocks security baseline in the current project: detects the project type and writes a short always-on security rule into CLAUDE.md / AGENTS.md / .cursor/rules, so every coding session automatically includes the security self-check. Optional `language=<code>` (default `en`; `zh` for Simplified Chinese) sets the language of all replies and reports. Use when the user says \"enable the security plugin\", \"sec-init\", \"sec-init language=zh\" or \"initialize security rules\".

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 4, 2026
securityrustgosqlreactexpressfastapidjangoflaskspringgit

Works with

  • claude code
  • cursor
  • cli
  • api

Security analysis

A100/100

Pro scans all 11 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add 57blocks/security-plugin --skill sec-init --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sec Init?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sec Init
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/57blocks-sec-init/badge)](https://www.skillsdirectory.com/skills/57blocks-sec-init)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: "sec-init"
description: "Enables the 57blocks security baseline in the current project: detects the project type and writes a short always-on security rule into CLAUDE.md / AGENTS.md / .cursor/rules, so every coding session automatically includes the security self-check. Optional `language=<code>` (default `en`; `zh` for Simplified Chinese) sets the language of all replies and reports. Use when the user says \"enable the security plugin\", \"sec-init\", \"sec-init language=zh\" or \"initialize security rules\"."
---

# sec-init: enable the security baseline in a project

Run once per project after installing the plugin. Once committed, it takes effect for the whole project team.

## Input
- `sec-init`: initialize with the default language, English.
- `sec-init language=zh`: replies, self-check summaries, sec-check results, sec-audit / sec-fix reports and finding text are all written in Simplified Chinese. `zh-CN` is accepted as an alias. `language=en` switches back to English.

Language precedence: the `language=` argument of this run > the language already recorded in an existing `57blocks-security` block (re-running without the argument keeps it) > `en`. Any other value: tell the user that `en` and `zh` are supported and stop without writing files.

## Steps
1. **Detect domains**: look for the following markers in the project (root and module directories such as `app/`, `android/`, `ios/`, `packages/*`) to derive the domain list (may be several):
   - web: `package.json` (express/nest/next/koa/fastify…), `requirements.txt`/`pyproject.toml` (django/fastapi/flask), `pom.xml`/`build.gradle(.kts)` with Spring dependencies or plugins, `go.mod`, `composer.json`
   - web3-evm: `*.sol`, `foundry.toml`, `hardhat.config.*`
   - web3-soroban: `Cargo.toml` contains `soroban-sdk`
   - web3-solana: `Anchor.toml`, depends on `solana-program` / `anchor-lang`
   - web3-move: `Move.toml`
   - web3-ton: `*.fc` `*.func` `*.tact` `*.tolk`
   - ai-llm: depends on openai / anthropic / langchain / llamaindex / ai-sdk / vector stores
   - mobile: `pubspec.yaml`, react-native / expo, `*.xcodeproj` / `*.xcworkspace` / `Podfile`, any `AndroidManifest.xml` (native Android keeps it under `app/src/main/`), `build.gradle(.kts)` applying `com.android.application` or `com.android.library`. A Gradle project is mobile, not web, unless it also has Spring dependencies.
   - wallet-dapp: wagmi / viem / ethers / web3.js / @solana/wallet-adapter / stellar-wallets-kit / freighter
2. **Write the always-on rule** (if a `<!-- 57blocks-security:start -->` block already exists, replace it instead of appending again):
   - Claude Code → `CLAUDE.md` at the project root
   - Codex and other tools that read AGENTS.md → `AGENTS.md` at the project root
   - Cursor → `.cursor/rules/57blocks-security.mdc` (frontmatter `alwaysApply: true`)
   Write all three files so it works whichever tool team members use. The content is the template below, with `{{domains}}` replaced by the detection result, `{{helpers}}` by the result of step 2b, `{{language}}` by the language code (`en` or `zh`) and `{{language_name}}` by `English` or `Simplified Chinese`. The block itself always stays in English so every tool and teammate can read it.
   In `AGENTS.md` only, replace `{{trigger_tables}}` with the body (without the frontmatter) of each detected domain's file under [rules/](rules/), one after another; Codex has no path-scoped rules, so this is how it gets them. In `CLAUDE.md` and the Cursor rule, replace it with nothing: those tools load the same tables per file type through step 2a.
2a. **Write path-scoped rules** for each detected domain that has a file under [rules/](rules/): copy it to `.claude/rules/57blocks-security-<domain>.md` as is (Claude Code loads it when a matching file is read or edited), and to `.cursor/rules/57blocks-security-<domain>.mdc` with the `paths:` list rewritten as `globs: "<pattern>,<pattern>"` plus `alwaysApply: false`. Cursor splits `globs` on commas, so expand brace patterns first: `**/*.{ts,tsx}` becomes `**/*.ts,**/*.tsx`. Replace files of the same name; leave other rule files alone.
2b. **Record the project's security helpers**: look for existing authentication middleware or guards, authorization/policy helpers, tenant or ownership scopes, validation schema libraries, the error handler, and on chain access-control, initializer and safe-transfer bases. Write what you find into the `Security helpers:` line of the block as `name (path)` entries, at most 8; write `none found` when there are none. Re-running sec-init refreshes the line.
3. Make sure `.gitignore` contains `.env`, `.env.*` (keep `.env.example`), `*.pem`, `*.key`, `security-audit/raw/`; add any that are missing.
4. Tell the user, in the chosen language: the detected domains, the language, the security helpers found, which files were changed, and recommend committing these changes.

## Always-on rule template
```markdown
<!-- 57blocks-security:start -->
<!-- 57blocks-security:language={{language}} -->
## Security baseline (57blocks security plugin)
Project domains: {{domains}}.
Security helpers: {{helpers}}.
Language: {{language_name}}. Reply to the user and write every security output (self-check summary, sec-check results, sec-audit and sec-fix reports, finding text) in this language.
- While writing code, follow the 57blocks trigger table for the code's domain (loaded with the files it covers, or listed below): when a line's signal matches what you are building, do its must-do. Reuse the helpers above. Do not ask the user about it. The table is enough for a coding task: do not open the 57blocks skill files (`sec-core`, `sec-<domain>`, `sec-code`) to prepare. The table lists only what is easy to miss; everything else still gets your usual secure-coding care: treat all input as untrusted and follow security best practices.
- Never: hardcode secrets; concatenate SQL/commands/paths; trust identity, amounts or prices sent by the client; add entry points without permission checks; disable security checks to silence errors; execute LLM output directly without validation.
- End a task whose change matched a trigger line with `Security self-check: ...` on the last line: each matched line and the fact that shows it is done, P0/P1 fixed on the spot. Any other change ends with `Security self-check: pass (no sensitive changes)`.
- If the task includes committing or opening a PR, run `sec-check` on the diff first. Never start `sec-audit` inside a coding task: it is the whole-project audit the user runs before delivery.
{{trigger_tables}}
<!-- 57blocks-security:end -->
```

Files in this skill

  • README.md506 B
  • SKILL.md6.5 KB
  • rules/57blocks-security-ai-llm.md1.4 KB
  • rules/57blocks-security-mobile.md1 KB
  • rules/57blocks-security-wallet-dapp.md1.9 KB
  • rules/57blocks-security-web.md2.1 KB
  • rules/57blocks-security-web3-evm.md2.4 KB
  • rules/57blocks-security-web3-move.md568 B
  • rules/57blocks-security-web3-solana.md1.2 KB
  • rules/57blocks-security-web3-soroban.md858 B
  • rules/57blocks-security-web3-ton.md1.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.