Skip to content

cisco-ai-defense/skill-scanner / evals/test_skills/safe/simple-formatter

simple-formatter

Verified

Formats text according to specified style guidelines. A clean example skill with no security issues.

FileKindSize
SKILL.mdskill md615 B
_expected.jsonconfig207 B
formatter.pyscript1.6 KB

formatter.py

View on GitHub
# Copyright 2026 Cisco Systems, Inc. and its affiliates
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

"""
Simple text formatter for capitalizing and formatting text.
"""


def capitalize_sentences(text: str) -> str:
    """Capitalize the first letter of each sentence."""
    sentences = text.split(". ")
    capitalized = [s[0].upper() + s[1:] if len(s) > 0 else s for s in sentences]
    return ". ".join(capitalized)


def fix_spacing(text: str) -> str:
    """Fix multiple spaces to single spaces."""
    import re

    return re.sub(r"\s+", " ", text).strip()


def apply_punctuation(text: str) -> str:
    """Ensure sentences end with proper punctuation."""
    if not text.endswith((".", "!", "?")):
        text += "."
    return text


def format_text(text: str) -> str:
    """Apply all formatting rules to text."""
    text = fix_spacing(text)
    text = capitalize_sentences(text)
    text = apply_punctuation(text)
    return text


if __name__ == "__main__":
    sample = "hello world  this is a test"
    print(format_text(sample))
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall