ma-agents 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ma-agents",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "NPX tool to install skills for AI coding agents (Claude Code, Gemini, Copilot, Kilocode, Cline, Cursor)",
5
5
  "main": "index.js",
6
6
  "bin": {
package/skills/README.md CHANGED
@@ -314,6 +314,31 @@ Enforces standardized file headers and method documentation across C++, C#, JS,
314
314
 
315
315
  ---
316
316
 
317
+ ### 15. Python Security Best Practices
318
+ **Directory:** `python-security-skill/`
319
+
320
+ Enforces secure Python coding standards aligned with OWASP Top 10 2025.
321
+
322
+ **Key Features:**
323
+ - ✅ **Injection Prevention**: Bans `eval()`, `exec()`, and insecure shell commands.
324
+ - ✅ **Secure Serialization**: Mandates `json` over `pickle` for untrusted data.
325
+ - ✅ **Crypto Standards**: Enforces `secrets` module and modern hashing (SHA256+).
326
+ - ✅ **Supply Chain**: Integrated with `pip-audit` and version pinning logic.
327
+
328
+ ---
329
+
330
+ ### 16. Python Dependency Management
331
+ **Directory:** `python-dependency-mgmt/`
332
+
333
+ Standardizes Python dependency handling using `uv` and `pip` (requirements.txt).
334
+
335
+ **Key Features:**
336
+ - ✅ **uv Mastery**: Full support for `uv lock`, `uv sync`, and `pyproject.toml`.
337
+ - ✅ **Legacy Support**: Layered `requirements.txt` (pinned + hashes).
338
+ - ✅ **Isolation**: Enforces virtual environment discipline and `.venv` usage.
339
+
340
+ ---
341
+
317
342
  ## Requirements
318
343
 
319
344
  ### All Skills
@@ -17,6 +17,7 @@ This skill enforces high-quality, standardized documentation for source code fil
17
17
  - **C++**: Use Doxygen style (`/** ... */`).
18
18
  - **C#**: Use XML Documentation style (`/// <summary> ...`).
19
19
  - **JS/TS**: Use JSDoc style (`/** ... */`).
20
+ - **Python**: Use PEP 257 Docstrings (`""" ... """`).
20
21
  * **Required Fields**:
21
22
  - **Summary**: Concise description of what the method does.
22
23
  - **Parameters**: Name and purpose of each argument.
@@ -37,6 +38,7 @@ This skill enforces high-quality, standardized documentation for source code fil
37
38
  | **C++** | Doxygen | `\brief`, `\param`, `\return`, `\throw` |
38
39
  | **C#** | XML Doc | `<summary>`, `<param>`, `<returns>`, `<exception>` |
39
40
  | **JS/TS** | JSDoc | `@description`, `@param`, `@returns`, `@throws` |
41
+ | **Python** | Docstrings | `Args:`, `Returns:`, `Raises:` (Google/NumPy style) |
40
42
 
41
43
  ---
42
44
 
@@ -0,0 +1,57 @@
1
+ # Python Documentation (Google/NumPy Style)
2
+
3
+ ### File Header
4
+ Every module should start with a docstring that provides a high-level overview.
5
+
6
+ ```python
7
+ """
8
+ data_processor.py
9
+ ~~~~~~~~~~~~~~~~~
10
+ Handles high-performance transformation of raw sensor data using NumPy.
11
+
12
+ :copyright: (c) 2026 by Antigravity.
13
+ :license: MIT, see LICENSE for more details.
14
+ """
15
+ ```
16
+
17
+ ### Method Documentation
18
+ Preferred style is Google or NumPy style for readability and integration with tools like Sphinx.
19
+
20
+ ```python
21
+ def calculate_moving_average(data, window_size):
22
+ """Calculates the moving average of a dataset.
23
+
24
+ This method uses a sliding window algorithm to smooth out volatility
25
+ in sensor inputs.
26
+
27
+ Args:
28
+ data (list[float]): A list or array of float values to process.
29
+ window_size (int): The size of the averaging window (must be > 0).
30
+
31
+ Returns:
32
+ float: The calculated moving average.
33
+
34
+ Raises:
35
+ ValueError: If data is empty or window_size is invalid.
36
+
37
+ Note:
38
+ This implementation assumes data is already cleaned.
39
+ """
40
+ if not data or window_size <= 0:
41
+ raise ValueError("Invalid data or window_size")
42
+ # ... implementation
43
+ ```
44
+
45
+ ### Class Documentation
46
+ ```python
47
+ class SignalFilter:
48
+ """A collection of signal processing utilities.
49
+
50
+ Attributes:
51
+ sampling_rate (int): The frequency at which signals are sampled.
52
+ """
53
+
54
+ def __init__(self, sampling_rate):
55
+ """Initializes the SignalFilter with a specific sampling rate."""
56
+ self.sampling_rate = sampling_rate
57
+ ```
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Code Documentation Best Practices",
3
- "description": "Standardize file headers and method documentation across C++, C#, JS, and TS.",
3
+ "description": "Standardize file headers and method documentation across C++, C#, JS, TS, and Python.",
4
4
  "version": "1.0.0",
5
5
  "author": "Antigravity",
6
6
  "tags": [
@@ -0,0 +1,38 @@
1
+ # Python Dependency Management (uv & pip)
2
+
3
+ This skill ensures consistent and reproducible Python environments using modern tools like `uv` and traditional standards like `requirements.txt`.
4
+
5
+ ## Policies
6
+
7
+ ### 1. Modern Workflow with `uv`
8
+ * **Rule**: Use `uv` for lightning-fast project management if available.
9
+ * **Action**:
10
+ - Use `uv lock` to generate `uv.lock`.
11
+ - Use `uv sync` to keep the environment in sync with the lockfile.
12
+ - Declare dependencies in `pyproject.toml`.
13
+ * **Rationale**: `uv` is significantly faster than `pip` and provides deterministic builds via lockfiles.
14
+
15
+ ### 2. Standardized `requirements.txt`
16
+ * **Rule**: If not using a modern manager, use a layered and pinned `requirements.txt` structure.
17
+ * **Action**:
18
+ - **Layered**: Use `requirements.in` (top-level deps) and `requirements.txt` (fully pinned transitive deps).
19
+ - **Environment Split**: Separate `requirements.txt` from `dev-requirements.txt`.
20
+ - **Hashes**: Generate hashes for security (`--generate-hashes` via `pip-compile`).
21
+
22
+ ### 3. Strict Version Pinning
23
+ * **Rule**: All production dependencies must be pinned to a specific version.
24
+ * **Action**: Use `package==1.2.3`, never `package>=1.2.3` in the final lock/txt file.
25
+
26
+ ### 4. Virtual Environment Discipline
27
+ * **Rule**: Never install dependencies globally.
28
+ * **Action**:
29
+ - Always create a `.venv` in the project root.
30
+ - For `uv`, it handles this automatically with `uv venv` or implicitly via `uv run`.
31
+
32
+ ### 5. Standard Build Systems (PEP 517/518)
33
+ * **Rule**: Use `pyproject.toml` as the source of truth for build metadata.
34
+
35
+ ## Tools of Choice
36
+ 1. **uv**: (Recommended) Fastest all-in-one manager.
37
+ 2. **pip-tools**: For generating pinned `requirements.txt` from `.in` files.
38
+ 3. **venv**: Core standard for isolation.
@@ -0,0 +1,67 @@
1
+ # Python Dependency Management Examples
2
+
3
+ ### 1. Modern Workspace with `uv`
4
+ **pyproject.toml:**
5
+ ```toml
6
+ [project]
7
+ name = "my-app"
8
+ version = "0.1.0"
9
+ dependencies = [
10
+ "requests==2.31.0",
11
+ "structlog>=24.1.0",
12
+ ]
13
+
14
+ [tool.uv]
15
+ managed = true
16
+ ```
17
+
18
+ **Commands:**
19
+ ```bash
20
+ # Add a new dependency and update lockfile
21
+ uv add pandas
22
+
23
+ # Run a script within the isolated environment
24
+ uv run main.py
25
+
26
+ # Sync environment with the lockfile
27
+ uv sync
28
+ ```
29
+
30
+ ### 2. Traditional `requirements.txt` (pip-tools)
31
+ **requirements.in:**
32
+ ```text
33
+ flask
34
+ psycopg2-binary
35
+ ```
36
+
37
+ **Workflow:**
38
+ ```bash
39
+ # Generate pinned requirements.txt with hashes
40
+ pip-compile --generate-hashes requirements.in
41
+
42
+ # Install exactly what is pinned
43
+ pip install -r requirements.txt
44
+ ```
45
+
46
+ ### 3. Development vs Production Deps
47
+ **dev-requirements.in:**
48
+ ```text
49
+ -c requirements.txt
50
+ pytest
51
+ black
52
+ ruff
53
+ ```
54
+
55
+ ```bash
56
+ # Generate dev-requirements.txt
57
+ pip-compile dev-requirements.in
58
+ ```
59
+
60
+ ### 4. Virtual Environment Setup (Standard)
61
+ ```bash
62
+ python -m venv .venv
63
+ # Linux/macOS
64
+ source .venv/bin/activate
65
+ # Windows
66
+ .venv\Scripts\activate
67
+ ```
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "Python Dependency Management",
3
+ "description": "Standardize Python dependency handling using uv and pip (requirements.txt).",
4
+ "version": "1.0.0",
5
+ "author": "Antigravity",
6
+ "tags": [
7
+ "python",
8
+ "uv",
9
+ "pip",
10
+ "dependencies",
11
+ "packaging",
12
+ "best-practices"
13
+ ],
14
+ "applies_when": [
15
+ "managing Python project dependencies",
16
+ "configuring Python build systems",
17
+ "updating requirements.txt or uv.lock",
18
+ "setting up Python development environments"
19
+ ],
20
+ "always_load": true
21
+ }
@@ -0,0 +1,52 @@
1
+ # Python Security Best Practices (OWASP 2025 aligned)
2
+
3
+ This skill provides mandatory security guardrails for Python applications, ensuring protection against common vulnerabilities and alignment with OWASP Top 10 standards.
4
+
5
+ ## Policies
6
+
7
+ ### 1. Zero Insecure Function Usage
8
+ * **Rule**: Ban functions that allow arbitrary code execution or insecure OS commands.
9
+ * **Action**:
10
+ - NEVER use `eval()` or `exec()`.
11
+ - Avoid `subprocess.run(..., shell=True)`. Use lists for commands instead.
12
+ - Avoid `yaml.load()` without specifying a loader (use `yaml.safe_load()`).
13
+
14
+ ### 2. Secure Data Serialization
15
+ * **Rule**: Protect against insecure deserialization.
16
+ * - **Action**:
17
+ - NEVER use `pickle` for untrusted data. Use `json` instead.
18
+ - Be cautious with `xml.etree.ElementTree` (vulnerable to XXE); use `defusedxml` if possible.
19
+
20
+ ### 3. Injection Prevention (A05:2025)
21
+ * **Rule**: Use parameterized queries for all database and API interactions.
22
+ * **Action**:
23
+ - Never use f-strings or `.format()` for SQL queries.
24
+ - Use ORM features (Django ORM, SQLAlchemy) or parameter placeholders (`%s`, `?`).
25
+
26
+ ### 4. Cryptographic Standards (A04:2025)
27
+ * **Rule**: Use modern, collision-resistant hashing and encryption.
28
+ * **Action**:
29
+ - Use `hashlib.sha256()` or better. Ban MD5 and SHA1.
30
+ - Use `secrets` module for tokens/passwords, not `random`.
31
+
32
+ ### 5. Dependency Integrity (A03:2025)
33
+ * **Rule**: Lock dependencies and scan for known vulnerabilities.
34
+ * **Action**:
35
+ - Always commit lockfiles (`uv.lock`, `poetry.lock`, or `requirements.txt` with hashes).
36
+ - Periodically run `pip-audit` or `safety`.
37
+
38
+ ### 6. Secure Error Handling (A10:2025)
39
+ * **Rule**: Do not leak sensitive information in tracebacks or logs.
40
+ * **Action**:
41
+ - Never log `pydantic` models or raw request bodies containing PII/Secrets.
42
+ - Use generic error messages for end-users while keeping detailed logs internally.
43
+
44
+ ## Python Security Mapping (OWASP 2025)
45
+
46
+ | Category | Python Vulnerability | Secure Alternative |
47
+ | :--- | :--- | :--- |
48
+ | **A01: Access Control** | URL hijacking in `requests` | Validate redirect targets |
49
+ | **A02: Configuration** | Debug mode in Flask/Django | `DEBUG = False` in production |
50
+ | **A03: Supply Chain** | Typosquatting/Old deps | Pin versions + `pip-audit` |
51
+ | **A05: Injection** | `os.system()` / RAW SQL | `subprocess.run()` list / ORM |
52
+ | **A08: Integrity** | `pickle.load()` | `json.loads()` |
@@ -0,0 +1,56 @@
1
+ # Python Security Examples
2
+
3
+ ### 1. Secure Subprocess (Avoiding Injection)
4
+ **Dangerous:**
5
+ ```python
6
+ import os
7
+ def delete_file(filename):
8
+ os.system(f"rm -rf {filename}") # VULNERABLE to injection
9
+ ```
10
+
11
+ **Secure:**
12
+ ```python
13
+ import subprocess
14
+ def delete_file(filename):
15
+ # Pass as a list, shell=False by default
16
+ subprocess.run(["rm", "-rf", filename], check=True)
17
+ ```
18
+
19
+ ### 2. Secure Serialization
20
+ **Dangerous:**
21
+ ```python
22
+ import pickle
23
+ def load_user(data):
24
+ return pickle.loads(data) # VULNERABLE to arbitrary code execution
25
+ ```
26
+
27
+ **Secure:**
28
+ ```python
29
+ import json
30
+ def load_user(data):
31
+ return json.loads(data) # Safe for untrusted input
32
+ ```
33
+
34
+ ### 3. Preventing SQL Injection
35
+ **Dangerous:**
36
+ ```python
37
+ cursor.execute(f"SELECT * FROM users WHERE id = '{user_id}'")
38
+ ```
39
+
40
+ **Secure:**
41
+ ```python
42
+ cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
43
+ ```
44
+
45
+ ### 4. Secure Randomness
46
+ **Dangerous:**
47
+ ```python
48
+ import random
49
+ token = str(random.random()) # Predictable
50
+ ```
51
+
52
+ **Secure:**
53
+ ```python
54
+ import secrets
55
+ token = secrets.token_urlsafe(32) # Cryptographically secure
56
+ ```
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "Python Security Best Practices",
3
+ "description": "Enforce secure Python coding standards following OWASP Top 10 2025.",
4
+ "version": "1.0.0",
5
+ "author": "Antigravity",
6
+ "tags": [
7
+ "python",
8
+ "security",
9
+ "owasp",
10
+ "vulnerability-prevention",
11
+ "best-practices"
12
+ ],
13
+ "applies_when": [
14
+ "writing or reviewing Python code",
15
+ "managing Python dependencies",
16
+ "configuring Python application environments",
17
+ "handling sensitive data in Python"
18
+ ],
19
+ "always_load": true
20
+ }
@@ -33,7 +33,14 @@ To ensure high code quality and maintainability by mandating that all public int
33
33
 
34
34
  ## Example Workflow
35
35
 
36
+ ### TypeScript (Jest)
36
37
  1. **Agent**: "I am adding a `calculateTotal` method to the `InvoiceService`. I will also create `InvoiceService.test.ts` to verify it."
37
38
  2. **Agent**: [Writes `calculateTotal` in `InvoiceService.ts`]
38
39
  3. **Agent**: [Writes tests in `InvoiceService.test.ts` using `test-generator` patterns]
39
40
  4. **Agent**: "Method and tests are complete. Running tests now..."
41
+
42
+ ### Python (Pytest)
43
+ 1. **Agent**: "I am adding a `validate_user` function to `auth.py`. I will also create `tests/test_auth.py` to verify it."
44
+ 2. **Agent**: [Writes `validate_user` in `auth.py`]
45
+ 3. **Agent**: [Writes tests in `tests/test_auth.py` using `test-generator` patterns]
46
+ 4. **Agent**: "Implementation and tests are ready. Running `pytest`."
@@ -7,7 +7,9 @@
7
7
  "testing",
8
8
  "quality",
9
9
  "policy",
10
- "tdd"
10
+ "tdd",
11
+ "python",
12
+ "pytest"
11
13
  ],
12
14
  "applies_when": [
13
15
  "writing or reviewing public APIs",
@@ -35,8 +35,9 @@ Generate comprehensive unit and integration tests for code.
35
35
  - Mock external dependencies
36
36
  - Clear assertion messages
37
37
 
38
- ## Example Output
38
+ ## Example Outputs
39
39
 
40
+ ### JavaScript (Jest)
40
41
  ```javascript
41
42
  describe('ComponentName', () => {
42
43
  test('should [behavior] when [condition]', () => {
@@ -49,13 +50,25 @@ describe('ComponentName', () => {
49
50
  // Assert
50
51
  expect(result).toEqual(expectedOutput);
51
52
  });
53
+ });
54
+ ```
52
55
 
53
- test('should handle edge case', () => {
54
- // ...
55
- });
56
+ ### Python (Pytest)
57
+ ```python
58
+ import pytest
59
+ from app.module import function_under_test
56
60
 
57
- test('should throw on invalid input', () => {
58
- expect(() => fn(invalid)).toThrow();
59
- });
60
- });
61
+ def test_should_behavior_when_condition():
62
+ # Arrange
63
+ input_data = setup_test_data()
64
+
65
+ # Act
66
+ result = function_under_test(input_data)
67
+
68
+ # Assert
69
+ assert result == expected_output
70
+
71
+ def test_should_raise_on_invalid_input():
72
+ with pytest.raises(ValueError):
73
+ function_under_test(None)
61
74
  ```
@@ -7,6 +7,8 @@
7
7
  "testing",
8
8
  "unit-tests",
9
9
  "integration-tests",
10
+ "python",
11
+ "pytest",
10
12
  "quality"
11
13
  ],
12
14
  "applies_when": [