You can add only inside homepage using below code,
app/code/Vendor/Modulename/view/frontend/layout/cms_index_index.xml
cms_index_index.xml
file,
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<css src="Vendor_Modulename::css/styles.css"/>
<script src="Vendor_Modulename::js/custom.js"/>
</head>>
<body>
//body code
</body>
</page>
Put css file at app/code/Vendor/Modulename/view/frontend/web/css/styles.css
Put js file at app/code/Vendor/Modulename/view/frontend/web/js/custom.js
skin/frontend/<your_package>/<your_theme>/jsfilename.js
?