Skip to content

Commit 816a536

Browse files
authored
Merge pull request #84 from project-codeguard/agent-skills
chore: rebase dev onto main, convert claude code to agent skills
2 parents 190dc45 + e0cde0d commit 816a536

44 files changed

Lines changed: 515 additions & 167 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"name": "codeguard-security",
1414
"source": "./",
1515
"description": "Comprehensive security rules for AI coding agents",
16-
"version": "1.0.0",
16+
"version": "1.0.1",
1717
"repository": "https://github.com/project-codeguard/rules.git",
1818
"tags": [
1919
"security",

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "codeguard-security",
33
"description": "Security code review skill based on Project CodeGuard's comprehensive security rules. Helps AI coding agents write secure code and prevent common vulnerabilities.",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"author": {
66
"name": "Project CodeGuard",
77
"url": "https://project-codeguard.org"

.github/ISSUE_TEMPLATE/new-rule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ body:
66
- type: markdown
77
attributes:
88
value: |
9-
Thank you for your new rule request! Please provide as much detail as possible. Use any of the existing rules as a reference. You only have to provide the rule contents (markdown), not the rule metadata. We will handle the rest. In other words, convert your rule into all the formats (Cursor, Windsurf, Copilot).
9+
Thank you for your new rule request! Please provide as much detail as possible. Use any of the existing rules as a reference. You only have to provide the rule contents (markdown), not the rule metadata. We will handle the rest. In other words, convert your rule into all the formats (Cursor, Windsurf, Copilot, Antigravity).
1010
1111
- type: textarea
1212
id: description

.github/ISSUE_TEMPLATE/rule-feedback.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ body:
2626
- Cursor
2727
- GitHub Copilot
2828
- Windsurf
29+
- Antigravity
2930
- Codex
3031
- Augment Code
3132
- Sourcegraph

.github/workflows/build-ide-bundles.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
zip -r ../ide-rules-cursor.zip .cursor/
5555
zip -r ../ide-rules-windsurf.zip .windsurf/
5656
zip -r ../ide-rules-copilot.zip .github/
57+
zip -r ../ide-rules-antigravity.zip .agent/
5758
cd ..
5859
zip -r ide-rules-all.zip dist/
5960
ls -lh ide-rules-*.zip
@@ -67,5 +68,6 @@ jobs:
6768
ide-rules-cursor.zip \
6869
ide-rules-windsurf.zip \
6970
ide-rules-copilot.zip \
71+
ide-rules-antigravity.zip \
7072
--clobber
7173

.github/workflows/validate-rules.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ jobs:
5151
"sources/core/codeguard-1-hardcoded-credentials.md"
5252
"sources/core/codeguard-1-crypto-algorithms.md"
5353
"sources/core/codeguard-1-digital-certificates.md"
54-
"sources/core/codeguard-1-safe-c-functions.md"
5554
"sources/core/codeguard-SKILLS.md.template"
5655
)
5756
@@ -90,6 +89,11 @@ jobs:
9089
exit 1
9190
fi
9291
92+
if [ ! -d "test-output/.agent" ]; then
93+
echo "❌ Antigravity rules not generated"
94+
exit 1
95+
fi
96+
9397
echo "✅ All IDE formats generated successfully"
9498
9599
- name: Check skills/ directory is up-to-date

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ git push origin main
160160

161161
**Note**: The conversion script automatically syncs the version from `pyproject.toml` to:
162162
- `.claude-plugin/plugin.json` and `marketplace.json` (Claude Code plugin metadata)
163-
- All generated IDE rule files (Cursor `.mdc`, Windsurf `.md`, Copilot `.instructions.md`, Claude Code `.md`)
163+
- All generated IDE rule files (Cursor `.mdc`, Windsurf `.md`, Copilot `.instructions.md`, Claude Code `.md`, Antigravity `.md`)
164164

165165
This ensures version consistency across all artifacts.
166166

@@ -174,7 +174,7 @@ This ensures version consistency across all artifacts.
174174

175175
GitHub Actions will automatically:
176176
- ✅ Validate versions match the tag
177-
- ✅ Build IDE bundles (Cursor, Windsurf, Copilot)
177+
- ✅ Build IDE bundles (Cursor, Windsurf, Copilot, Antigravity)
178178
- ✅ Upload ZIP artifacts to the release
179179

180180
## Testing Your Changes

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ This project is an AI model-agnostic security framework and ruleset (internally
1010

1111
AI coding agents are transforming software engineering, but this speed can introduce security vulnerabilities. Is your AI coding agent implementation introducing security vulnerabilities?
1212

13-
- Skipping input validation
14-
- Hardcoding secrets and credentials
15-
- Using weak cryptographic algorithms
16-
- Relying on unsafe functions
17-
- Missing authentication/authorization checks
18-
- Missing any other security best practice
13+
- Skipping input validation
14+
- Hardcoding secrets and credentials
15+
- Using weak cryptographic algorithms
16+
- Relying on unsafe functions
17+
- Missing authentication/authorization checks
18+
- Missing any other security best practice
1919

2020
Project CodeGuard solves this by embedding security best practices directly into AI coding agent workflows.
2121

@@ -31,14 +31,14 @@ Project CodeGuard is designed to integrate seamlessly across the entire AI codin
3131

3232
Our rules cover essential security domains:
3333

34-
- **🔐 Cryptography**: Safe algorithms (including post-quantum cryptography), secure key management, certificate validation
35-
- **🛡️ Input Validation**: SQL injection prevention, XSS protection, command injection defense
36-
- **🔑 Authentication**: MFA best practices, OAuth/OIDC, secure session management
37-
- **Authorization**: RBAC/ABAC, access control, IDOR prevention
38-
- **📦 Supply Chain**: Dependency security, SBOM generation, vulnerability management
39-
- **☁️ Cloud Security**: IaC hardening, container security, Kubernetes best practices
40-
- **📱 Platform Security**: Mobile apps, web services, API security
41-
- **🔍 Data Protection**: Privacy, encryption at rest/transit, secure storage
34+
- **Cryptography**: Safe algorithms (including post-quantum cryptography), secure key management, certificate validation
35+
- **Input Validation**: SQL injection prevention, XSS protection, command injection defense
36+
- **Authentication**: MFA best practices, OAuth/OIDC, secure session management
37+
- **Authorization**: RBAC/ABAC, access control, IDOR prevention
38+
- **Supply Chain**: Dependency security, SBOM generation, vulnerability management
39+
- **Cloud Security**: IaC hardening, container security, Kubernetes best practices
40+
- **Platform Security**: Mobile apps, web services, API security
41+
- **Data Protection**: Privacy, encryption at rest/transit, secure storage
4242

4343
## Quick Start
4444

@@ -54,7 +54,7 @@ Get started in minutes:
5454
## How It Works
5555

5656
1. **Security rules** are written in unified markdown format (`sources/` directory)
57-
2. **Conversion tools** translate rules to IDE-specific formats (Cursor, Windsurf, Copilot, Claude Code)
57+
2. **Conversion tools** translate rules to IDE-specific formats (Cursor, Windsurf, Copilot, Agent Skills, Antigravity)
5858
3. **Release automation** packages rules into downloadable ZIP files
5959
4. **AI assistants** reference these rules when generating or reviewing code
6060
5. **Secure code** is produced automatically without developer intervention
@@ -63,7 +63,7 @@ Get started in minutes:
6363

6464
```
6565
sources/ # Source rules
66-
skills/ # Claude Code plugin (generated, committed)
66+
skills/ # Agent Skills format (generated, committed)
6767
src/ # Conversion and validation tools
6868
dist/ # Other IDE bundles (generated, not committed)
6969
```
@@ -97,4 +97,4 @@ This project uses dual licensing:
9797
This licensing approach ensures the security rules remain freely accessible and reusable while providing appropriate terms for software components.
9898

9999

100-
Copyright © 2025 Cisco Systems, Inc.
100+
Copyright © 2025 Cisco Systems, Inc.

docs/claude-code-skill-plugin.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,13 @@ When generating or reviewing code, Claude follows this 3-step workflow:
7070

7171
### Rule Categories
7272

73-
**Always-Apply Rules** (4 critical rules checked on every code operation):
73+
**Always-Apply Rules** (3 critical rules checked on every code operation):
7474
- `codeguard-1-hardcoded-credentials` - Never hardcode secrets or credentials
7575
- `codeguard-1-crypto-algorithms` - Use modern cryptographic algorithms
7676
- `codeguard-1-digital-certificates` - Validate certificate security
77-
- `codeguard-1-safe-c-functions` - Replace unsafe C/C++ functions
7877

79-
**Context-Specific Rules** (18 rules applied based on technology and features):
80-
- Input validation, authentication, authorization, APIs, data storage, privacy, logging, cryptography, file handling, serialization, supply chain, DevOps, cloud, Kubernetes, IaC, frameworks, and mobile security
78+
**Context-Specific Rules** (19 rules applied based on technology and features):
79+
- Input validation, authentication, authorization, APIs, data storage, privacy, logging, cryptography, file handling, serialization, supply chain, DevOps, cloud, Kubernetes, IaC, frameworks, mobile security, and memory safety (C/C++)
8180

8281
## Usage Examples
8382

@@ -155,7 +154,7 @@ For organizations, deploy CodeGuard to all developers automatically:
155154

156155
The plugin includes 22 comprehensive security rules organized into two categories:
157156

158-
### Always-Apply Rules (4 rules)
157+
### Always-Apply Rules (3 rules)
159158

160159
These critical rules are checked on **every** code operation:
161160

@@ -164,9 +163,8 @@ These critical rules are checked on **every** code operation:
164163
| `codeguard-1-hardcoded-credentials` | Prevent secrets, passwords, API keys, tokens in source code |
165164
| `codeguard-1-crypto-algorithms` | Ban weak algorithms (MD5, SHA-1, DES); use modern alternatives |
166165
| `codeguard-1-digital-certificates` | Validate certificate expiration, key strength, signature algorithms |
167-
| `codeguard-1-safe-c-functions` | Replace unsafe C/C++ functions (gets, strcpy, strcat, sprintf) |
168166

169-
### Context-Specific Rules (18 rules)
167+
### Context-Specific Rules (19 rules)
170168

171169
These rules apply based on the programming language, framework, or feature being implemented. Claude automatically selects relevant rules based on context:
172170

@@ -182,6 +180,7 @@ These rules apply based on the programming language, framework, or feature being
182180
| **Files & Serialization** | `codeguard-0-file-handling-and-uploads`, `codeguard-0-xml-and-serialization` |
183181
| **Infrastructure** | `codeguard-0-supply-chain-security`, `codeguard-0-devops-ci-cd-containers`, `codeguard-0-cloud-orchestration-kubernetes`, `codeguard-0-iac-security` |
184182
| **Platforms** | `codeguard-0-framework-and-languages`, `codeguard-0-mobile-apps` |
183+
| **Memory Safety (C/C++)** | `codeguard-0-safe-c-functions` |
185184

186185
> **Note:** Each rule file contains detailed guidance, checklists, and examples. Claude references these automatically based on the code context.
187186
@@ -291,7 +290,7 @@ uv run python src/convert_to_ide_formats.py
291290
This command:
292291
- Converts unified rules from `sources/` to IDE-specific formats
293292
- Generates `skills/` directory with the 22 core security rules (Claude Code plugin)
294-
- Creates `dist/` with IDE-specific formats (Cursor, Windsurf, Copilot)
293+
- Creates `dist/` with IDE-specific formats (Cursor, Windsurf, Copilot, Antigravity)
295294

296295
**Note:** The Claude Code plugin (`skills/`) always contains only the 22 curated core rules. To build bundles with OWASP supplementary rules for other IDEs, use `--source core owasp`, but this only affects `dist/`, not `skills/`.
297296

@@ -385,6 +384,11 @@ Found an issue with the plugin or want to improve it?
385384

386385
## Version History
387386

387+
### Version 1.0.1
388+
- Changed `codeguard-1-safe-c-functions` from always-apply to `codeguard-0-safe-c-functions` context-specific rule (C/C++ only)
389+
- Updated rule counts: 3 always-apply rules, 19 context-specific rules
390+
- Fixed GitHub Copilot instructions to use `description` field instead of `title`
391+
388392
### Version 1.0.0
389393
- Initial release
390394
- 22 comprehensive security rules

docs/faq.md

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,20 @@ This FAQ document provides clear, concise answers to help developers seamlessly
2626
---
2727
## Q: Will these rules consume a lot of the AI agent's **context window**?
2828

29-
**A:** No. The always-on rules are designed to be lightweight and efficient, and should not consume a lot of the AI agent's context window. The "glob" rules are designed to be applied only to the related file types specified in the rule.
29+
**A:** The always‑on rules are lightweight and have minimal impact on the AI agent’s context window. Glob‑scoped rules only apply to their matching file types. Below are Cursor examples: left, no rules; right, three always‑on rules enabled.
30+
31+
<p align="center">
32+
<img src="../images/context-window-no-rules.png" alt="Cursor AI agent context window usage without Project CodeGuard rules" width="40%" style="display:inline-block; margin-right:2%;" />
33+
<img src="../images/context-window-with-rules.png" alt="Cursor AI agent context window usage with Project CodeGuard rules enabled" width="40%" style="display:inline-block;" />
34+
</p>
35+
36+
<center>
37+
<sub>
38+
<b>Left:</b> Context window usage without any rules in place.<br>
39+
<b>Right:</b> Context window usage with three always-on rules enabled.
40+
</sub>
41+
</center>
42+
3043

3144
---
3245
## Q: What are the OWASP supplementary rules?
@@ -37,19 +50,19 @@ This FAQ document provides clear, concise answers to help developers seamlessly
3750

3851
## Q: How can I use the rules in my own AI agent?
3952

40-
**A:** You can use the rules in your own AI agent by creating a custom ruleset. You can create a custom ruleset by creating a new file in the `.cursor/rules`, `.windsurf/rules`, or `.github/instructions` directories and adding the rules you want to apply. You can also use the `project-codeguard/rules` repository as a template to create your own ruleset.
53+
**A:** You can use the rules in your own AI agent by creating a custom ruleset. You can create a custom ruleset by creating a new file in the `.cursor/rules`, `.windsurf/rules`, `.github/instructions`, or `.agent/rules` directories and adding the rules you want to apply. You can also use the `project-codeguard/rules` repository as a template to create your own ruleset.
4154

4255
---
4356

4457
## Q: Why does the downloaded release folder appear empty?
4558

46-
**A:** After downloading and extracting the release, the folders may appear empty because the rule directories (`.cursor/`, `.windsurf/`, `.github/`) start with a dot (`.`) and are hidden by default on most operating systems.
59+
**A:** After downloading and extracting the release, the folders may appear empty because the rule directories (`.cursor/`, `.windsurf/`, `.github/`, `.agent/`) start with a dot (`.`) and are hidden by default on most operating systems.
4760

4861
**To show hidden files:**
4962

5063
=== "macOS"
5164

52-
In Finder, navigate to the extracted folder and press ++cmd+shift+period++ to toggle the visibility of hidden files. You should now see the `.cursor/`, `.windsurf/`, and `.github/` directories.
65+
In Finder, navigate to the extracted folder and press ++cmd+shift+period++ to toggle the visibility of hidden files. You should now see the `.cursor/`, `.windsurf/`, `.github/`, and `.agent/` directories.
5366

5467
=== "Windows"
5568

@@ -63,15 +76,20 @@ This FAQ document provides clear, concise answers to help developers seamlessly
6376

6477
In your file manager, press ++ctrl+h++ to toggle hidden files, or use `ls -la` in the terminal to view all files including hidden ones.
6578

66-
Once hidden files are visible, you can copy the appropriate directory (`.cursor/`, `.windsurf/`, or `.github/`) to your project root.
79+
Once hidden files are visible, you can copy the appropriate directory (`.cursor/`, `.windsurf/`, `.github/`, or `.agent/`) to your project root.
6780

6881
---
6982

7083
## Q: Can I use this with Claude Code?
7184

72-
**A:** Yes! Claude Code automatically reads and follows instructions from a `CLAUDE.md` file in your project root. To use Project CodeGuard rules with Claude Code you can point to the Project CodeGuard rules in your `CLAUDE.md` file.
85+
**A:** Yes! Install the Project CodeGuard Claude Code plugin (Agent Skill) and Claude will apply the security rules automatically while you code.
86+
87+
```bash
88+
/plugin marketplace add project-codeguard/rules
89+
/plugin install codeguard-security@project-codeguard
90+
```
7391

74-
When Claude Code operates in your project, it treats the Project CodeGuard security rules in `CLAUDE.md` as authoritative system instructions.
92+
For team/repo defaults, add the plugin in `.claude/settings.json` so it’s enabled for all contributors. See the [Claude Code Plugin documentation](claude-code-skill-plugin.md) for details and troubleshooting.
7593

7694

7795
## Q: How can I report a problem or enhancement to any of the rules?
@@ -86,17 +104,6 @@ We welcome all feedback - whether it's a bug report, success story, or enhanceme
86104

87105
---
88106

89-
## Q: Why do I get the following error message in GitHub for some of the rules?
90-
91-
```
92-
Error in user YAML: (<unknown>): did not find expected alphabetic
93-
or numeric character while scanning an alias at line x column x
94-
```
95-
96-
**A:** You can safely ignore this error. GitHub attempts to parse YAML headers combined with markdown content, which can cause this warning. It does not affect rule functionality - the rules will work correctly in your IDE regardless of this GitHub display issue.
97-
98-
---
99-
100107
## Q: How can I contribute to these rules and this project?
101108

102109
**A:** You can contribute at any time by:
@@ -110,6 +117,12 @@ See [CONTRIBUTING.md](https://github.com/project-codeguard/rules/blob/main/CONTR
110117

111118
---
112119

120+
## Q: Does Project CodeGuard replace my security scanners?
121+
122+
**A:** No, Project CodeGuard rules do not replace your security scanners. The primary purpose of CodeGuard is to help you avoid introducing new security vulnerabilities as you write code, by providing agentic rules and guidance directly in your IDE. If you perform a code review using these rules, Project CodeGuard will most likely identify many of the same vulnerabilities that security scanning tools would find. However, CodeGuard is not a comprehensive substitute for security scanners—automated security tools are designed to thoroughly analyze your entire codebase and catch a broader range of issues. For best results, use CodeGuard rules in combination with your existing security scanners to maximize your code’s security.
123+
124+
---
125+
113126
## Still have questions?
114127

115128
**Can't find your answer?**

0 commit comments

Comments
 (0)